Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in OrbIntlk IOC #1080

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion siriuspy/siriuspy/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.87.0
2.87.1
31 changes: 17 additions & 14 deletions siriuspy/siriuspy/orbintlk/csdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ class Const(_csdev.Const):
('Src-Sel', 0),
('State-Sel', 1),
('Polarity-Sel', 0),
('Log-Sel', 0))),
('Log-Sel', 1))),
('SI-14C4:TI-DCCT-PsMtm', (
('Src-Sel', 0),
('State-Sel', 1),
('Polarity-Sel', 0),
('Log-Sel', 0))),
('Log-Sel', 1))),
]
FOUTSFIXED_RXENBL = {
'CA-RaTim:TI-Fout-2': 0b01000001,
Expand Down Expand Up @@ -139,23 +139,25 @@ def EVG_CONFIGS(cls):
if cls.__EVG_CONFIGS is not None:
return cls.__EVG_CONFIGS

hltg_enbl = [
'SI-Fam:TI-BPM-OrbIntlk',
'SI-Fam:TI-OrbIntlkRedundancy',
]
lltg_enbl = []
for hltg in hltg_enbl:
lltg_enbl.extend(_HLTimeSearch.get_ll_trigger_names(hltg))
lltg_enbl = set(lltg_enbl)

fouts = set()
evgchans = set()
evgrxenbl = list()
for ch in _LLTimeSearch.get_connections_twds_evg():
if ch.dev != 'BPM':
continue
if ch.sec != 'SI':
continue
if ch.dev == 'BPM' and ch.sub.endswith(('SA', 'SB', 'SP')):
continue
fch = _LLTimeSearch.get_fout_channel(ch)
evgrxenbl = set()
for lltg in lltg_enbl:
fch = _LLTimeSearch.get_fout_channel(lltg)
fouts.add(fch.device_name)
evgch = _LLTimeSearch.get_evg_channel(fch)
if evgch in evgchans:
continue
evgchans.add(evgch)
evgrxenbl.append(int(evgch.propty[3:]))
evgrxenbl.add(int(evgch.propty[3:]))
evgrxenbl = sorted(evgrxenbl)

hlevts = _HLTimeSearch.get_hl_events()
evtin0 = int(hlevts['Intlk'].strip('Evt'))
Expand Down Expand Up @@ -213,6 +215,7 @@ def __init__(self):
if NR_BPM != len(self.bpm_names):
raise ValueError('Inconsistent NR_BPM parameter!')
self.bpm_nicknames = _BPMSearch.get_nicknames(self.bpm_names)
self.bpm_idcs = {b: idx for idx, b in enumerate(self.bpm_names)}

# bpm position along the ring
self.bpm_pos = _BPMSearch.get_positions(self.bpm_names)
Expand Down
18 changes: 15 additions & 3 deletions siriuspy/siriuspy/orbintlk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ def __init__(self, tests=False):
pvo.add_callback(self._callback_evg_rxlock)

# # Fouts
foutnames = list(self._const.FOUTS_2_MON) + \
list(self._const.FOUTSFIXED_RXENBL.keys())
foutnames = list(
self._const.FOUTS_2_MON |
self._const.FOUTSFIXED_RXENBL.keys()
)
self._thread_cbfout = {fout: None for fout in foutnames}
self._fout_devs = {
devname: _Device(
Expand Down Expand Up @@ -1358,13 +1360,23 @@ def _callback_bpm_intlk(self, pvname, value, **kws):
if not value:
return
# launch thread to log interlock details
bpmname = _PVName(pvname).device_name
_CAThread(
target=self._log_bpm_intlk,
args=(_PVName(pvname).device_name, ),
args=(bpmname, ),
daemon=True).start()
# launch thread to send interlock to RF as a backup
if self._thread_cbbpm and self._thread_cbbpm.is_alive():
return

# NOTE: the next lines help to avoid killing beam in case one BPM that
# is not enabled raises a false positive interlock signal.
idx = self._const.bpm_idcs[bpmname]
enbl = self._enable_lists['pos'][idx] or self._enable_lists['ang'][idx]
if not enbl:
self._update_log(f'WARN:{bpmname} false positive')
return

self._thread_cbbpm = _CAThread(
target=self._do_callback_bpm_intlk, daemon=True)
self._thread_cbbpm.start()
Expand Down
Loading