Files
sf-rf/script/OPD_accurracy_check_scan.py
2021-05-31 17:41:04 +02:00

92 lines
2.2 KiB
Python
Executable File

"""
File: OPD_accurracy_check_scan.py
Author: KR84
Copyright PSI LLRF, 2016
Purpose Record klystron OPD accurracy by setting the station to different operation points
Preconditions - RF station is running
- you know the settling time of the feedback + 100 P2P-count + 100 Hz, if required, change it below
-
"""
#################################################################
# Parameter SECTION, change it to your RF station before run
SECTION = "SINEG01"
# for 100 Hz and P2P-count = 100 this can be at least 1.1 seconds
latency = 10
#################################################################
# some other parameters
# re-define filename, such that the SECTION is also in the filename
set_exec_pars(path = "{data}/{year}_{month}/{date}/{date}_{time}_" + str(SECTION) + "_{name}")
#################################################################################
# define all PVs
#import ch.psi.pshell.epics.ProcessVariable as PV
import ch.psi.pshell.epics.ChannelDouble as PV
# controlled variabales
cv_kly_pow = PV("set_power", SECTION + "-RSYS:SET-KLY-POWER")
cv_kly_headroom = PV("headroom" , SECTION + "-RHLA-JOBRMP:SET-KLY-POWER-HR")
# measured variables
mv_kly_pow_avg = PV("meas_power" ,SECTION + "-RKLY-DCP10:FOR-POWER-AVG")
mv_kly_pow_avg_gated = PV("meas_power_gated" ,SECTION + "-RKLY-DCP10:FOR-POWER-AVG-GATED")
# auxiliary measured variables, but not scanned
# initialize all PVs
cv_kly_pow.initialize()
cv_kly_headroom.initialize()
mv_kly_pow_avg.initialize()
mv_kly_pow_avg_gated.initialize()
#################################################################################
# scan
scan_result = ascan((cv_kly_pow, cv_kly_headroom), (mv_kly_pow_avg,mv_kly_pow_avg_gated), ( 1.0, 0), (17.0, 0.1), (1.0, 0.05) , latency=latency, title="OPD Power Scan", zigzag=False)
#################################################################################
# close all PVs
cv_kly_pow.close()
cv_kly_headroom.close()
mv_kly_pow_avg.close()
mv_kly_pow_avg_gated.close()
#################################################################################
# analyze