Files
sf-op/script/RFscan/phase_scan_caqtdm_set.py
2021-08-17 14:06:14 +02:00

38 lines
1.9 KiB
Python
Executable File

do_elog = True
is_panel = get_exec_pars().source != CommandSource.ui
if is_panel:
station = args[0]
else:
station = "STEST01"
phase_set = caget(station + "-RSYS:PHASE-SET")
ampli_set = caget(station + "-RSYS:AMPLT-SET")
power_set = caget(station + "-RSYS:POWER-SET")
n = 0
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)
n = n + 1
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)
n = n + 1
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)
n = n + 1
if n > 0:
if do_elog == 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)