From 9520f017c258812f0de63f119d586e91b98cf1f2 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 10:25:37 -0300 Subject: [PATCH 01/14] SOFB.BUG: Only invoke FOFB when `acc` is `"SI"`. --- siriuspy/siriuspy/sofb/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index 68b7b6699..39a514a50 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -501,6 +501,8 @@ def _update_status(self): self._correctors.status | self._matrix.status | self._orbit.status) self.run_callbacks('Status-Mon', self._status) + if self.acc != 'SI': + return # Update PVs related to interaction with FOFB: fofb_state = self.fofb.connected and self.fofb.loop_state download = self._download_fofb_kicks and fofb_state From 5b4575601b464b277633885c9ebe7ee6900d1383 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 10:26:06 -0300 Subject: [PATCH 02/14] SOFB.BUG: Fix sign when downloading kicks from FOFB. --- siriuspy/siriuspy/sofb/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index 39a514a50..c68317b2b 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -1050,7 +1050,7 @@ def _interact_with_fofb_in_apply_kicks( if self._download_fofb_kicks and fofb.loop_state: kicks_fofb = _np.r_[fofb.kickch, fofb.kickcv, 0] dorb = _np.dot(fofb.respmat, kicks_fofb) - dkicks2 = -self.matrix.calc_kicks(dorb) + dkicks2 = self.matrix.calc_kicks(dorb) kicks, dkicks2 = self._process_kicks( self._ref_corr_kicks+dkicks, dkicks2, apply_gain=False) From a171b244072d744ede60142718f4034aa8002545 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 10:29:26 -0300 Subject: [PATCH 03/14] Update VERSION file to 2.56.1. --- siriuspy/siriuspy/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/VERSION b/siriuspy/siriuspy/VERSION index 5f46e11ee..f250a9d35 100644 --- a/siriuspy/siriuspy/VERSION +++ b/siriuspy/siriuspy/VERSION @@ -1 +1 @@ -2.56.0 +2.56.1 From 7f45f574e622314f9d0a8c55001210e93ad3d5a9 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 10:37:32 -0300 Subject: [PATCH 04/14] SOFB.BUG: return minus sign to kicks when downloading kicks from FOFB. --- siriuspy/siriuspy/sofb/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index c68317b2b..ae9fce27f 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -1050,7 +1050,11 @@ def _interact_with_fofb_in_apply_kicks( if self._download_fofb_kicks and fofb.loop_state: kicks_fofb = _np.r_[fofb.kickch, fofb.kickcv, 0] dorb = _np.dot(fofb.respmat, kicks_fofb) + # NOTE: calc_kicks return the kicks to correct dorb, which means + # that a minus sign is already applied by this method. To negate + # this correction, we need an extra minus sign here: dkicks2 = self.matrix.calc_kicks(dorb) + dkicks2 *= -1 kicks, dkicks2 = self._process_kicks( self._ref_corr_kicks+dkicks, dkicks2, apply_gain=False) From 87013a6bcc9b0dd089c8363c3d5a3588af8c4ab0 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 10:52:41 -0300 Subject: [PATCH 05/14] SOFB.BUG: Fix command to sync FOFB network. --- siriuspy/siriuspy/sofb/orbit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/sofb/orbit.py b/siriuspy/siriuspy/sofb/orbit.py index ca1b79584..636f539c8 100644 --- a/siriuspy/siriuspy/sofb/orbit.py +++ b/siriuspy/siriuspy/sofb/orbit.py @@ -701,7 +701,8 @@ def _synchronize_bpms(self): bpm.monit_sync_enbl = _csbpm.EnbldDsbld.disabled bpm.monit1_sync_enbl = _csbpm.EnbldDsbld.disabled - if self.sofb.fofb.connected: + if self.acc == 'SI' and self.sofb.fofb.connected: + _time.sleep(0.2) self.sofb.fofb.cmd_sync_net() def set_trig_acq_control(self, value): From d20852eed3ca39b05f5f27a15c1b750a40b47610 Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 11:21:58 -0300 Subject: [PATCH 06/14] DEVFOFB.ENH: update HLFOFB device according to new IOC --- siriuspy/siriuspy/devices/fofb.py | 62 +++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/siriuspy/siriuspy/devices/fofb.py b/siriuspy/siriuspy/devices/fofb.py index be0d44274..56134431e 100644 --- a/siriuspy/siriuspy/devices/fofb.py +++ b/siriuspy/siriuspy/devices/fofb.py @@ -830,10 +830,13 @@ class DEVICES: _properties = ( 'LoopState-Sel', 'LoopState-Sts', - 'LoopGain-SP', 'LoopGain-RB', 'LoopGain-Mon', - 'CorrStatus-Mon', 'CorrConfig-Cmd', + 'LoopGainH-SP', 'LoopGainH-RB', 'LoopGainH-Mon', + 'LoopGainV-SP', 'LoopGainV-RB', 'LoopGainV-Mon', + 'CorrStatus-Mon', 'CorrConfig-Cmd', 'CorrSetCurrZero-Cmd', 'CorrSetOpModeManual-Cmd', 'CorrSetAccFreezeDsbl-Cmd', 'CorrSetAccFreezeEnbl-Cmd', 'CorrSetAccClear-Cmd', + 'CHAccSatMax-SP', 'CHAccSatMax-RB', + 'CVAccSatMax-SP', 'CVAccSatMax-RB', 'FOFBCtrlStatus-Mon', 'FOFBCtrlSyncNet-Cmd', 'FOFBCtrlSyncRefOrb-Cmd', 'FOFBCtrlConfTFrameLen-Cmd', 'FOFBCtrlConfBPMLogTrg-Cmd', 'KickBufferSize-SP', 'KickBufferSize-RB', 'KickCH-Mon', 'KickCV-Mon', @@ -888,18 +891,32 @@ def loop_state(self, value): self['LoopState-Sel'] = value @property - def loop_gain(self): - """Loop gain.""" - return self['LoopGain-RB'] + def loop_gain_h(self): + """Loop gain H.""" + return self['LoopGainH-RB'] - @loop_gain.setter - def loop_gain(self, value): - self['LoopGain-SP'] = value + @loop_gain_h.setter + def loop_gain_h(self, value): + self['LoopGainH-SP'] = value @property - def loop_gain_mon(self): - """Implemented loop gain.""" - return self['LoopGain-Mon'] + def loop_gain_h_mon(self): + """Implemented horizotal loop gain.""" + return self['LoopGainH-Mon'] + + @property + def loop_gain_v(self): + """Loop gain V.""" + return self['LoopGainV-RB'] + + @loop_gain_v.setter + def loop_gain_v(self, value): + self['LoopGainV-SP'] = value + + @property + def loop_gain_v_mon(self): + """Implemented vertical loop gain.""" + return self['LoopGainV-Mon'] @property def corr_status(self): @@ -931,6 +948,29 @@ def cmd_corr_accclear(self): self['CorrSetAccClear-Cmd'] = 1 return True + def cmd_corr_set_current_zero(self): + """Command to set correctors current to zero.""" + self['CorrSetCurrZero-Cmd'] = 1 + return True + + @property + def ch_accsatmax(self): + """CH accumulator maximum saturation limit.""" + return self['CHAccSatMax-RB'] + + @ch_accsatmax.setter + def ch_accsatmax(self, value): + self['CHAccSatMax-SP'] = value + + @property + def cv_accsatmax(self): + """CH accumulator maximum saturation limit.""" + return self['CVAccSatMax-RB'] + + @cv_accsatmax.setter + def cv_accsatmax(self, value): + self['CVAccSatMax-SP'] = value + @property def fofbctrl_status(self): """FOFB controller status.""" From bb3bfb96fc9d3c135f9ff1620215c83e827ada1c Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 11:51:48 -0300 Subject: [PATCH 07/14] fofb.FIX: fix linkpartners verification --- siriuspy/siriuspy/devices/fofb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/devices/fofb.py b/siriuspy/siriuspy/devices/fofb.py index 56134431e..bda0f884c 100644 --- a/siriuspy/siriuspy/devices/fofb.py +++ b/siriuspy/siriuspy/devices/fofb.py @@ -375,7 +375,8 @@ def linkpartners_connected(self): if 'FMC' not in dev.dccname: continue ctl = _PVName(dcc).device_name - if not dev.linkpartners & self._ctl_part[ctl]: + nrpart = len(self._ctl_part[ctl]) + if not len(dev.linkpartners & self._ctl_part[ctl]) == nrpart: return False return True From e8f0beab0d097852bee505dc6f888d2eae4cc374 Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 12:28:50 -0300 Subject: [PATCH 08/14] SOFB.FIX: fix FOFB sync net method call --- siriuspy/siriuspy/sofb/orbit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/sofb/orbit.py b/siriuspy/siriuspy/sofb/orbit.py index 636f539c8..f4444a0cd 100644 --- a/siriuspy/siriuspy/sofb/orbit.py +++ b/siriuspy/siriuspy/sofb/orbit.py @@ -703,7 +703,7 @@ def _synchronize_bpms(self): if self.acc == 'SI' and self.sofb.fofb.connected: _time.sleep(0.2) - self.sofb.fofb.cmd_sync_net() + self.sofb.fofb.cmd_fofbctrl_syncnet() def set_trig_acq_control(self, value): """.""" From 23ffba3de92283df6b691504d7d9e5bc5c0b19a3 Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 14:55:35 -0300 Subject: [PATCH 09/14] DEVPUMD.FIX: fix bug in delta PosAng check --- siriuspy/siriuspy/devices/injsys.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/devices/injsys.py b/siriuspy/siriuspy/devices/injsys.py index c875eeab5..088e6b798 100644 --- a/siriuspy/siriuspy/devices/injsys.py +++ b/siriuspy/siriuspy/devices/injsys.py @@ -967,8 +967,9 @@ def _do_delta_posang(self, delta): if self.posang.need_ref_update: self.posang.cmd_update_reference() _time.sleep(InjSysPUModeHandler._DEF_SLEEP) + desval = self.posang.delta_angx + delta self.posang.delta_angx += delta - if not self._wait(self.posang, 'delta_angx', delta): + if not self._wait(self.posang, 'delta_angx', desval): self._update_status('ERR:Could not do delta AngX.') return False return True From e731f9b9248b4d042d5a9952bacc3aba919fc2fd Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 14:59:12 -0300 Subject: [PATCH 10/14] MNT: fix typo --- siriuspy/siriuspy/devices/fofb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/devices/fofb.py b/siriuspy/siriuspy/devices/fofb.py index bda0f884c..f70681bd4 100644 --- a/siriuspy/siriuspy/devices/fofb.py +++ b/siriuspy/siriuspy/devices/fofb.py @@ -902,7 +902,7 @@ def loop_gain_h(self, value): @property def loop_gain_h_mon(self): - """Implemented horizotal loop gain.""" + """Implemented horizontal loop gain.""" return self['LoopGainH-Mon'] @property From 1b90ee94ae02368937e7ac06fd16b5b92dc07bbc Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 15:14:12 -0300 Subject: [PATCH 11/14] DEVPS.FIX: return copy of array in cycle_aux_param property --- siriuspy/siriuspy/devices/pwrsupply.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/siriuspy/siriuspy/devices/pwrsupply.py b/siriuspy/siriuspy/devices/pwrsupply.py index 36cc7b57d..699b9d28d 100644 --- a/siriuspy/siriuspy/devices/pwrsupply.py +++ b/siriuspy/siriuspy/devices/pwrsupply.py @@ -368,11 +368,13 @@ def cycle_aux_param(self): - AuxParams[2] --> rampdown time [s] - AuxParams[3] --> not used """ - return self['CycleAuxParam-RB'] + value = self['CycleAuxParam-RB'] + if value is not None: + return value.copy() + return None @cycle_aux_param.setter def cycle_aux_param(self, value): - """.""" self['CycleAuxParam-SP'] = value @property From 51bf44b56814d24fd76aa1edbb55614523114750 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 17:42:42 -0300 Subject: [PATCH 12/14] FOFB.ENH: Create KickBufferSize-Mon to indicate the actual value used in averages. --- siriuspy/siriuspy/devices/fofb.py | 8 +++++++- siriuspy/siriuspy/fofb/csdev.py | 4 ++++ siriuspy/siriuspy/fofb/main.py | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/siriuspy/siriuspy/devices/fofb.py b/siriuspy/siriuspy/devices/fofb.py index f70681bd4..9b269fb2e 100644 --- a/siriuspy/siriuspy/devices/fofb.py +++ b/siriuspy/siriuspy/devices/fofb.py @@ -840,7 +840,8 @@ class DEVICES: 'CVAccSatMax-SP', 'CVAccSatMax-RB', 'FOFBCtrlStatus-Mon', 'FOFBCtrlSyncNet-Cmd', 'FOFBCtrlSyncRefOrb-Cmd', 'FOFBCtrlConfTFrameLen-Cmd', 'FOFBCtrlConfBPMLogTrg-Cmd', - 'KickBufferSize-SP', 'KickBufferSize-RB', 'KickCH-Mon', 'KickCV-Mon', + 'KickBufferSize-SP', 'KickBufferSize-RB', 'KickBufferSize-Mon', + 'KickCH-Mon', 'KickCV-Mon', 'RefOrbX-SP', 'RefOrbX-RB', 'RefOrbY-SP', 'RefOrbY-RB', 'RefOrbHwX-Mon', 'RefOrbHwY-Mon', 'BPMXEnblList-SP', 'BPMXEnblList-RB', @@ -997,6 +998,11 @@ def cmd_fofbctrl_conf_bpmlogtrig(self): self['FOFBCtrlConfBPMLogTrg-Cmd'] = 1 return True + @property + def kick_buffer_size_mon(self): + """Return actual kicks buffer size.""" + return self['KickBufferSize-Mon'] + @property def kick_buffer_size(self): """Return kicks buffer size.""" diff --git a/siriuspy/siriuspy/fofb/csdev.py b/siriuspy/siriuspy/fofb/csdev.py index 012e39bd2..5c6198e1c 100644 --- a/siriuspy/siriuspy/fofb/csdev.py +++ b/siriuspy/siriuspy/fofb/csdev.py @@ -195,6 +195,10 @@ def get_hlfofb_database(self): 'type': 'float', 'value': self.DEF_KICK_BUFFER_SIZE, 'prec': 0, 'lolim': 1, 'hilim': 1000, 'unit': 'Size of the buffer to calculate kicks average.'}, + 'KickBufferSize-Mon': { + 'type': 'float', 'value': self.DEF_KICK_BUFFER_SIZE, 'prec': 0, + 'lolim': 1, 'hilim': 1000, + 'unit': 'Actual buffer size used to calculate kicks average.'}, 'KickCH-Mon': { 'type': 'float', 'unit': 'urad', 'count': self.nr_ch, 'value': self.nr_ch*[0]}, diff --git a/siriuspy/siriuspy/fofb/main.py b/siriuspy/siriuspy/fofb/main.py index db1fb3035..39429f488 100644 --- a/siriuspy/siriuspy/fofb/main.py +++ b/siriuspy/siriuspy/fofb/main.py @@ -204,6 +204,7 @@ def init_database(self): 'FOFBCtrlConfBPMLogTrg-Cmd', self._fofbctrl_confbpmlogtrg_count) self.run_callbacks('KickBufferSize-SP', self._kick_buffer_size) self.run_callbacks('KickBufferSize-RB', self._kick_buffer_size) + self.run_callbacks('KickBufferSize-Mon', self._kick_buffer_size) self.run_callbacks( 'KickCH-Mon', _np.zeros(self._const.nr_ch, dtype=float)) self.run_callbacks( @@ -667,23 +668,28 @@ def _update_kick_buffer(self, pvname, value, ps_index, **kwargs): if val is None: return self._kick_buffer[ps_index].append(val) - del self._kick_buffer[ps_index][:-self._kick_buffer_size] + buff_size = self._kick_buffer_size if self._loop_state else 1 + del self._kick_buffer[ps_index][:-buff_size] def _update_kicks(self): kickch, kickcv = [], [] + lenb = 0 for i in range(self._const.nr_ch): buff = self._kick_buffer[i] + lenb = max(len(buff), lenb) val = _np.mean(buff) if buff else 0.0 kickch.append(val) for i in range(self._const.nr_ch, self._const.nr_chcv): buff = self._kick_buffer[i] + lenb = max(len(buff), lenb) val = _np.mean(buff) if buff else 0.0 kickcv.append(val) self.run_callbacks('KickCH-Mon', kickch) self.run_callbacks('KickCV-Mon', kickcv) + self.run_callbacks('KickBufferSize-Mon') # --- reference orbit --- From 25862b2c32508be75fc08b0f4895cbc21e01d670 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 17 Oct 2022 17:44:39 -0300 Subject: [PATCH 13/14] FOFB.BUG: update the value of KickBufferSize-Mon. --- siriuspy/siriuspy/fofb/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siriuspy/siriuspy/fofb/main.py b/siriuspy/siriuspy/fofb/main.py index 39429f488..675873513 100644 --- a/siriuspy/siriuspy/fofb/main.py +++ b/siriuspy/siriuspy/fofb/main.py @@ -689,7 +689,7 @@ def _update_kicks(self): self.run_callbacks('KickCH-Mon', kickch) self.run_callbacks('KickCV-Mon', kickcv) - self.run_callbacks('KickBufferSize-Mon') + self.run_callbacks('KickBufferSize-Mon', lenb) # --- reference orbit --- From db86048ecd88700f17dd1659303e8b55c3cfd5fe Mon Sep 17 00:00:00 2001 From: Ana Clara Oliveira Date: Mon, 17 Oct 2022 18:15:47 -0300 Subject: [PATCH 14/14] FOFB.FIX: avoid setpoints to low level devices when they are disconnected --- siriuspy/siriuspy/fofb/main.py | 42 ++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/siriuspy/siriuspy/fofb/main.py b/siriuspy/siriuspy/fofb/main.py index db1fb3035..8249f5b2e 100644 --- a/siriuspy/siriuspy/fofb/main.py +++ b/siriuspy/siriuspy/fofb/main.py @@ -461,6 +461,8 @@ def set_loopgain(self, plane, value): def cmd_corr_configure(self, _): """Configure corrector command.""" self._update_log('Received configure corrector command...') + if not self._check_corr_connection(): + return False # opmode self._check_set_corrs_opmode() @@ -478,6 +480,8 @@ def cmd_corr_configure(self, _): def cmd_corr_opmode_manual(self, _): """Set all corrector opmode.""" self._update_log('Received set corrector opmode to manual...') + if not self._check_corr_connection(): + return False self._update_log('Setting all corrector opmode to manual...') self._corrs_dev.set_opmode(self._corrs_dev.OPMODE_STS.manual) @@ -491,6 +495,8 @@ def cmd_corr_opmode_manual(self, _): def cmd_corr_accfreeze_dsbl(self, _): """Set all corrector accumulator freeze state to Dsbl.""" self._update_log('Received set corrector AccFreeze to Dsbl...') + if not self._check_corr_connection(): + return False self._update_log('Setting AccFreeze to Dsbl...') self._corrs_dev.set_fofbacc_freeze(self._const.DsblEnbl.Dsbl) @@ -504,6 +510,8 @@ def cmd_corr_accfreeze_dsbl(self, _): def cmd_corr_accfreeze_enbl(self, _): """Set all corrector accumulator freeze state to Enbl.""" self._update_log('Received set corrector AccFreeze to Enbl...') + if not self._check_corr_connection(): + return False self._update_log('Setting AccFreeze to Enbl...') self._corrs_dev.set_fofbacc_freeze(self._const.DsblEnbl.Enbl) @@ -517,6 +525,8 @@ def cmd_corr_accfreeze_enbl(self, _): def cmd_corr_accclear(self, _): """Clear all corrector accumulator.""" self._update_log('Received clear all corrector accumulator...') + if not self._check_corr_connection(): + return False self._update_log('Sending clear accumulator command...') self._corrs_dev.cmd_fofbacc_clear() @@ -530,6 +540,8 @@ def cmd_corr_accclear(self, _): def cmd_corr_currzero(self, _): """Set all corrector current to zero.""" self._update_log('Received set corrector current to zero...') + if not self._check_corr_connection(): + return False self._update_log('Sending all corrector current to zero...') self._corrs_dev.set_current(0) @@ -542,6 +554,8 @@ def cmd_corr_currzero(self, _): def set_corr_accsatmax(self, device, value): """Set device FOFB accumulator saturation limits.""" + if not self._check_corr_connection(): + return False if not 0 <= value <= 0.95: return False @@ -559,6 +573,8 @@ def set_corr_accsatmax(self, device, value): def set_timeframelen(self, value): """Set FOFB controllers TimeFrameLen.""" + if not self._check_fofbctrl_connection(): + return False if not 3000 <= value <= 7500: return False @@ -574,6 +590,8 @@ def set_timeframelen(self, value): def cmd_fofbctrl_syncnet(self, _): """Sync FOFB net command.""" self._update_log('Received sync FOFB net command...') + if not self._check_fofbctrl_connection(): + return False self._update_log('Checking...') if not self._llfofb_dev.net_synced: self._update_log('Syncing FOFB net...') @@ -592,6 +610,8 @@ def cmd_fofbctrl_syncnet(self, _): def cmd_fofbctrl_syncreforb(self, _): """Sync FOFB RefOrb command.""" self._update_log('Received sync FOFB RefOrb command...') + if not self._check_fofbctrl_connection(): + return False self._update_log('Checking...') reforb = _np.hstack([self._reforbhw_x, self._reforbhw_y]) if not self._llfofb_dev.check_reforb(reforb): @@ -609,6 +629,8 @@ def cmd_fofbctrl_syncreforb(self, _): def cmd_fofbctrl_conftframelen(self, _): """Configure FOFB controllers TimeFrameLen command.""" self._update_log('Received configure FOFB controllers') + if not self._check_fofbctrl_connection(): + return False self._update_log('TimeFrameLen command... Checking...') timeframe = self._time_frame_len if not _np.all(self._llfofb_dev.time_frame_len == timeframe): @@ -628,6 +650,8 @@ def cmd_fofbctrl_conftframelen(self, _): def cmd_fofbctrl_confbpmlogtrg(self, _): """Configure BPM logical triggers command.""" self._update_log('Received configure BPM Logical') + if not self._check_fofbctrl_connection(): + return False self._update_log('triggers command... Checking...') if not self._llfofb_dev.bpm_trigs_configured: self._update_log('Configuring BPM logical triggers...') @@ -843,8 +867,7 @@ def set_invrespmat_normmode(self, value): def _calc_matrices(self): self._update_log('Calculating Inverse Matrix...') - if not self._corrs_dev.connected: - self._update_log('ERR:Correctors not connected... aborted.') + if not self._check_corr_connection(): return False selbpm = self.bpm_enbllist @@ -1125,6 +1148,19 @@ def _callback_havebeam(self, value, **kws): # --- auxiliary corrector and fofbcontroller methods --- + def _check_corr_connection(self): + if self._corrs_dev.connected: + return True + self._update_log('ERR:Correctors not connected... aborted.') + return False + + def _check_fofbctrl_connection(self): + if self._llfofb_dev.connected: + return True + self._update_log('ERR:FOFB Controllers not connected...') + self._update_log('ERR:aborted.') + return False + def _check_set_corrs_opmode(self): """Check and configure opmode. @@ -1222,6 +1258,8 @@ def _set_corrs_coeffs(self, log=True): """Set corrector coefficients and gains.""" if log: self._update_log('Setting corrector gains and coefficients...') + if not self._check_corr_connection(): + return False self._corrs_dev.set_invrespmat_row(self._pscoeffs) self._corrs_dev.set_fofbacc_gain(self._psgains) if log: