diff --git a/siriuspy/siriuspy/devices/fofb.py b/siriuspy/siriuspy/devices/fofb.py index 6b48973b1..1f524e360 100644 --- a/siriuspy/siriuspy/devices/fofb.py +++ b/siriuspy/siriuspy/devices/fofb.py @@ -273,8 +273,9 @@ class BPMDCC(_DCCDevice): def __init__(self, devname): """Init.""" - if not _BPMSearch.is_valid_devname(devname): - raise NotImplementedError(devname) + # Temporarily remove this check to control new 10SB BPMs + # if not _BPMSearch.is_valid_devname(devname): + # raise NotImplementedError(devname) super().__init__(devname, 'DCCP2P') @@ -320,6 +321,10 @@ def __init__(self): for trig in self.BPM_TRIGS_IDS: trigname = bpm + ':TRIGGER' + str(trig) self._bpm_trgs[trigname] = BPMLogicalTrigger(bpm, trig) + bpm2dsbl = ['SI-10SB:DI-BPM-1', 'SI-10SB:DI-BPM-2'] + self._bpmdcc2dsbl = dict() + for bpm in bpm2dsbl: + self._bpmdcc2dsbl[bpm] = BPMDCC(bpm) # fofb event self._evt_fofb = Event('FOFBS') @@ -594,6 +599,13 @@ def cmd_sync_net(self, bpms=None, timeout=DEF_TIMEOUT): for bpm in bpms: enbdccs.append(self._bpm_dccs[bpm]) + # temporary solution: disable BPM DCCs that are not in FOFB network + dcc2dsbl = list(self._bpmdcc2dsbl.values()) + self._set_devices_propty(dcc2dsbl, 'CCEnable-SP', 0) + if not self._wait_devices_propty( + dcc2dsbl, 'CCEnable-RB', 0, timeout=timeout/2): + return False + self._set_devices_propty(alldccs, 'CCEnable-SP', 0) if not self._wait_devices_propty( alldccs, 'CCEnable-RB', 0, timeout=timeout/2): diff --git a/siriuspy/siriuspy/sofb/correctors.py b/siriuspy/siriuspy/sofb/correctors.py index 1b6520d72..e1eb2515c 100644 --- a/siriuspy/siriuspy/sofb/correctors.py +++ b/siriuspy/siriuspy/sofb/correctors.py @@ -116,6 +116,10 @@ def refvalue(self): class RFCtrl(Corrector): """RF control class.""" + TINY_VAR = 0.01 # [Hz] + LARGE_VAR = 10000 # [Hz] + MAX_DELTA = 200 # [Hz] + def __init__(self, acc): """Init method.""" super().__init__(acc) @@ -139,14 +143,13 @@ def value(self): @value.setter def value(self, freq): """.""" - delta_max = 200 # Hz freq0 = self.value if freq0 is None or freq is None: return delta = abs(freq-freq0) - if delta < 0.1 or delta > 10000: + if delta < self.TINY_VAR or delta > self.LARGE_VAR: return - npoints = int(delta//delta_max) + 2 + npoints = int(delta//self.MAX_DELTA) + 2 freq_span = _np.linspace(freq0, freq, npoints)[1:] for i, freq in enumerate(freq_span, 1): self._sp.put(freq, wait=False) @@ -866,7 +869,13 @@ def _timed_out(self, values, mode='ready'): okg[i] = True continue val = corr.value if mode == 'ready' else corr.refvalue - okg[i] = val is not None and _compare_kicks(values[i], val) + if val is None: + continue + if isinstance(corr, RFCtrl): + okg[i] = _compare_kicks( + values[i], val, atol=RFCtrl.TINY_VAR) + else: + okg[i] = _compare_kicks(values[i], val) if all(okg): return False _time.sleep(self.TINY_INTERVAL)