From 0cf31c410c37289088381168aafbb9bb6dc771ef Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 10 Oct 2022 18:41:36 -0300 Subject: [PATCH 1/3] SOFB.BUG: fix bug when FOFB IOC is not connected. --- siriuspy/siriuspy/sofb/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index 9f2412280..1335b9448 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -783,8 +783,10 @@ def _do_auto_corr(self): zer = _np.zeros(self._csorb.nr_corrs, dtype=float) self._pid_errs = [zer, zer.copy(), zer.copy()] fofb = self._fofb - refx0 = fofb.refx - refy0 = fofb.refy + refx0 = refy0 = None + if fofb.connected: + refx0 = fofb.refx + refy0 = fofb.refy wait_orb_error = int(5) previous_orb_problem = False From 03b1f2483d548f2cdc25e808be725cc371e584b9 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 10 Oct 2022 18:50:41 -0300 Subject: [PATCH 2/3] SOFB.BUG: Continuation of last commit. --- siriuspy/siriuspy/sofb/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index 1335b9448..f01b28372 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -1027,9 +1027,9 @@ def _interact_with_fofb_in_apply_kicks( self, kicks, dkicks, refx=None, refy=None): fofb = self._fofb - if refx is None or refy is None: - refx = fofb.refx - refy = fofb.refy + # if refx is None or refy is None: + # refx = fofb.refx + # refy = fofb.refy if self._update_fofb_reforb and fofb.loop_state: dorb = self.matrix.estimate_orbit_variation(dkicks) From 6eb4ae2440058586b7b00133cba5e984f98762a4 Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 13 Oct 2022 09:10:12 -0300 Subject: [PATCH 3/3] SOFB.ENH: Synchronize FOFB net when synchronizing BPMs. --- siriuspy/siriuspy/sofb/main.py | 17 +++++++++-------- siriuspy/siriuspy/sofb/orbit.py | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index f01b28372..68b7b6699 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -51,7 +51,7 @@ def __init__( self._max_delta_kick['rf'] = 10 self._meas_respmat_kick['rf'] = 80 if self.acc == 'SI': - self._fofb = HLFOFB() + self.fofb = HLFOFB() self._download_fofb_kicks = False self._update_fofb_reforb = False self._donot_affect_fofb_bpms = False @@ -502,10 +502,11 @@ def _update_status(self): self.run_callbacks('Status-Mon', self._status) # Update PVs related to interaction with FOFB: - download = self._download_fofb_kicks and self._fofb.loop_state - update = self._update_fofb_reforb and self._fofb.loop_state - project = self._project_onto_fofb_nullspace and self._fofb.loop_state - donot = self._donot_affect_fofb_bpms and self._fofb.loop_state + fofb_state = self.fofb.connected and self.fofb.loop_state + download = self._download_fofb_kicks and fofb_state + update = self._update_fofb_reforb and fofb_state + project = self._project_onto_fofb_nullspace and fofb_state + donot = self._donot_affect_fofb_bpms and fofb_state self.run_callbacks('FOFBDownloadKicks-Mon', download) self.run_callbacks('FOFBUpdateRefOrb-Mon', update) self.run_callbacks('FOFBNullSpaceProj-Mon', project) @@ -782,7 +783,7 @@ def _do_auto_corr(self): bpmsfreq = self._csorb.BPMsFreq zer = _np.zeros(self._csorb.nr_corrs, dtype=float) self._pid_errs = [zer, zer.copy(), zer.copy()] - fofb = self._fofb + fofb = self.fofb refx0 = refy0 = None if fofb.connected: refx0 = fofb.refx @@ -1008,7 +1009,7 @@ def _check_valid_orbit(self, orbit): return True def _interact_with_fofb_in_calc_kicks(self, orb): - fofb = self._fofb + fofb = self.fofb if self._donot_affect_fofb_bpms and fofb.loop_state: enbllist = _np.r_[fofb.bpmxenbl, fofb.bpmyenbl] @@ -1025,7 +1026,7 @@ def _interact_with_fofb_in_calc_kicks(self, orb): def _interact_with_fofb_in_apply_kicks( self, kicks, dkicks, refx=None, refy=None): - fofb = self._fofb + fofb = self.fofb # if refx is None or refy is None: # refx = fofb.refx diff --git a/siriuspy/siriuspy/sofb/orbit.py b/siriuspy/siriuspy/sofb/orbit.py index 5ac931f50..ca1b79584 100644 --- a/siriuspy/siriuspy/sofb/orbit.py +++ b/siriuspy/siriuspy/sofb/orbit.py @@ -701,6 +701,9 @@ def _synchronize_bpms(self): bpm.monit_sync_enbl = _csbpm.EnbldDsbld.disabled bpm.monit1_sync_enbl = _csbpm.EnbldDsbld.disabled + if self.sofb.fofb.connected: + self.sofb.fofb.cmd_sync_net() + def set_trig_acq_control(self, value): """.""" acqctrl = self._csorb.TrigAcqCtrl