31 lines
1.9 KiB
Python
31 lines
1.9 KiB
Python
do_elog = True
|
|
#station = "STEST01" # define param locally
|
|
if get_exec_pars().args: # args is set by callin process (Qt panel)
|
|
station = args[0]
|
|
phase_set = caget(station + "-RSYS:PHASE-SET")
|
|
ampli_set = caget(station + "-RSYS:AMPLT-SET")
|
|
power_set = caget(station + "-RSYS:POWER-SET")
|
|
if phase_set == 'True':
|
|
phase_offset = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE-CALC")
|
|
phase_offset_old = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
|
|
caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", phase_offset)
|
|
if ampli_set == 'True':
|
|
vsum_ampl = caget(station + "-RSYS:GET-VSUM-AMPLT")
|
|
amplitude_scale = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE-CALC")
|
|
amplitude_scale_old = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE")
|
|
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", amplitude_scale)
|
|
new_acc_volt = vsum_ampl * amplitude_scale
|
|
caput(station + "-RSYS:SET-ACC-VOLT", new_acc_volt)
|
|
if power_set == 'True':
|
|
power_scale = caget(station + "-RSYS:SET-VOLT-POWER-SCALE-CALC")
|
|
power_scale_old = caget(station + "-RSYS:SET-VOLT-POWER-SCALE")
|
|
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", power_scale)
|
|
if do_elog == True and (phase_set == 'True' or ampli_set == 'True' or power_set == 'True'):
|
|
title = "Set RF calibration:" + station
|
|
log_msg = ""
|
|
if (phase_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %12.2f" % phase_offset + " deg (was %12.2f" % phase_offset_old + " deg )\n"
|
|
if (ampli_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-AMPLT-SCALE: %12.3f" % amplitude_scale + " MV (was %12.3f" % amplitude_scale_old + " MV )\n"
|
|
if (power_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VOLT-POWER-SCALE: %12.7f" % power_scale + " MW/MV^2 (was %12.7f" % power_scale_old + " MW/MV^2)"
|
|
attachments = []
|
|
elog(title, log_msg, attachments)
|