Skip to content

Commit

Permalink
Merge pull request #851 from lnls-sirius/fix-sofb
Browse files Browse the repository at this point in the history
SOFB.BUG: fix bug when FOFB IOC is not connected.
  • Loading branch information
anacso17 authored Oct 17, 2022
2 parents e81019f + 6eb4ae2 commit 847f66d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
29 changes: 16 additions & 13 deletions siriuspy/siriuspy/sofb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -782,9 +783,11 @@ 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
refx0 = fofb.refx
refy0 = fofb.refy
fofb = self.fofb
refx0 = refy0 = None
if fofb.connected:
refx0 = fofb.refx
refy0 = fofb.refy

wait_orb_error = int(5)
previous_orb_problem = False
Expand Down Expand Up @@ -1006,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]
Expand All @@ -1023,11 +1026,11 @@ 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
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)
Expand Down
3 changes: 3 additions & 0 deletions siriuspy/siriuspy/sofb/orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 847f66d

Please sign in to comment.