Skip to content

Commit

Permalink
Merge pull request #1096 from lnls-sirius/bpm_iocs_updates
Browse files Browse the repository at this point in the history
Update package according to new BPM IOC
  • Loading branch information
anacso17 authored Aug 26, 2024
2 parents c4cc95b + 61003ee commit 69118a5
Show file tree
Hide file tree
Showing 18 changed files with 237 additions and 689 deletions.
23 changes: 8 additions & 15 deletions siriuspy/siriuspy/clientconfigdb/types/as_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,9 @@ def get_dict():
'SI-01M1:DI-BPM',
]
_bpm_propts = [
[':INFOClkProp-Sel', 0, 0.0],
[':ADCSi57xOe-Sel', 1, 0.0],
[':ADCClkSel-Sel', 1, 0.0],
[':INFOADCRate-SP', 1, 0.0],
[':ADCAD9510PllFunc-SP', 1, 0.0],
[':ADCAD9510Outputs-SP', 31, 0.0],
[':ADCAD9510ClkSel-Sel', 1, 0.0],
[':ADCAD9510CpCurrent-Sel', 7, 0.0],
[':ADCTrigDir-Sel', 0, 0.0],
[':ADCTrigTerm-Sel', 0, 0.0],
[':RFFEPidSpAC-SP', 45.0, 0.0],
Expand All @@ -413,11 +408,10 @@ def get_dict():
[':RFFEPidBDTd-SP', 2.0, 0.0],
[':RFFEHeaterAC-SP', 0.0, 0.0],
[':RFFEHeaterBD-SP', 0.0, 0.0],
[':ADC0RstModes-Sel', 1, 0.0],
[':ADC1RstModes-Sel', 1, 0.0],
[':ADC2RstModes-Sel', 1, 0.0],
[':ADC3RstModes-Sel', 1, 0.0],
[':ACQBPMMode-Sel', 1, 0.0],
# [':ADC0RstModes-Sel', 1, 0.0],
# [':ADC1RstModes-Sel', 1, 0.0],
# [':ADC2RstModes-Sel', 1, 0.0],
# [':ADC3RstModes-Sel', 1, 0.0],
[':TbTPhaseSyncDly-SP', 0.0, 0.0],
[':TbTDataMaskEn-Sel', 1, 0.0],
[':TbTDataMaskSamplesBeg-SP', 0.0, 0.0],
Expand All @@ -426,9 +420,9 @@ def get_dict():
[':PosXOffset-SP', 0, 0.0],
[':PosYOffset-SP', 0, 0.0],
[':PosQOffset-SP', 0, 0.0],
[':ACQTriggerHwDly-SP', 0, 0.0],
[':ACQ_PMTriggerHwDly-SP', 0, 0.0],
[':INFOClkFreq-SP', 220910069.0, 0.0],
[':GENTriggerHwDly-SP', 0, 0.0],
[':PMTriggerHwDly-SP', 0, 0.0],
# [':INFOClkFreq-SP', 220910069.0, 0.0],
[':INFOHarmonicNumber-SP', 864, 0.0],
[':INFOTbTRate-SP', 382, 0.0],
[':INFOFOFBRate-SP', 8786, 0.0],
Expand All @@ -439,7 +433,6 @@ def get_dict():
[':PosKq-SP', 21389980, 0.0],
[':ADCAD9510ADiv-SP', 0, 0.0],
[':ADCAD9510BDiv-SP', 382, 0.0],
[':ADCAD9510Prescaler-SP', 0, 0.0],
[':ADCAD9510RDiv-SP', 120, 0.0],
[':ADCSi57xFreq-SP', 220910069.0, 0.0],
[':SwDivClk-SP', 8786, 0.0],
Expand Down Expand Up @@ -470,7 +463,7 @@ def get_dict():
[f':TRIGGER{phy_trig}RcvLen-SP', 0, 0.0],
[f':TRIGGER{phy_trig}TrnLen-SP', 0, 0.0],
])
for acq_core in ['', '_PM']:
for acq_core in ['_GEN', '_PM']:
for log_trig in range(AFC_ACQCORE_NR_LOG_TRIGGER):
_bpm_propts.extend([
[f':TRIGGER{acq_core}{log_trig}RcvInSel-SP', 0, 0.0],
Expand Down
26 changes: 8 additions & 18 deletions siriuspy/siriuspy/devices/afc_acq_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ class AFCPhysicalTrigger(_Device):
'DirPol-Sel', 'DirPol-Sts',
'RcvCnt-Mon',
'RcvLen-SP', 'RcvLen-RB',
'RcvCntRst-Cmd',
'TrnCnt-Mon',
'TrnLen-SP', 'TrnLen-RB',
'TrnCntRst-Cmd',
)

def __init__(self, devname, index, props2init='all'):
"""Init."""
if not 0 <= int(index) <= 7:
raise NotImplementedError(index)

# handle FOFB and BPM IOC differences
# TODO: remove when new BPM IOC is updated.
if props2init == 'all':
props2init = list(AFCPhysicalTrigger.PROPERTIES_DEFAULT)
if SiriusPVName(devname).dev == 'BPM':
props2init += ['RcvCntRst-SP', 'TrnCntRst-SP']
else:
props2init += ['RcvCntRst-Cmd', 'TrnCntRst-Cmd']

super().__init__(devname+':TRIGGER'+str(index), props2init=props2init)

Expand Down Expand Up @@ -58,12 +54,9 @@ def receiver_counter(self):

def cmd_reset_receiver_counter(self):
"""Reset receiver counter."""
# handle FOFB and BPM IOC differences
# TODO: remove when new BPM IOC is updated.
suf = 'SP' if 'BPM' in self.devname else 'Cmd'
self[f'RcvCntRst-{suf}'] = 1
self[f'RcvCntRst-Cmd'] = 1
_time.sleep(1)
self[f'RcvCntRst-{suf}'] = 0
self[f'RcvCntRst-Cmd'] = 0

@property
def receiver_length(self):
Expand All @@ -81,12 +74,9 @@ def transmitter_counter(self):

def cmd_reset_transmitter_counter(self):
"""Reset transmitter counter."""
# handle FOFB and BPM IOC differences
# TODO: remove when new BPM IOC is updated.
suf = 'SP' if 'BPM' in self.devname else 'Cmd'
self[f'TrnCntRst-{suf}'] = 1
self[f'TrnCntRst-Cmd'] = 1
_time.sleep(1)
self[f'TrnCntRst-{suf}'] = 0
self[f'TrnCntRst-Cmd'] = 0

@property
def transmitter_length(self):
Expand All @@ -108,11 +98,11 @@ class AFCACQLogicalTrigger(_Device):
'TrnOutSel-SP', 'TrnOutSel-RB',
)

def __init__(self, devname, index, acqcore='', props2init='all'):
def __init__(self, devname, index, acqcore='GEN', props2init='all'):
"""Init."""
if not 0 <= int(index) <= 23:
raise NotImplementedError(index)
propty_prefix = ':TRIGGER'+('_'+acqcore if acqcore else '')+str(index)
propty_prefix = f':TRIGGER_{acqcore}{str(index)}'
super().__init__(devname + propty_prefix, props2init=props2init)

@property
Expand Down
Loading

0 comments on commit 69118a5

Please sign in to comment.