Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.

Commit e811ddd

Browse files
scripts/python: disable debug for rtm-lamp test script
1 parent cee427c commit e811ddd

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

scripts/python/test_open_loop.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# constants
2323

2424
fs = 1/940e-9 # frequency for PSD calc
25-
samples = 2000 # number of samples for acquisition
25+
samples = 1500 # number of samples for acquisition
2626
channels = 8 # number of channels (max 12, 8 actually in use)
2727
pi_kp = 5000000 # PI Kp parameter
2828
pi_ti = 300 # PI Ti parameter
@@ -35,7 +35,7 @@
3535
dac_cnt_max = 50000 # 0.5ms
3636
dac_data = 2689 # 0.3V
3737
sp_data = 22382 # 2.5V
38-
debug = 1 # 1 = activate debug mode
38+
debug = 0 # 1 = activate debug mode
3939

4040
# PV prefixes
4141

@@ -320,26 +320,25 @@
320320
input()
321321

322322
sp_data_conv = sp_data*voltage_gain
323+
PV(pv_current_setpoint_inf).put(-sp_data, wait=True)
323324

324-
err = 1
325-
while err >= 1:
325+
print('>>> Configure open loop square wave for +-%.2fV...' %(sp_data_conv))
326326

327-
print('>>> Configure open loop square wave for +-%.2fV...' %(sp_data_conv))
327+
if debug == 1:
328+
print('\033[1;32m \nPress ENTER to continue... \033[0m')
329+
input()
328330

329-
for i in range(0, channels):
330-
PV(pv_amp_enable[i]).put(0, wait=True)
331-
PV(pv_pi_enable[i]).put(0, wait=True)
332-
PV(pv_square_wave_openloop[i]).put(0, wait=True)
333-
334-
time.sleep(0.1)
335-
PV(pv_current_setpoint_inf).put(-sp_data, wait=True)
336-
337-
for i in range(0, channels):
338-
PV(pv_current_setpoint[i]).put(sp_data, wait=True)
339-
PV(pv_square_wave_openloop[i]).put(1, wait=True)
340-
PV(pv_amp_enable[i]).put( 1, wait=True)
331+
for i in range(0, channels):
332+
PV(pv_current_setpoint[i]).put(sp_data, wait=True)
333+
PV(pv_square_wave_openloop[i]).put(1, wait=True)
334+
PV(pv_amp_enable[i]).put( 1, wait=True)
335+
336+
time.sleep(1)
341337

342-
print('>>> Configure open loop square wave for +-%.2fV... Done!' %(sp_data_conv))
338+
print('>>> Configure open loop square wave for +-%.2fV... Done!' %(sp_data_conv))
339+
340+
err = 1
341+
while err >= 1:
343342

344343
min_values_1 = np.zeros(channels)
345344
max_values_1 = np.zeros(channels)
@@ -370,8 +369,6 @@
370369
time.sleep(1) # just to see the waveform change in graphical interface
371370
PV(pv_acq_trigger_event).put(1, wait=True)
372371

373-
PV(pv_current_setpoint_inf).put(0, wait=True)
374-
375372
print('>>> New acquisition... Done!')
376373

377374
print('\n>>> Find the two max and min values for each channel...')
@@ -445,6 +442,11 @@
445442
print('\033[1;32m \nPress ENTER to continue... \033[0m')
446443
input()
447444

445+
for i in range(0, channels):
446+
PV(pv_amp_enable[i]).put(0, wait=True)
447+
PV(pv_pi_enable[i]).put(0, wait=True)
448+
PV(pv_square_wave_openloop[i]).put(0, wait=True)
449+
448450
print('\n>>> Calculate the inductance for each channel...')
449451

450452
inductance = np.zeros(channels)
@@ -486,9 +488,11 @@
486488

487489
results.close()
488490

491+
PV(pv_current_setpoint_inf).put(0, wait=True)
489492
for i in range(0, channels):
490493
PV(pv_amp_enable[i]).put(0, wait=True)
491494
PV(pv_square_wave_openloop[i]).put(0, wait=True)
495+
PV(pv_current_setpoint[i]).put(0, wait=True)
492496

493497
print('\n--------------------------------------------------------------------------')
494498
print('----------------------------------- END ----------------------------------')

0 commit comments

Comments
 (0)