Skip to content
Snippets Groups Projects

Fix PCAL correction EPICS records

Merged Evan Goetz requested to merge evan-goetz/pydarm:calcs-pcal into master
All threads resolved!
Files
2
+ 18
3
@@ -882,10 +882,25 @@ class CALCSModel(DARMModel):
# Pcal corrections
# See T1700106
# We are reading the PCAL and DARM signals from the CALCS model, both
# of which have an implicit 1 16k clock cycle delay. The
# PCAL_LINE*_CORRECTION is being divided into the DARM/PCAL transfer
# function (both in CALCS). The compute_pcal_correction uses the
# "endstation" boolean to indicate that the PCAL channel read is in the
# CALCS model so it has been divided by a delay.
# The darm_advance is therefore necessary so that the CALCS DARM signal
# is properly treated as though it is coming from the OMC model, which
# is where DARM originates.
# (DARM / PCAL)_calcs * (1/PCAL_LINE*_CORRECTION) =
# (DARM_omc / PCAL_end)
# TODO: the front end and GDS needs to be fixed, and once it is fixed,
# then this math can be separate EPICS records and be more clear.
pcal_correction = self.pcal.compute_pcal_correction(freq, endstation)
PCAL_LINE1_CORRECTION = pcal_correction[0]
PCAL_LINE2_CORRECTION = pcal_correction[4]
PCAL_LINE3_CORRECTION = pcal_correction[5]
darm_advance = signal.dfreqresp(
digital_delay_filter(-1, 16384), 2*np.pi*freq/16384)[1]
PCAL_LINE1_CORRECTION = pcal_correction[0] / darm_advance[0]
PCAL_LINE2_CORRECTION = pcal_correction[4] / darm_advance[4]
PCAL_LINE3_CORRECTION = pcal_correction[5] / darm_advance[5]
# We divide out the pcal reference arm sign since we know which arm
# the next two values will be assigned to. This makes the next two
Loading