Skip to content

Commit

Permalink
Merge pull request #1123 from lnls-sirius/update-orbintlk-rf
Browse files Browse the repository at this point in the history
Update orbit interlock IOC
  • Loading branch information
anacso17 authored Nov 1, 2024
2 parents 9375bcc + 8792ad3 commit 6cc1350
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
9 changes: 7 additions & 2 deletions siriuspy/siriuspy/orbintlk/csdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ class ETypes(_csdev.ETypes):
'DCCT13C4PsMtmTrigConfig', 'DCCT14C4PsMtmTrigConn',
'DCCT14C4PsMtmTrigStatusOK', 'DCCT14C4PsMtmTrigConfig',
)
STS_LBLS_LLRF = ('Connected', 'Configured')
STS_LBLS_LLRF = (
'A Connected',
'A Configured',
'B Connected',
'B Configured',
)


_et = ETypes # syntactic sugar
Expand Down Expand Up @@ -265,7 +270,7 @@ def get_database(self):
'value': self.DsblEnbl.Dsbl},
'BPMStatus-Mon': {'type': 'int', 'value': 0b111111111},
'TimingStatus-Mon': {'type': 'int', 'value': (1 << 19) - 1},
'LLRFStatus-Mon': {'type': 'int', 'value': 0b11},
'LLRFStatus-Mon': {'type': 'int', 'value': 0b1111},
'BPMStatusLabels-Cte': {
'type': 'string', 'count': len(_et.STS_LBLS_BPM),
'value': _et.STS_LBLS_BPM},
Expand Down
50 changes: 31 additions & 19 deletions siriuspy/siriuspy/orbintlk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,27 @@ def __init__(self, tests=False):
pvo.connection_callbacks.append(self._conn_callback_timing)

# # RF EVE
trgsrc = _HLTimeSearch.get_ll_trigger_names('SI-Glob:TI-LLRF-PsMtm')
pvname = _LLTimeSearch.get_channel_output_port_pvname(trgsrc[0])
self._llrf_evtcnt_pvname = f'{pvname.propty}EvtCnt-Mon'
self._everf_dev = _Device(
pvname.device_name,
props2init=[self._llrf_evtcnt_pvname, ],
auto_monitor_mon=True)
pvo = self._everf_dev.pv_object(self._llrf_evtcnt_pvname)
pvo.wait_for_connection()
self._everf_evtcnt = pvo.get() or 0
trgsrcs = _HLTimeSearch.get_ll_trigger_names('SI-Glob:TI-LLRF-PsMtm')
pvnames = {
_LLTimeSearch.get_channel_output_port_pvname(src)
for src in trgsrcs
}
self._llrf_evtcnt_pvnames, self._everf_devs = dict(), dict()
for pvn in pvnames:
devn = pvn.device_name
propty = f'{pvn.propty}EvtCnt-Mon'

self._llrf_evtcnt_pvnames[devn] = propty

self._everf_devs[devn] = _Device(
devn, props2init=[propty, ], auto_monitor_mon=True
)

self._everf_evtcnts = dict()
for devn, propty in self._llrf_evtcnt_pvnames.items():
pvo = self._everf_devs[devn].pv_object(propty)
pvo.wait_for_connection()
self._everf_evtcnts[devn] = pvo.get() or 0

# # HL triggers
self._hltrig_devs = dict()
Expand Down Expand Up @@ -1233,16 +1244,16 @@ def _check_configs(self):
self.run_callbacks('TimingStatus-Mon', self._timing_status)

# LLRF Status
value = (1 << 2) - 1
for dev in self._llrfs:
value = (1 << 4) - 1
for i, dev in enumerate(self._llrfs):
if dev.connected:
value = _updt_bit(value, 0, 0)
value = _updt_bit(value, 2*i, 0)
fim_orbit = dev.fast_interlock_monitor_orbit
fim_manual = dev.fast_interlock_monitor_manual
okc = fim_orbit == self._llrf_intlk_state
okc &= fim_manual == self._llrf_intlk_state
value = _updt_bit(value, 1, not okc)
self.run_callbacks('LLRFStatus-Mon', value)
value = _updt_bit(value, 2*i+1, not okc)
self.run_callbacks('LLRFStatus-Mon', value)

# check time elapsed
ttook = _time.time() - _t0
Expand Down Expand Up @@ -1414,10 +1425,11 @@ def _do_callback_bpm_intlk(self):
# wait minimum period for RF EVE event count to be updated
_time.sleep(.1)
# verify if RF EVE counted the event PsMtm
new_evtcnt = self._everf_dev[self._llrf_evtcnt_pvname]
if new_evtcnt == self._everf_evtcnt:
self._update_log('WARN:RF EVE did not count event PsMtm')
self._everf_evtcnt = new_evtcnt
for devn, propty in self._llrf_evtcnt_pvnames.items():
new_evtcnt = self._everf_devs[devn][propty]
if new_evtcnt == self._everf_evtcnts[devn]:
self._update_log('WARN:RF EVE did not count event PsMtm')
self._everf_evtcnts[devn] = new_evtcnt
# wait minimum period for BPM to update interlock PVs
_time.sleep(2)
# verify if EVG propagated the event Intlk
Expand Down

0 comments on commit 6cc1350

Please sign in to comment.