From 61003ee33c11420522afbcaa06e8d0edced9826f Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Wed, 14 Aug 2024 12:38:49 -0300 Subject: [PATCH] fofb.ENH: update default value of some PVs --- siriuspy/siriuspy/fofb/csdev.py | 35 ++++++++++++++++++--------------- siriuspy/siriuspy/fofb/main.py | 23 +++++++++++----------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/siriuspy/siriuspy/fofb/csdev.py b/siriuspy/siriuspy/fofb/csdev.py index 88d3a5c5f..7e6313ae2 100644 --- a/siriuspy/siriuspy/fofb/csdev.py +++ b/siriuspy/siriuspy/fofb/csdev.py @@ -49,6 +49,7 @@ class HLFOFBConst(_csdev.Const): TIKHONOV_REG_CONST = 0 SINGVALHW_THRS = 1e-14 DEF_MAX_ORB_DISTORTION = 200 # [um] + DEF_ACC_DECIMATION = 4600 CONV_UM_2_NM = 1e3 ACCGAIN_RESO = 2**-12 @@ -161,22 +162,22 @@ def get_hlfofb_database(self): 'type': 'enum', 'enums': _et.OPEN_CLOSED, 'value': self.LoopState.Open}, 'LoopGainH-SP': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1200, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainH-RB': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1200, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainH-Mon': { 'type': 'float', 'value': 0, 'prec': 4, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainV-SP': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1660, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainV-RB': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1660, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainV-Mon': { @@ -233,16 +234,16 @@ def get_hlfofb_database(self): 'type': 'float', 'prec': 0, 'value': 5, 'unit': 's', 'lolim': 0.0, 'hilim': 1000.0}, 'CHAccSatMax-SP': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, 'CHAccSatMax-RB': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, 'CVAccSatMax-SP': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, 'CVAccSatMax-RB': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, # FOFB Controllers @@ -276,24 +277,26 @@ def get_hlfofb_database(self): # decimation configuration 'FOFBAccDecimation-Sel': { 'type': 'enum', 'enums': _et.DEC_OPT, - 'value': self.DecOpt.FOFB, 'unit': 'FOFB_Monit_Custom'}, + 'value': self.DecOpt.Monit, 'unit': 'FOFB_Monit_Custom'}, 'FOFBAccDecimation-Sts': { 'type': 'enum', 'enums': _et.DEC_OPT, - 'value': self.DecOpt.FOFB, 'unit': 'FOFB_Monit_Custom'}, + 'value': self.DecOpt.Monit, 'unit': 'FOFB_Monit_Custom'}, 'FOFBAccDecimation-SP': { - 'type': 'float', 'value': 1, 'prec': 0, 'lolim': 1, - 'hilim': 8600, 'unit': 'count'}, + 'type': 'float', 'value': self.DEF_ACC_DECIMATION, 'prec': 0, + 'lolim': 1, 'hilim': 8600, 'unit': 'count'}, 'FOFBAccDecimation-RB': { - 'type': 'float', 'value': 1, 'prec': 0, 'lolim': 1, - 'hilim': 8600, 'unit': 'count'}, + 'type': 'float', 'value': self.DEF_ACC_DECIMATION, 'prec': 0, + 'lolim': 1, 'hilim': 8600, 'unit': 'count'}, # filter configuration 'PSConfigMat-SP': { 'type': 'float', 'value': _np.zeros(self.psconfig_size), - 'prec': 5, 'count': self.psconfig_size, 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, + 'prec': 5, 'count': self.psconfig_size, + 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, 'PSConfigMat-RB': { 'type': 'float', 'value': _np.zeros(self.psconfig_size), - 'prec': 5, 'count': self.psconfig_size, 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, + 'prec': 5, 'count': self.psconfig_size, + 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, # Reference Orbit (same order of SOFB) 'RefOrbX-SP': { diff --git a/siriuspy/siriuspy/fofb/main.py b/siriuspy/siriuspy/fofb/main.py index c4d2eee7a..496feb108 100644 --- a/siriuspy/siriuspy/fofb/main.py +++ b/siriuspy/siriuspy/fofb/main.py @@ -32,25 +32,26 @@ def __init__(self, tests=False): self._init = False # internal states + pvdb = self._pvs_database self._loop_state = self._const.LoopState.Open self._loop_state_lastsp = self._const.LoopState.Open - self._loop_gain_h = 0.0520 + self._loop_gain_h = pvdb['LoopGainH-RB']['value'] self._loop_gain_mon_h = 0 - self._loop_gain_v = 0.0520 + self._loop_gain_v = pvdb['LoopGainV-RB']['value'] self._loop_gain_mon_v = 0 self._thread_loopstate = None self._abort_thread = False self._loop_max_orb_dist = self._const.DEF_MAX_ORB_DISTORTION self._loop_max_orb_dist_enbl = self._const.DsblEnbl.Dsbl self._loop_packloss_detec_enbl = self._const.DsblEnbl.Dsbl - self._corr_status = self._pvs_database['CorrStatus-Mon']['value'] + self._corr_status = pvdb['CorrStatus-Mon']['value'] self._corr_setcurrzero_dur = 5 self._thread_currzero = None self._abort_thread_currzero = False - self._ch_maxacccurr = self._pvs_database['CHAccSatMax-RB']['value'] - self._cv_maxacccurr = self._pvs_database['CVAccSatMax-RB']['value'] - self._time_frame_len = self._pvs_database['TimeFrameLen-RB']['value'] - self._fofbctrl_status = self._pvs_database['CtrlrStatus-Mon']['value'] + self._ch_maxacccurr = pvdb['CHAccSatMax-RB']['value'] + self._cv_maxacccurr = pvdb['CVAccSatMax-RB']['value'] + self._time_frame_len = pvdb['TimeFrameLen-RB']['value'] + self._fofbctrl_status = pvdb['CtrlrStatus-Mon']['value'] self._thread_syncnet = None self._thread_reset = None self._fofbctrl_syncenbllist = _np.ones(self._const.nr_bpms, dtype=bool) @@ -70,8 +71,8 @@ def __init__(self, tests=False): 'cv': _np.ones(self._const.nr_cv, dtype=bool), 'rf': _np.ones(1, dtype=bool), } - self._corr_accdec_val = 1 - self._corr_accdec_enm = self._const.DecOpt.FOFB + self._corr_accdec_val = pvdb['FOFBAccDecimation-RB']['value'] + self._corr_accdec_enm = pvdb['FOFBAccDecimation-Sts']['value'] self._corr_accfilter_val = _np.zeros( (self._const.nr_chcv, self._const.psconfig_nr_coeffs_columns), dtype=float @@ -718,9 +719,9 @@ def set_corr_accdec(self, option, value): fofb = self._auxbpm['INFOFOFBRate-RB'] dec = monit // fofb else: + dec = self._const.DEF_ACC_DECIMATION self._update_log('WARN:Could not read decimation from BPM') - self._update_log('WARN:rates. Using value 4600.') - dec = 4600 + self._update_log(f'WARN:rates. Using value {dec}.') else: dec = self._corr_accdec_val self._corr_accdec_enm = value