diff --git a/siriuspy/siriuspy/clientconfigdb/types/as_diagnostics.py b/siriuspy/siriuspy/clientconfigdb/types/as_diagnostics.py index a9fa50b0b..46eaa51c0 100644 --- a/siriuspy/siriuspy/clientconfigdb/types/as_diagnostics.py +++ b/siriuspy/siriuspy/clientconfigdb/types/as_diagnostics.py @@ -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], @@ -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], @@ -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], @@ -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], @@ -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], diff --git a/siriuspy/siriuspy/devices/afc_acq_core.py b/siriuspy/siriuspy/devices/afc_acq_core.py index dcfd3e60f..14c8777a8 100644 --- a/siriuspy/siriuspy/devices/afc_acq_core.py +++ b/siriuspy/siriuspy/devices/afc_acq_core.py @@ -13,8 +13,10 @@ 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'): @@ -22,14 +24,8 @@ def __init__(self, devname, index, props2init='all'): 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) @@ -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): @@ -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): @@ -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 diff --git a/siriuspy/siriuspy/devices/bpm.py b/siriuspy/siriuspy/devices/bpm.py index e460f1a6d..076fb0a88 100644 --- a/siriuspy/siriuspy/devices/bpm.py +++ b/siriuspy/siriuspy/devices/bpm.py @@ -16,46 +16,40 @@ class BPM(_Device): ACQSTATES_NOTOK = { _csbpm.AcqStates.Error, _csbpm.AcqStates.No_Memory, - _csbpm.AcqStates.Too_Few_Samples, - _csbpm.AcqStates.Too_Many_Samples, _csbpm.AcqStates.Acq_Overflow} + _csbpm.AcqStates.Bad_Post_Samples, _csbpm.AcqStates.No_Samples, + _csbpm.AcqStates.Too_Many_Samples, _csbpm.AcqStates.Overflow} ACQSTATES_STARTED = { _csbpm.AcqStates.Waiting, _csbpm.AcqStates.External_Trig, _csbpm.AcqStates.Data_Trig, _csbpm.AcqStates.Software_Trig, _csbpm.AcqStates.Acquiring} - ACQSTATES_FINISHED = {_csbpm.AcqStates.Idle, _csbpm.AcqStates.Aborted} + ACQSTATES_FINISHED = {_csbpm.AcqStates.Idle} ACQSTATES_FINISHED |= ACQSTATES_NOTOK PROPERTIES_ACQ = ( 'INFOClkFreq-RB', 'INFOHarmonicNumber-RB', 'INFOTbTRate-RB', 'INFOFOFBRate-RB', 'INFOMONITRate-RB', 'INFOFAcqRate-RB', - 'GEN_AArrayData', 'GEN_BArrayData', 'GEN_CArrayData', 'GEN_DArrayData', - 'GEN_XArrayData', 'GEN_YArrayData', 'GEN_SUMArrayData', - 'GEN_QArrayData', - 'ACQBPMMode-Sel', 'ACQBPMMode-Sts', - 'ACQChannel-Sel', 'ACQChannel-Sts', - 'ACQShots-SP', 'ACQShots-RB', - 'ACQUpdateTime-SP', 'ACQUpdateTime-RB', - 'ACQSamplesPre-SP', 'ACQSamplesPre-RB', - 'ACQSamplesPost-SP', 'ACQSamplesPost-RB', - 'ACQTriggerEvent-Sel', 'ACQTriggerEvent-Sts', - 'ACQStatus-Sts', 'ACQCount-Mon', - 'ACQTrigger-Sel', 'ACQTrigger-Sts', - 'ACQTriggerRep-Sel', 'ACQTriggerRep-Sts', - 'ACQDataTrigChan-Sel', 'ACQDataTrigChan-Sts', - 'ACQTriggerDataSel-SP', 'ACQTriggerDataSel-RB', - 'ACQTriggerDataThres-SP', 'ACQTriggerDataThres-RB', - 'ACQTriggerDataPol-Sel', 'ACQTriggerDataPol-Sts', - 'ACQTriggerDataHyst-SP', 'ACQTriggerDataHyst-RB', + 'GENAmplAData', 'GENAmplBData', 'GENAmplCData', 'GENAmplDData', + 'GENPosXData', 'GENPosYData', 'GENSumData', + 'GENPosQData', + 'GENChannel-Sel', 'GENChannel-Sts', + 'GENShots-SP', 'GENShots-RB', + 'GENUpdateTime-SP', 'GENUpdateTime-RB', + 'GENSamplesPre-SP', 'GENSamplesPre-RB', + 'GENSamplesPost-SP', 'GENSamplesPost-RB', + 'GENTriggerEvent-Cmd', + 'GENStatus-Mon', 'GENCount-Mon', + 'GENTrigger-Sel', 'GENTrigger-Sts', + 'GENTriggerRep-Sel', 'GENTriggerRep-Sts', + 'GENDataTrigChan-Sel', 'GENDataTrigChan-Sts', + 'GENTriggerDataSel-SP', 'GENTriggerDataSel-RB', + 'GENTriggerDataThres-SP', 'GENTriggerDataThres-RB', + 'GENTriggerDataPol-Sel', 'GENTriggerDataPol-Sts', + 'GENTriggerDataHyst-SP', 'GENTriggerDataHyst-RB', ) PROPERTIES_DEFAULT = PROPERTIES_ACQ + ( - 'asyn.ENBL', 'asyn.CNCT', 'SwMode-Sel', 'SwMode-Sts', + 'SwMode-Sel', 'SwMode-Sts', 'RFFEAtt-SP', 'RFFEAtt-RB', - 'SP_AArrayData', 'SP_BArrayData', 'SP_CArrayData', 'SP_DArrayData', - 'GEN_RawXArrayData', 'GEN_RawYArrayData', 'GEN_RawSUMArrayData', - 'GEN_RawQArrayData', - 'SPPosX-Mon', 'SPPosY-Mon', 'SPSum-Mon', 'SPPosQ-Mon', - 'SPAmplA-Mon', 'SPAmplB-Mon', 'SPAmplC-Mon', 'SPAmplD-Mon', 'PosX-Mon', 'PosY-Mon', 'Sum-Mon', 'PosQ-Mon', 'AmplA-Mon', 'AmplB-Mon', 'AmplC-Mon', 'AmplD-Mon', 'GEN_PolyXArrayCoeff-SP', 'GEN_PolyXArrayCoeff-RB', @@ -72,7 +66,6 @@ class BPM(_Device): 'PosKq-SP', 'PosKq-RB', 'PosXOffset-SP', 'PosXOffset-RB', 'PosYOffset-SP', 'PosYOffset-RB', - 'PosSumOffset-SP', 'PosSumOffset-RB', 'PosQOffset-SP', 'PosQOffset-RB', 'FOFBPhaseSyncEn-Sel', 'FOFBPhaseSyncEn-Sts', 'SwDivClk-RB', 'TbTPhaseSyncEn-Sel', 'TbTPhaseSyncEn-Sts', @@ -82,7 +75,7 @@ class BPM(_Device): 'TbTDataMaskSamplesBeg-SP', 'TbTDataMaskSamplesBeg-RB', 'TbTDataMaskSamplesEnd-SP', 'TbTDataMaskSamplesEnd-RB', 'XYPosCal-Sel', 'XYPosCal-Sts', - 'SUMPosCal-Sel', 'SUMPosCal-Sts', + 'SumPosCal-Sel', 'SumPosCal-Sts', 'QPosCal-Sel', 'QPosCal-Sts', ) @@ -109,15 +102,10 @@ def __init__( def __str__(self): """.""" stg = '################### Summary Status ###################\n' - stg += 'asyn:\n' - stg += f' Enabled: {_csbpm.EnblTyp._fields[self.asyn_state]:s}\n' - stg += ' Connected: ' stg += ' Switching Mode: ' stg += f'{_csbpm.SwModes._fields[self.switching_mode]:s}\n' - stg += f'{_csbpm.ConnTyp._fields[self.asyn_connected]:s}\n' stg += '\nAcquisition Parameters:\n' stg += f' - Status: {_csbpm.AcqStates._fields[self.acq_status]:s}\n' - stg += f' - Mode: {_csbpm.OpModes._fields[self.acq_mode]:s}\n' stg += f' - Channel: {_csbpm.AcqChan._fields[self.acq_channel]:s}\n' stg += f' - Nr Shots: {self.acq_nrshots:d}\n' stg += f' - Update Time: {self.acq_update_time:.1f} ms\n' @@ -140,8 +128,6 @@ def __str__(self): def is_ok(self): """.""" okay = self.acq_status not in self.ACQSTATES_NOTOK - okay &= self.asyn_connected == _csbpm.ConnTyp.Connected - okay &= self.asyn_state == _csbpm.EnblTyp.Enable return okay @property @@ -157,22 +143,6 @@ def rffe_att(self, val): if 'RFFEAtt-SP' in self._pvs: self['RFFEAtt-SP'] = val - @property - def asyn_state(self): - """.""" - return self['asyn.ENBL'] - - @asyn_state.setter - def asyn_state(self, boo): - """.""" - val = _csbpm.EnblTyp.Enable if boo else _csbpm.EnblTyp.Disable - self['asyn.ENBL'] = val - - @property - def asyn_connected(self): - """.""" - return self['asyn.CNCT'] - @property def switching_mode(self): """.""" @@ -450,15 +420,6 @@ def posy_offset(self): def posy_offset(self, value): self['PosYOffset-SP'] = float(value) / self.CONV_NM2UM - @property - def possum_offset(self): - """.""" - return self['PosSumOffset-RB'] - - @possum_offset.setter - def possum_offset(self, value): - self['PosSumOffset-SP'] = float(value) - @property def posq_offset(self): """.""" @@ -511,42 +472,42 @@ def ampld(self): @property def mt_posx(self): """.""" - return self['GEN_XArrayData'] * self.CONV_NM2UM + return self['GENPosXData'] * self.CONV_NM2UM @property def mt_posy(self): """.""" - return self['GEN_YArrayData'] * self.CONV_NM2UM + return self['GENPosYData'] * self.CONV_NM2UM @property def mt_possum(self): """.""" - return self['GEN_SUMArrayData'] + return self['GENSumData'] @property def mt_posq(self): """.""" - return self['GEN_QArrayData'] + return self['GENPosQData'] @property def mt_ampla(self): """.""" - return self['GEN_AArrayData'] + return self['GENAmplAData'] @property def mt_amplb(self): """.""" - return self['GEN_BArrayData'] + return self['GENAmplBData'] @property def mt_amplc(self): """.""" - return self['GEN_CArrayData'] + return self['GENAmplCData'] @property def mt_ampld(self): """.""" - return self['GEN_DArrayData'] + return self['GENAmplDData'] @property def mt_polyx(self): @@ -601,12 +562,12 @@ def mt_polyxy_enbl(self, val): @property def mt_polysum_enbl(self): """.""" - return self['SUMPosCal-Sts'] + return self['SumPosCal-Sts'] @mt_polysum_enbl.setter def mt_polysum_enbl(self, val): """.""" - self['SUMPosCal-Sel'] = val + self['SumPosCal-Sel'] = val @property def mt_polyq_enbl(self): @@ -618,125 +579,35 @@ def mt_polyq_enbl(self, val): """.""" self['QPosCal-Sel'] = val - @property - def mtraw_posx(self): - """Multi turn raw X array data.""" - return self['GEN_RawXArrayData'] * self.CONV_NM2UM - - @property - def mtraw_posy(self): - """Multi turn raw Y array data.""" - return self['GEN_RawYArrayData'] * self.CONV_NM2UM - - @property - def mtraw_possum(self): - """Multi turn raw sum array data.""" - return self['GEN_RawSUMArrayData'] - - @property - def mtraw_posq(self): - """Multi turn raw Q array data.""" - return self['GEN_RawQArrayData'] - - @property - def sp_posx(self): - """.""" - return self['SPPosX-Mon'] * self.CONV_NM2UM - - @property - def sp_posy(self): - """.""" - return self['SPPosY-Mon'] * self.CONV_NM2UM - - @property - def sp_possum(self): - """.""" - return self['SPSum-Mon'] - - @property - def sp_posq(self): - """.""" - return self['SPPosQ-Mon'] - - @property - def sp_ampla(self): - """.""" - return self['SPAmplA-Mon'] - - @property - def sp_amplb(self): - """.""" - return self['SPAmplB-Mon'] - - @property - def sp_amplc(self): - """.""" - return self['SPAmplC-Mon'] - - @property - def sp_ampld(self): - """.""" - return self['SPAmplD-Mon'] - - @property - def sp_arraya(self): - """.""" - return self['SP_AArrayData'] - - @property - def sp_arrayb(self): - """.""" - return self['SP_BArrayData'] - - @property - def sp_arrayc(self): - """.""" - return self['SP_CArrayData'] - - @property - def sp_arrayd(self): - """.""" - return self['SP_DArrayData'] - - @property - def acq_mode(self): - """.""" - return self['ACQBPMMode-Sts'] - - @acq_mode.setter - def acq_mode(self, mode): - """.""" - self['ACQBPMMode-Sel'] = mode - @property def acq_ctrl(self): """.""" - return self['ACQTriggerEvent-Sts'] + return self['GENTriggerEvent-Cmd'] @acq_ctrl.setter def acq_ctrl(self, val): """.""" - self['ACQTriggerEvent-Sel'] = val + self['GENTriggerEvent-Cmd'] = val @property def acq_status(self): """.""" - return self['ACQStatus-Sts'] + return self['GENStatus-Mon'] @property def acq_count(self): """Counter of number of acquisitions so far.""" - return self['ACQCount-Mon'] + return self['GENCount-Mon'] @property def acq_channel(self): """.""" - return self['ACQChannel-Sts'] + return self['GENChannel-Sts'] @acq_channel.setter def acq_channel(self, val): """.""" - self['ACQChannel-Sel'] = val + self['GENChannel-Sel'] = val @property def acq_channel_str(self): @@ -746,139 +617,134 @@ def acq_channel_str(self): @property def acq_trigger(self): """.""" - return self['ACQTrigger-Sts'] + return self['GENTrigger-Sts'] @acq_trigger.setter def acq_trigger(self, val): """.""" - self['ACQTrigger-Sel'] = val + self['GENTrigger-Sel'] = val @property def acq_repeat(self): """.""" - return self['ACQTriggerRep-Sts'] + return self['GENTriggerRep-Sts'] @acq_repeat.setter def acq_repeat(self, val): """.""" - self['ACQTriggerRep-Sel'] = val + self['GENTriggerRep-Sel'] = val @property def acq_update_time(self): """BPMs update time in [s].""" - return self['ACQUpdateTime-RB'] + return self['GENUpdateTime-RB'] @acq_update_time.setter def acq_update_time(self, val): """BPMs update time in [s].""" - self['ACQUpdateTime-SP'] = val + self['GENUpdateTime-SP'] = val @property def acq_trig_datachan(self): """.""" - return self['ACQDataTrigChan-Sts'] + return self['GENDataTrigChan-Sts'] @acq_trig_datachan.setter def acq_trig_datachan(self, val): """.""" - self['ACQDataTrigChan-Sel'] = val + self['GENDataTrigChan-Sel'] = val @property def acq_trig_datasel(self): """.""" - return self['ACQTriggerDataSel-RB'] + return self['GENTriggerDataSel-RB'] @acq_trig_datasel.setter def acq_trig_datasel(self, val): """.""" - self['ACQTriggerDataSel-SP'] = val + self['GENTriggerDataSel-SP'] = val @property def acq_trig_datathres(self): """.""" - return self['ACQTriggerDataThres-RB'] + return self['GENTriggerDataThres-RB'] @acq_trig_datathres.setter def acq_trig_datathres(self, val): """.""" - self['ACQTriggerDataThres-SP'] = val + self['GENTriggerDataThres-SP'] = val @property def acq_trig_datahyst(self): """.""" - return self['ACQTriggerDataHyst-RB'] + return self['GENTriggerDataHyst-RB'] @acq_trig_datahyst.setter def acq_trig_datahyst(self, val): """.""" - self['ACQTriggerDataHyst-SP'] = val + self['GENTriggerDataHyst-SP'] = val @property def acq_trig_datapol(self): """.""" - return self['ACQTriggerDataPol-RB'] + return self['GENTriggerDataPol-RB'] @acq_trig_datapol.setter def acq_trig_datapol(self, val): """.""" - self['ACQTriggerDataPol-SP'] = val + self['GENTriggerDataPol-SP'] = val @property def acq_nrsamples_post(self): """.""" - return self['ACQSamplesPost-RB'] + return self['GENSamplesPost-RB'] @acq_nrsamples_post.setter def acq_nrsamples_post(self, val): """.""" - self['ACQSamplesPost-SP'] = val + self['GENSamplesPost-SP'] = val @property def acq_nrsamples_pre(self): """.""" - return self['ACQSamplesPre-RB'] + return self['GENSamplesPre-RB'] @acq_nrsamples_pre.setter def acq_nrsamples_pre(self, val): """.""" - self['ACQSamplesPre-SP'] = val + self['GENSamplesPre-SP'] = val @property def acq_nrshots(self): """.""" - return self['ACQShots-RB'] + return self['GENShots-RB'] @acq_nrshots.setter def acq_nrshots(self, val): """.""" - self['ACQShots-SP'] = val + self['GENShots-SP'] = val def wait_acq_finish(self, timeout=10): """Wait Acquisition to finish.""" return self._wait( - 'ACQStatus-Sts', self.ACQSTATES_FINISHED, timeout=timeout, + 'GENStatus-Mon', self.ACQSTATES_FINISHED, timeout=timeout, comp=lambda x, y: x in y) def wait_acq_start(self, timeout=10): """Wait Acquisition to start.""" return self._wait( - 'ACQStatus-Sts', self.ACQSTATES_STARTED, timeout=timeout, + 'GENStatus-Mon', self.ACQSTATES_STARTED, timeout=timeout, comp=lambda x, y: x in y) def cmd_acq_start(self): """Command Start Acquisition.""" self.acq_ctrl = _csbpm.AcqEvents.Start - return self._wait('ACQTriggerEvent-Sts', _csbpm.AcqEvents.Start) + return True def cmd_acq_stop(self): """Command Stop Acquisition.""" self.acq_ctrl = _csbpm.AcqEvents.Stop - return self._wait('ACQTriggerEvent-Sts', _csbpm.AcqEvents.Stop) - - def cmd_acq_abort(self): - """Command Abort Acquisition.""" - self.acq_ctrl = _csbpm.AcqEvents.Abort - return self._wait('ACQTriggerEvent-Sts', _csbpm.AcqEvents.Abort) + return True def cmd_turn_on_switching(self): """Command Turn on Switching.""" @@ -960,8 +826,6 @@ def get_propname(self, prop): return prop if prop.startswith('GEN'): return prop.replace('GEN', 'PM') - elif prop.startswith('ACQ'): - return prop.replace('ACQ', 'ACQ_PM') return prop def _get_pvname(self, propty): diff --git a/siriuspy/siriuspy/devices/bpm_eq.py b/siriuspy/siriuspy/devices/bpm_eq.py index f378a9ff0..4e9ff6be5 100644 --- a/siriuspy/siriuspy/devices/bpm_eq.py +++ b/siriuspy/siriuspy/devices/bpm_eq.py @@ -44,12 +44,12 @@ def __init__(self, devname=None, bpmnames=None, logger=None): 'SwInvGainC-RB', 'SwInvGainD-RB', 'SwDirGainA-SP', 'SwInvGainA-SP', 'SwDirGainB-SP', 'SwInvGainB-SP', 'SwDirGainC-SP', 'SwInvGainC-SP', 'SwDirGainD-SP', - 'SwInvGainD-SP', 'ACQTriggerEvent-Sel', 'ACQStatus-Sts', - 'GEN_AArrayData', 'GEN_BArrayData', 'GEN_CArrayData', - 'GEN_DArrayData', 'ACQTriggerRep-Sel', 'ACQChannel-Sel', - 'ACQTrigger-Sel', 'ACQSamplesPre-SP', 'ACQSamplesPost-SP', + 'SwInvGainD-SP', 'GENTriggerEvent-Cmd', 'GENStatus-Mon', + 'GENAmplAData', 'GENAmplBData', 'GENAmplCData', + 'GENAmplDData', 'GENTriggerRep-Sel', 'GENChannel-Sel', + 'GENTrigger-Sel', 'GENSamplesPre-SP', 'GENSamplesPost-SP', 'INFOHarmonicNumber-RB', 'INFOTbTRate-RB', 'SwDivClk-RB', - 'ACQChannel-Sts', 'INFOFOFBRate-RB', 'PosKx-RB', 'PosKy-RB', + 'GENChannel-Sts', 'INFOFOFBRate-RB', 'PosKx-RB', 'PosKy-RB', 'PosXOffset-RB', 'PosYOffset-RB']) self.currinfo = _CurrInfoSI(props2init=['Current-Mon', ]) self.trigger = Trigger( @@ -252,10 +252,10 @@ def _do_acquire(self): # acquire antennas data in FOFB rate self._log('Preparing BPMs') - ret = self.cmd_abort_mturn_acquisition() + ret = self.cmd_stop_mturn_acquisition() if ret > 0: self._log( - f'ERR: BPM {self.bpm_names[ret-1]} did not abort ' + f'ERR: BPM {self.bpm_names[ret-1]} did not stop ' 'previous acquistion.') return @@ -330,10 +330,10 @@ def acquire_data_for_checking(self): def _do_acquire_for_check(self): # acquire antennas data in FOFB rate self._log('Preparing BPMs') - ret = self.cmd_abort_mturn_acquisition() + ret = self.cmd_stop_mturn_acquisition() if ret > 0: self._log( - f'ERR: BPM {self.bpm_names[ret-1]} did not abort ' + f'ERR: BPM {self.bpm_names[ret-1]} did not stop ' 'previous acquistion.') return diff --git a/siriuspy/siriuspy/devices/bpm_fam.py b/siriuspy/siriuspy/devices/bpm_fam.py index c0e475f9c..a4f921e61 100644 --- a/siriuspy/siriuspy/devices/bpm_fam.py +++ b/siriuspy/siriuspy/devices/bpm_fam.py @@ -84,9 +84,9 @@ def __init__( self._initial_signals = None self._mturn_flags = dict() - # NOTE: ACQCount-Mon need to be fixed on BPM's IOC + # NOTE: GENCount-Mon need to be fixed on BPM's IOC # for bpm in devs: - # pvo = bpm.pv_object('ACQCount-Mon') + # pvo = bpm.pv_object('GENCount-Mon') # pvo.auto_monitor = True # self._mturn_flags[pvo.pvname] = _Flag() # pvo.add_callback(self._set_mturn_flag) @@ -242,6 +242,16 @@ def get_mturn_signals(self): sigs[i] = _np.array(sig).T return sigs + def conv_signal2pvname_format(self, sig): + """Convert signal to generate PV name.""" + if sig == 'S': + sig = 'Sum' + elif sig == 'X' or 'Y' or 'Q': + sig = 'Pos' + sig + else: + sig = 'Ampl' + sig + return sig + def get_mturn_timestamps(self): """Get Multiturn data timestamps. @@ -254,8 +264,8 @@ def get_mturn_timestamps(self): (len(self._mturn_signals2acq), len(self.bpms)), dtype=float) for i, s in enumerate(self._mturn_signals2acq): for j, bpm in enumerate(self.bpms): - s = 'SUM' if s == 'S' else s - pvo = bpm.pv_object(f'GEN_{s}ArrayData') + s = self.conv_signal2pvname_format(s) + pvo = bpm.pv_object(f'GEN{s}Data') tv = pvo.get_timevars(timeout=self.TIMEOUT) tsmps[i, j] = pvo.timestamp if tv is None else tv['timestamp'] return tsmps @@ -278,7 +288,7 @@ def get_sampling_frequency(self, rf_freq: float, acq_rate='') -> float: if len(fs_bpms) == 1: return fs_bpms.pop() else: - _log.warning('BPMs are not configured with the same ACQChannel.') + _log.warning('BPMs are not configured with the same GENChannel.') return None def get_switching_frequency(self, rf_freq: float) -> float: @@ -346,7 +356,7 @@ def config_mturn_acquisition( if external: trig = self._csbpm.AcqTrigTyp.External - ret = self.cmd_abort_mturn_acquisition() + ret = self.cmd_stop_mturn_acquisition() if ret > 0: return -ret @@ -359,8 +369,8 @@ def config_mturn_acquisition( return self.cmd_start_mturn_acquisition() - def cmd_abort_mturn_acquisition(self, wait=True, timeout=10) -> int: - """Abort BPMs acquistion. + def cmd_stop_mturn_acquisition(self, wait=True, timeout=10) -> int: + """Stop BPMs acquistion. Args: wait (bool, optional): whether or not to wait BPMs get ready. @@ -371,10 +381,9 @@ def cmd_abort_mturn_acquisition(self, wait=True, timeout=10) -> int: int: code describing what happened: =0: BPMs are ready. >0: Index of the first BPM which did not update plus 1. - """ for bpm in self.bpms: - bpm.acq_ctrl = self._csbpm.AcqEvents.Abort + bpm.acq_ctrl = self._csbpm.AcqEvents.Stop if wait: return self.wait_acquisition_finish(timeout=timeout) @@ -632,8 +641,8 @@ def wait_update_mturn(self, timeout=10) -> int: def _configure_automonitor_acquisition_pvs(self, state): for bpm in self.bpms: for sig in self._mturn_signals2acq: - sig = 'SUM' if sig.upper() == 'S' else sig.upper() - bpm.pv_object(f'GEN_{sig}ArrayData').auto_monitor = state + sig = self.conv_signal2pvname_format(sig.upper()) + bpm.pv_object(f'GEN{sig}Data').auto_monitor = state def _set_mturn_flag(self, pvname, **kwargs): _ = kwargs diff --git a/siriuspy/siriuspy/devices/fofb.py b/siriuspy/siriuspy/devices/fofb.py index 230a2de9e..7477b87ff 100644 --- a/siriuspy/siriuspy/devices/fofb.py +++ b/siriuspy/siriuspy/devices/fofb.py @@ -714,7 +714,7 @@ class FamFastCorrs(_DeviceSet): DEF_ATOL_FOFBACCSAT = 2e-2 DEF_ATOL_CURRENT_RB = 1e-6 DEF_ATOL_CURRENT_MON = 2e-2 - DEF_ATOL_ACCFILTER = 2**-17 + DEF_ATOL_ACCFILTER = 2**-12 DEF_ATOL_ACCFILTERGAIN = 2**-12 def __init__(self, psnames=None): diff --git a/siriuspy/siriuspy/devices/fofb_acq.py b/siriuspy/siriuspy/devices/fofb_acq.py index a579b504d..d14e27cc6 100644 --- a/siriuspy/siriuspy/devices/fofb_acq.py +++ b/siriuspy/siriuspy/devices/fofb_acq.py @@ -134,7 +134,7 @@ def trigger(self, val): @property def status(self): """Acquisition status.""" - return self['Status-Sts'] + return self['Status-Mon'] @property def count(self): @@ -148,13 +148,13 @@ def cmd_ctrl(self, val): def wait_acq_finish(self, timeout=10): """Wait Acquisition to finish.""" return self._wait( - 'Status-Sts', _FOFBCtrlAcqConst.STATES_FINISHED, + 'Status-Mon', _FOFBCtrlAcqConst.STATES_FINISHED, timeout=timeout, comp=lambda x, y: x in y) def wait_acq_start(self, timeout=10): """Wait Acquisition to start.""" return self._wait( - 'Status-Sts', _FOFBCtrlAcqConst.STATES_STARTED, + 'Status-Mon', _FOFBCtrlAcqConst.STATES_STARTED, timeout=timeout, comp=lambda x, y: x in y) @@ -1142,9 +1142,7 @@ def cmd_stop(self, wait=True, timeout=10) -> int: ctl.cmd_ctrl(_FOFBCtrlAcqConst.TrigEvt.stop) if wait: - _time.sleep(2) - return 0 - # return self.wait_acquisition_finish(timeout=timeout) + return self.wait_acquisition_finish(timeout=timeout) return 0 def wait_acquisition_finish(self, timeout=10) -> int: @@ -1186,9 +1184,7 @@ def cmd_start(self, wait=True, timeout=10) -> int: ctl.cmd_ctrl(_FOFBCtrlAcqConst.TrigEvt.start) if wait: - _time.sleep(2) - return 0 - # return self.wait_acquisition_start(timeout=timeout) + return self.wait_acquisition_start(timeout=timeout) return 0 def wait_acquisition_start(self, timeout=10) -> bool: diff --git a/siriuspy/siriuspy/devices/orbit_interlock.py b/siriuspy/siriuspy/devices/orbit_interlock.py index a4806e071..54102b8d2 100644 --- a/siriuspy/siriuspy/devices/orbit_interlock.py +++ b/siriuspy/siriuspy/devices/orbit_interlock.py @@ -172,11 +172,9 @@ class BPMOrbitIntlk(BaseOrbitIntlk, _Device): 'IntlkLmtPosMinY-SP', 'IntlkLmtPosMinY-RB', # All interlocks are masked by the "Enable" state # Instantaneous Status: - 'IntlkPosLower-Mon', 'IntlkPosUpper-Mon', # X ou Y 'IntlkPosLowerX-Mon', 'IntlkPosUpperX-Mon', # X 'IntlkPosLowerY-Mon', 'IntlkPosUpperY-Mon', # Y # Latch Status, clean only when respective "Clr" PV is triggered - 'IntlkPosLowerLtc-Mon', 'IntlkPosUpperLtc-Mon', 'IntlkPosLowerLtcX-Mon', 'IntlkPosUpperLtcX-Mon', 'IntlkPosLowerLtcY-Mon', 'IntlkPosUpperLtcY-Mon', # Position measure from orbit interlock core @@ -209,11 +207,9 @@ class BPMOrbitIntlk(BaseOrbitIntlk, _Device): 'IntlkLmtAngMinY-SP', 'IntlkLmtAngMinY-RB', # All interlocks are masked by the "Enable" state # Intantaneous Status - 'IntlkAngLower-Mon', 'IntlkAngUpper-Mon', 'IntlkAngLowerX-Mon', 'IntlkAngUpperX-Mon', # X 'IntlkAngLowerY-Mon', 'IntlkAngUpperY-Mon', # Y # Latch Status, clean only when respective "Clr" PV is triggered - 'IntlkAngLowerLtc-Mon', 'IntlkAngUpperLtc-Mon', 'IntlkAngLowerLtcX-Mon', 'IntlkAngUpperLtcX-Mon', 'IntlkAngLowerLtcY-Mon', 'IntlkAngUpperLtcY-Mon', # Angle measure from orbit interlock core @@ -358,22 +354,6 @@ def pos_y_max_thres(self): def pos_y_max_thres(self, value): self['IntlkLmtPosMaxY-SP'] = value - @property - def pos_inst_lower(self): - """ - Instantaneous position interlock set when either X or Y - minimum thresholds are exceeded. - """ - return self['IntlkPosLower-Mon'] - - @property - def pos_inst_upper(self): - """ - Instantaneous position interlock set when either X or Y - maximum thresholds are exceeded. - """ - return self['IntlkPosUpper-Mon'] - @property def pos_inst_lower_x(self): """ @@ -406,22 +386,6 @@ def pos_inst_upper_y(self): """ return self['IntlkPosUpperY-Mon'] - @property - def pos_latch_lower(self): - """ - Latch position interlock set when either X or Y - minimum thresholds are exceeded. - """ - return self['IntlkPosLowerLtc-Mon'] - - @property - def pos_latch_upper(self): - """ - Latch position interlock set when either X or Y - maximum thresholds are exceeded. - """ - return self['IntlkPosUpperLtc-Mon'] - @property def pos_latch_lower_x(self): """ @@ -506,22 +470,6 @@ def ang_y_max_thres(self): def ang_y_max_thres(self, value): self['IntlkLmtAngMaxY-SP'] = value - @property - def ang_inst_lower(self): - """ - Instantaneous angulation interlock set when either X or Y - minimum thresholds are exceeded. - """ - return self['IntlkAngLower-Mon'] - - @property - def ang_inst_upper(self): - """ - Instantaneous angulation interlock set when either X or Y - maximum thresholds are exceeded. - """ - return self['IntlkAngUpper-Mon'] - @property def ang_inst_lower_x(self): """ @@ -554,22 +502,6 @@ def ang_inst_upper_y(self): """ return self['IntlkAngUpperY-Mon'] - @property - def ang_latch_lower(self): - """ - Latch angulation interlock set when either X or Y - minimum thresholds are exceeded. - """ - return self['IntlkAngLowerLtc-Mon'] - - @property - def ang_latch_upper(self): - """ - Latch angulation interlock set when either X or Y - maximum thresholds are exceeded. - """ - return self['IntlkAngUpperLtc-Mon'] - @property def ang_latch_lower_x(self): """ @@ -896,26 +828,6 @@ def set_pos_y_max_thres(self, value, timeout=TIMEOUT, return_prob=False): self.devices, 'IntlkLmtPosMaxY-RB', value, timeout=timeout, return_prob=return_prob) - @property - def pos_inst_lower(self): - """Instantaneous position interlock set when either X or Y - minimum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.pos_inst_lower for b in self._devices]) - - @property - def pos_inst_upper(self): - """Instantaneous position interlock set when either X or Y - maximum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.pos_inst_upper for b in self._devices]) - @property def pos_inst_lower_x(self): """Instantaneous position interlock set when X @@ -956,26 +868,6 @@ def pos_inst_upper_y(self): """ return _np.array([b.pos_inst_upper_y for b in self._devices]) - @property - def pos_latch_lower(self): - """Latch position interlock set when either X or Y - minimum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.pos_latch_lower for b in self._devices]) - - @property - def pos_latch_upper(self): - """Latch position interlock set when either X or Y - maximum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.pos_latch_upper for b in self._devices]) - @property def pos_latch_lower_x(self): """Latch position interlock set when X @@ -1165,26 +1057,6 @@ def set_ang_y_max_thres(self, value, timeout=TIMEOUT, return_prob=False): self.devices, 'IntlkLmtAngMaxY-RB', value, timeout=timeout, return_prob=return_prob) - @property - def ang_inst_lower(self): - """Instantaneous angulation interlock set when either X or Y - minimum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.ang_inst_lower for b in self._devices]) - - @property - def ang_inst_upper(self): - """Instantaneous angulation interlock set when either X or Y - maximum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.ang_inst_upper for b in self._devices]) - @property def ang_inst_lower_x(self): """Instantaneous angulation interlock set when X @@ -1225,26 +1097,6 @@ def ang_inst_upper_y(self): """ return _np.array([b.ang_inst_upper_y for b in self._devices]) - @property - def ang_latch_lower(self): - """Latch angulation interlock set when either X or Y - minimum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.ang_latch_lower for b in self._devices]) - - @property - def ang_latch_upper(self): - """Latch angulation interlock set when either X or Y - maximum thresholds are exceeded. - - Returns: - intlk (numpy.ndarray, 160): interlock status for each BPM. - """ - return _np.array([b.ang_latch_upper for b in self._devices]) - @property def ang_latch_lower_x(self): """Latch angulation interlock set when X diff --git a/siriuspy/siriuspy/devices/sofb.py b/siriuspy/siriuspy/devices/sofb.py index 1299e7090..20ee572a5 100644 --- a/siriuspy/siriuspy/devices/sofb.py +++ b/siriuspy/siriuspy/devices/sofb.py @@ -426,16 +426,6 @@ def cmd_trigacq_stop(self, timeout=10): _time.sleep(0.6) # Status PV updates at 2Hz return self.wait_orb_status_ok(timeout=timeout) - def cmd_trigacq_abort(self, timeout=10): - """.""" - self['TrigAcqCtrl-Sel'] = 'Abort' - ret = self._wait( - 'TrigAcqCtrl-Sts', self._data.TrigAcqCtrl.Abort, timeout=timeout) - if not ret: - return False - _time.sleep(0.6) # Status PV updates at 2Hz - return self.wait_orb_status_ok(timeout=timeout) - def cmd_trigacq_config(self, timeout=10): """.""" self['TrigAcqConfig-Cmd'] = 1 diff --git a/siriuspy/siriuspy/diagbeam/bpm/csdev.py b/siriuspy/siriuspy/diagbeam/bpm/csdev.py index d44974a5b..8014a218b 100644 --- a/siriuspy/siriuspy/diagbeam/bpm/csdev.py +++ b/siriuspy/siriuspy/diagbeam/bpm/csdev.py @@ -25,26 +25,20 @@ class ETypes(_csdev.ETypes): SWMODES = ('rffe_switching', 'direct', 'inverted', 'switching') SWTAGENBL = ('disabled', 'enabled') FOFBDATAMASKENBL = ('disabled', 'enabled') - MONITENBL = ('No', 'Yes') - OPMODES = ('MultiBunch', 'SinglePass') POLARITY = ('Positive', 'Negative') ENBLTYP = ('Disable', 'Enable') DSBLDENBLD = ('disabled', 'enabled') CONNTYP = _csdev.ETypes.DISCONN_CONN ACQREPEAT = ('Normal', 'Repetitive') - ACQEVENTS = ('Start', 'Stop', 'Abort') + ACQEVENTS = ('Start', 'Stop') ACQDATATYP = ('A', 'B', 'C', 'D') - ACQCHAN = ('ADC', 'ADCSwp', 'TbT', 'FOFB', 'TbTPha', 'FOFBPha', 'FAcq') + ACQCHAN = ('ADC', 'ADCSwp', 'TbT', 'TbTPha', 'FOFB', 'FOFBPha', 'FAcq') ACQSTATES = ( 'Idle', 'Waiting', 'External Trig', 'Data Trig', 'Software Trig', - 'Acquiring', 'Error', 'Aborted', 'Too Many Samples', - 'Too Few Samples', 'No Memory', 'Acq Overflow') + 'Acquiring', 'Error', 'Bad Post Samples', 'Too Many Samples', + 'No Samples', 'No Memory', 'Overflow') ACQTRIGTYP = ('Now', 'External', 'Data', 'Software') - FFTWINDOWTYP = ('Square', 'Hanning', 'Parzen', 'Welch', 'QuadW') - FFTCONVDIRECTION = ('Forward', 'Backward') - FFTAVGSUBTRACT = ('No Subtraction', 'Average', 'Linear') - FFTWRITABLEPROPS = ('INDX', 'MXIX', 'WIND', 'CDIR', 'ASUB', 'SPAN') _et = ETypes # syntactic sugar @@ -64,8 +58,6 @@ class Const(_csdev.Const): SwPhaseSyncEnbl = _csdev.Const.register('SwPhaseSyncEnbl', _et.SWTAGENBL) FOFBDataMaskEnbl = _csdev.Const.register( 'FOFBDataMaskEnbl', _et.FOFBDATAMASKENBL) - MonitEnbl = _csdev.Const.register('MonitEnbl', _et.MONITENBL) - OpModes = _csdev.Const.register('OpModes', _et.OPMODES) Polarity = _csdev.Const.register('Polarity', _et.POLARITY) EnblTyp = _csdev.Const.register('EnblTyp', _et.ENBLTYP) DsblEnbl = _csdev.Const.register('DsblEnbl', _et.DSBLDENBLD) @@ -76,13 +68,6 @@ class Const(_csdev.Const): AcqChan = _csdev.Const.register('AcqChan', _et.ACQCHAN) AcqStates = _csdev.Const.register('AcqStates', _et.ACQSTATES) AcqTrigTyp = _csdev.Const.register('AcqTrigTyp', _et.ACQTRIGTYP) - FFTWindowTyp = _csdev.Const.register('FFTWindowTyp', _et.FFTWINDOWTYP) - FFTConvDirection = _csdev.Const.register( - 'FFTConvDirection', _et.FFTCONVDIRECTION) - FFTAvgSubtract = _csdev.Const.register( - 'FFTAvgSubtract', _et.FFTAVGSUBTRACT) - FFTWritableProps = _csdev.Const.register( - 'FFTWritableProps', _et.FFTWRITABLEPROPS) @staticmethod def get_bpm_database(prefix=''): @@ -117,42 +102,42 @@ def get_bpm_database(prefix=''): dbase.update(Const.get_physical_trigger_database(trig)) # LOGICAL TRIGGERS - for trig_tp in ('', '_PM'): + for trig_tp in ('_GEN', '_PM'): for i in range(24): trig = 'TRIGGER' + trig_tp + '{0:d}'.format(i) dbase.update(Const.get_logical_trigger_database(trig)) # AMPLITUDES AND POSITION CHANNELS - for amp_tp in ('', 'SP'): - dbase.update(Const.get_amplitudes_database(amp_tp)) + dbase.update(Const.get_amplitudes_database()) # SETTINGS AND STATUS dbase.update(Const.get_offsets_database()) dbase.update(Const.get_gain_database()) dbase.update(Const.get_rffe_database()) - dbase.update(Const.get_asyn_database()) dbase.update(Const.get_switch_database()) dbase.update(Const.get_monit_database()) data_names = { - 'GEN': ['A', 'B', 'C', 'D', 'Q', 'SUM', 'X', 'Y'], - 'PM': ['A', 'B', 'C', 'D', 'Q', 'SUM', 'X', 'Y'], - 'SP': ['A', 'B', 'C', 'D'], + 'GEN': [ + 'AmplA', 'AmplB', 'AmplC', 'AmplD', + 'PosQ', 'Sum', 'PosX', 'PosY' + ], + 'PM': [ + 'AmplA', 'AmplB', 'AmplC', 'AmplD', + 'PosQ', 'Sum', 'PosX', 'PosY' + ], } data_db = { 'type': 'float', 'value': _np.array(100000*[0.0]), 'count': 100000} # ARRAY DATA FROM TRIGGERED ACQUISITIONS - for acq_tp in ('GEN', 'SP', 'PM'): + for acq_tp in ('GEN', 'PM'): for prop in data_names[acq_tp]: - nm = acq_tp + '_' + prop - dbase[nm + 'ArrayData'] = _dcopy(data_db) - dbase.update(Const.get_statistic_database(nm)) - if acq_tp == 'GEN': - dbase.update(Const.get_fft_database(nm)) + nm = acq_tp + prop + dbase[nm + 'Data'] = _dcopy(data_db) # TRIGGERED ACQUISITIONS CONFIGURATION - for acq_md in ('ACQ', 'ACQ_PM'): + for acq_md in ('GEN', 'PM'): dbase.update(Const.get_config_database(acq_md)) for _, v in dbase.items(): @@ -284,10 +269,6 @@ def get_switch_database(prefix=''): def get_monit_database(prefix=''): """.""" dbase = { - 'MonitEnable-Sel': { - 'type': 'enum', 'enums': Const.MonitEnbl._fields, 'value': 3}, - 'MonitEnable-Sts': { - 'type': 'enum', 'enums': Const.MonitEnbl._fields, 'value': 3}, 'MONITUpdtTime-SP': { 'type': 'float', 'value': 0, 'low': 0.001, 'high': 1.0, 'unit': 's'}, @@ -321,7 +302,7 @@ def get_gain_database(prefix=''): return {prefix + k: v for k, v in dbase.items()} @staticmethod - def get_amplitudes_database(prefix=''): + def get_amplitudes_database(): """.""" data_db = {'type': 'float', 'value': 0.0, 'low': -1e12, 'high': 1e12} dbase = { @@ -330,7 +311,7 @@ def get_amplitudes_database(prefix=''): 'AmplA-Mon': _dcopy(data_db), 'AmplB-Mon': _dcopy(data_db), 'AmplC-Mon': _dcopy(data_db), 'AmplD-Mon': _dcopy(data_db), } - return {prefix + k: v for k, v in dbase.items()} + return {k: v for k, v in dbase.items()} @staticmethod def get_physical_trigger_database(prefix=''): @@ -344,9 +325,9 @@ def get_physical_trigger_database(prefix=''): 'type': 'enum', 'enums': Const.TrigDirPol._fields, 'value': 1}, 'DirPol-Sts': { 'type': 'enum', 'enums': Const.TrigDirPol._fields, 'value': 1}, - 'RcvCntRst-SP': { + 'RcvCntRst-Cmd': { 'type': 'int', 'value': 0}, - 'TrnCntRst-SP': { + 'TrnCntRst-Cmd': { 'type': 'int', 'value': 0}, 'RcvCnt-Mon': { 'type': 'int', 'value': 0}, @@ -390,18 +371,12 @@ def get_logical_trigger_database(prefix=''): def get_config_database(prefix=''): """Get the configuration PVs database.""" dbase = { - 'BPMMode-Sel': { - 'type': 'enum', 'enums': Const.OpModes._fields, 'value': 0}, - 'BPMMode-Sts': { - 'type': 'enum', 'enums': Const.OpModes._fields, 'value': 0}, 'Channel-Sel': { 'type': 'enum', 'enums': Const.AcqChan._fields, 'value': 0}, 'Channel-Sts': { 'type': 'enum', 'enums': Const.AcqChan._fields, 'value': 0}, - # 'NrShots-SP': { 'Shots-SP': { 'type': 'int', 'value': 1, 'low': 0, 'high': 65536}, - # 'NrShots-RB': { 'Shots-RB': { 'type': 'int', 'value': 1, 'low': 0, 'high': 65536}, 'TriggerHwDly-SP': { @@ -412,49 +387,31 @@ def get_config_database(prefix=''): 'type': 'float', 'value': 1.0, 'low': 0.001, 'high': 1e9}, 'UpdateTime-RB': { 'type': 'float', 'value': 1.0, 'low': 0.001, 'high': 1e9}, - # 'NrSamplesPre-SP': { 'SamplesPre-SP': { 'type': 'int', 'value': 1000, 'low': 0, 'high': 100000}, - # 'NrSamplesPre-RB': { 'SamplesPre-RB': { 'type': 'int', 'value': 1000, 'low': 0, 'high': 100000}, - # 'NrSamplesPost-SP': { 'SamplesPost-SP': { 'type': 'int', 'value': 1000, 'low': 0, 'high': 100000}, - # 'NrSamplesPost-RB': { 'SamplesPost-RB': { 'type': 'int', 'value': 1000, 'low': 0, 'high': 100000}, - # 'Ctrl-Sel': { - 'TriggerEvent-Sel': { - 'type': 'enum', 'enums': Const.AcqEvents._fields, - 'value': Const.AcqEvents.Stop}, - # 'Ctrl-Sts': { - 'TriggerEvent-Sts': { + 'TriggerEvent-Cmd': { 'type': 'enum', 'enums': Const.AcqEvents._fields, 'value': Const.AcqEvents.Stop}, - # 'Status-Mon': { - 'Status-Sel': { + 'Status-Mon': { 'type': 'enum', 'enums': Const.AcqStates._fields, 'value': 0}, - # 'TriggerType-Sel': { 'Trigger-Sel': { 'type': 'enum', 'enums': Const.AcqTrigTyp._fields, 'value': 1}, - # 'TriggerType-Sts': { 'Trigger-Sts': { 'type': 'enum', 'enums': Const.AcqTrigTyp._fields, 'value': 1}, 'TriggerRep-Sel': { 'type': 'enum', 'enums': Const.AcqRepeat._fields, 'value': 0}, 'TriggerRep-Sts': { 'type': 'enum', 'enums': Const.AcqRepeat._fields, 'value': 0}, - # 'TriggerDataChan-Sel': { 'DataTrigChan-Sel': { 'type': 'enum', 'enums': Const.AcqChan._fields, 'value': 0}, - # 'TriggerDataChan-Sts': { 'DataTrigChan-Sts': { 'type': 'enum', 'enums': Const.AcqChan._fields, 'value': 0}, - # 'TriggerDataSel-Sel': { - # 'type': 'enum', 'enums': AcqDataTyp._fields, 'value': 0}, - # 'TriggerDataSel-Sts': { - # 'type': 'enum', 'enums': AcqDataTyp._fields, 'value': 0}, 'TriggerDataSel-SP': { 'type': 'int', 'value': 0, 'low': 0, 'high': 4}, 'TriggerDataSel-RB': { @@ -493,40 +450,3 @@ def get_config_database(prefix=''): 'type': 'int', 'value': 0, 'low': 0, 'high': 2**31 - 1}, } return {prefix + k: v for k, v in dbase.items()} - - @staticmethod - def get_fft_database(prefix=''): - """Get the PV database of the FFT plugin.""" - data_db = { - 'type': 'float', 'value': _np.array(100000*[0.0]), 'count': 100000} - acq_int_db = {'type': 'int', 'value': 1, 'low': 0, 'high': 100000} - dbase = dict() - dbase['FFTFreq-Mon'] = _dcopy(data_db) - dbase['FFTData.SPAN'] = _dcopy(acq_int_db) - dbase['FFTData.AMP'] = _dcopy(data_db) - dbase['FFTData.PHA'] = _dcopy(data_db) - dbase['FFTData.SIN'] = _dcopy(data_db) - dbase['FFTData.COS'] = _dcopy(data_db) - dbase['FFTData.WAVN'] = _dcopy(data_db) - dbase['FFTData.INDX'] = _dcopy(acq_int_db) - dbase['FFTData.MXIX'] = _dcopy(acq_int_db) - dbase['FFTData.WIND'] = { - 'type': 'enum', 'enums': Const.FFTWindowTyp._fields, 'value': 0} - dbase['FFTData.CDIR'] = { - 'type': 'enum', 'enums': Const.FFTConvDirection._fields, - 'value': 0} - dbase['FFTData.ASUB'] = { - 'type': 'enum', 'enums': Const.FFTAvgSubtract._fields, 'value': 0} - return {prefix + k: v for k, v in dbase.items()} - - @staticmethod - def get_statistic_database(prefix=''): - """Get the PV database of the STAT plugin.""" - acq_data_stat_db = { - 'type': 'float', 'value': 0.0, 'low': -1e12, 'high': 1e12} - dbase = dict() - dbase['_STATSMaxValue_RBV'] = _dcopy(acq_data_stat_db) - dbase['_STATSMeanValue_RBV'] = _dcopy(acq_data_stat_db) - dbase['_STATSMinValue_RBV'] = _dcopy(acq_data_stat_db) - dbase['_STATSSigma_RBV'] = _dcopy(acq_data_stat_db) - return {prefix + k: v for k, v in dbase.items()} diff --git a/siriuspy/siriuspy/fofb/csdev.py b/siriuspy/siriuspy/fofb/csdev.py index 88d3a5c5f..7e6313ae2 100644 --- a/siriuspy/siriuspy/fofb/csdev.py +++ b/siriuspy/siriuspy/fofb/csdev.py @@ -49,6 +49,7 @@ class HLFOFBConst(_csdev.Const): TIKHONOV_REG_CONST = 0 SINGVALHW_THRS = 1e-14 DEF_MAX_ORB_DISTORTION = 200 # [um] + DEF_ACC_DECIMATION = 4600 CONV_UM_2_NM = 1e3 ACCGAIN_RESO = 2**-12 @@ -161,22 +162,22 @@ def get_hlfofb_database(self): 'type': 'enum', 'enums': _et.OPEN_CLOSED, 'value': self.LoopState.Open}, 'LoopGainH-SP': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1200, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainH-RB': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1200, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainH-Mon': { 'type': 'float', 'value': 0, 'prec': 4, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainV-SP': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1660, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainV-RB': { - 'type': 'float', 'value': 0.0520, 'prec': 4, + 'type': 'float', 'value': 0.1660, 'prec': 4, 'lolim': -2**3, 'hilim': 2**3-1, 'unit': 'FOFB pre-accumulator gain.'}, 'LoopGainV-Mon': { @@ -233,16 +234,16 @@ def get_hlfofb_database(self): 'type': 'float', 'prec': 0, 'value': 5, 'unit': 's', 'lolim': 0.0, 'hilim': 1000.0}, 'CHAccSatMax-SP': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, 'CHAccSatMax-RB': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, 'CVAccSatMax-SP': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, 'CVAccSatMax-RB': { - 'type': 'float', 'prec': 6, 'value': 0.3, 'unit': 'A', + 'type': 'float', 'prec': 6, 'value': 0.4, 'unit': 'A', 'lolim': 0, 'hilim': 0.95}, # FOFB Controllers @@ -276,24 +277,26 @@ def get_hlfofb_database(self): # decimation configuration 'FOFBAccDecimation-Sel': { 'type': 'enum', 'enums': _et.DEC_OPT, - 'value': self.DecOpt.FOFB, 'unit': 'FOFB_Monit_Custom'}, + 'value': self.DecOpt.Monit, 'unit': 'FOFB_Monit_Custom'}, 'FOFBAccDecimation-Sts': { 'type': 'enum', 'enums': _et.DEC_OPT, - 'value': self.DecOpt.FOFB, 'unit': 'FOFB_Monit_Custom'}, + 'value': self.DecOpt.Monit, 'unit': 'FOFB_Monit_Custom'}, 'FOFBAccDecimation-SP': { - 'type': 'float', 'value': 1, 'prec': 0, 'lolim': 1, - 'hilim': 8600, 'unit': 'count'}, + 'type': 'float', 'value': self.DEF_ACC_DECIMATION, 'prec': 0, + 'lolim': 1, 'hilim': 8600, 'unit': 'count'}, 'FOFBAccDecimation-RB': { - 'type': 'float', 'value': 1, 'prec': 0, 'lolim': 1, - 'hilim': 8600, 'unit': 'count'}, + 'type': 'float', 'value': self.DEF_ACC_DECIMATION, 'prec': 0, + 'lolim': 1, 'hilim': 8600, 'unit': 'count'}, # filter configuration 'PSConfigMat-SP': { 'type': 'float', 'value': _np.zeros(self.psconfig_size), - 'prec': 5, 'count': self.psconfig_size, 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, + 'prec': 5, 'count': self.psconfig_size, + 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, 'PSConfigMat-RB': { 'type': 'float', 'value': _np.zeros(self.psconfig_size), - 'prec': 5, 'count': self.psconfig_size, 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, + 'prec': 5, 'count': self.psconfig_size, + 'unit': '(FCorrs)x(Kp, Ki, gain, coeffs)'}, # Reference Orbit (same order of SOFB) 'RefOrbX-SP': { diff --git a/siriuspy/siriuspy/fofb/main.py b/siriuspy/siriuspy/fofb/main.py index c4d2eee7a..496feb108 100644 --- a/siriuspy/siriuspy/fofb/main.py +++ b/siriuspy/siriuspy/fofb/main.py @@ -32,25 +32,26 @@ def __init__(self, tests=False): self._init = False # internal states + pvdb = self._pvs_database self._loop_state = self._const.LoopState.Open self._loop_state_lastsp = self._const.LoopState.Open - self._loop_gain_h = 0.0520 + self._loop_gain_h = pvdb['LoopGainH-RB']['value'] self._loop_gain_mon_h = 0 - self._loop_gain_v = 0.0520 + self._loop_gain_v = pvdb['LoopGainV-RB']['value'] self._loop_gain_mon_v = 0 self._thread_loopstate = None self._abort_thread = False self._loop_max_orb_dist = self._const.DEF_MAX_ORB_DISTORTION self._loop_max_orb_dist_enbl = self._const.DsblEnbl.Dsbl self._loop_packloss_detec_enbl = self._const.DsblEnbl.Dsbl - self._corr_status = self._pvs_database['CorrStatus-Mon']['value'] + self._corr_status = pvdb['CorrStatus-Mon']['value'] self._corr_setcurrzero_dur = 5 self._thread_currzero = None self._abort_thread_currzero = False - self._ch_maxacccurr = self._pvs_database['CHAccSatMax-RB']['value'] - self._cv_maxacccurr = self._pvs_database['CVAccSatMax-RB']['value'] - self._time_frame_len = self._pvs_database['TimeFrameLen-RB']['value'] - self._fofbctrl_status = self._pvs_database['CtrlrStatus-Mon']['value'] + self._ch_maxacccurr = pvdb['CHAccSatMax-RB']['value'] + self._cv_maxacccurr = pvdb['CVAccSatMax-RB']['value'] + self._time_frame_len = pvdb['TimeFrameLen-RB']['value'] + self._fofbctrl_status = pvdb['CtrlrStatus-Mon']['value'] self._thread_syncnet = None self._thread_reset = None self._fofbctrl_syncenbllist = _np.ones(self._const.nr_bpms, dtype=bool) @@ -70,8 +71,8 @@ def __init__(self, tests=False): 'cv': _np.ones(self._const.nr_cv, dtype=bool), 'rf': _np.ones(1, dtype=bool), } - self._corr_accdec_val = 1 - self._corr_accdec_enm = self._const.DecOpt.FOFB + self._corr_accdec_val = pvdb['FOFBAccDecimation-RB']['value'] + self._corr_accdec_enm = pvdb['FOFBAccDecimation-Sts']['value'] self._corr_accfilter_val = _np.zeros( (self._const.nr_chcv, self._const.psconfig_nr_coeffs_columns), dtype=float @@ -718,9 +719,9 @@ def set_corr_accdec(self, option, value): fofb = self._auxbpm['INFOFOFBRate-RB'] dec = monit // fofb else: + dec = self._const.DEF_ACC_DECIMATION self._update_log('WARN:Could not read decimation from BPM') - self._update_log('WARN:rates. Using value 4600.') - dec = 4600 + self._update_log(f'WARN:rates. Using value {dec}.') else: dec = self._corr_accdec_val self._corr_accdec_enm = value diff --git a/siriuspy/siriuspy/orbintlk/csdev.py b/siriuspy/siriuspy/orbintlk/csdev.py index 028462fc1..78505859f 100644 --- a/siriuspy/siriuspy/orbintlk/csdev.py +++ b/siriuspy/siriuspy/orbintlk/csdev.py @@ -109,8 +109,8 @@ class Const(_csdev.Const): ('TrnLen-SP', 20), ) SIBPMLOGTRIG_CONFIGS = ( - ('TRIGGER4TrnSrc-Sel', 1), - ('TRIGGER4TrnOutSel-SP', 2), + ('TRIGGER_GEN4TrnSrc-Sel', 1), + ('TRIGGER_GEN4TrnOutSel-SP', 2), ('TRIGGER_PM0RcvSrc-Sel', 0), ('TRIGGER_PM0RcvInSel-SP', 2), ('TRIGGER_PM1RcvSrc-Sel', 0), diff --git a/siriuspy/siriuspy/orbintlk/main.py b/siriuspy/siriuspy/orbintlk/main.py index 90448b765..6d5b9e0d7 100644 --- a/siriuspy/siriuspy/orbintlk/main.py +++ b/siriuspy/siriuspy/orbintlk/main.py @@ -185,16 +185,16 @@ def __init__(self, tests=False): self._fambpm_dev = _FamBPMs( devname=_FamBPMs.DEVICES.SI, ispost_mortem=True, props2init=[ - 'ACQChannel-Sel', 'ACQChannel-Sts', - 'ACQSamplesPre-SP', 'ACQSamplesPre-RB', - 'ACQSamplesPost-SP', 'ACQSamplesPost-RB', - 'ACQTriggerRep-Sel', 'ACQTriggerRep-Sts', - 'ACQTrigger-Sel', 'ACQTrigger-Sts', - 'ACQTriggerEvent-Sel', 'ACQTriggerEvent-Sts', - 'ACQStatus-Sts', + 'GENChannel-Sel', 'GENChannel-Sts', + 'GENSamplesPre-SP', 'GENSamplesPre-RB', + 'GENSamplesPost-SP', 'GENSamplesPost-RB', + 'GENTriggerRep-Sel', 'GENTriggerRep-Sts', + 'GENTrigger-Sel', 'GENTrigger-Sts', + 'GENTriggerEvent-Cmd', + 'GENStatus-Mon', 'INFOFAcqRate-RB', 'INFOMONITRate-RB', - 'TRIGGER4TrnSrc-Sel', 'TRIGGER4TrnSrc-Sts', - 'TRIGGER4TrnOutSel-SP', 'TRIGGER4TrnOutSel-RB', + 'TRIGGER_GEN4TrnSrc-Sel', 'TRIGGER_GEN4TrnSrc-Sts', + 'TRIGGER_GEN4TrnOutSel-SP', 'TRIGGER_GEN4TrnOutSel-RB', 'TRIGGER_PM0RcvSrc-Sel', 'TRIGGER_PM0RcvSrc-Sts', 'TRIGGER_PM0RcvInSel-SP', 'TRIGGER_PM0RcvInSel-RB', 'TRIGGER_PM1RcvSrc-Sel', 'TRIGGER_PM1RcvSrc-Sts', @@ -865,10 +865,10 @@ def cmd_acq_config(self, value=None): return True def _acq_config(self): - self._update_log('Aborting BPM acquisition...') - ret = self._fambpm_dev.cmd_abort_mturn_acquisition() + self._update_log('Stoping BPM acquisition...') + ret = self._fambpm_dev.cmd_stop_mturn_acquisition() if ret > 0: - self._update_log('ERR:Failed to abort BPM acquisition.') + self._update_log('ERR:Failed to stop BPM acquisition.') return self._update_log('...done. Configuring BPM acquisition...') ret = self._fambpm_dev.config_mturn_acquisition( @@ -879,7 +879,7 @@ def _acq_config(self): external=True) if ret < 0: self._update_log( - 'ERR:Failed to abort acquisition for ' + + 'ERR:Failed to stop acquisition for ' + f'{self._const.bpm_names[-ret-1]:s}.') return if ret > 0: @@ -1145,7 +1145,7 @@ def _check_configs(self): okb &= all( d.acq_trigger == self._const.AcqTrigTyp.External for d in bpms) okb &= all( - d.acq_status == self._const.AcqStates.External_Trig for d in bpms) + d.acq_status == self._const.AcqStates.Acquiring for d in bpms) value = _updt_bit(value, 8, not okb) # LogTrigConfigured okl = True @@ -1154,6 +1154,8 @@ def _check_configs(self): prp_rb = _PVName.from_sp2rb(prp) okl &= bpm[prp_rb] == val value = _updt_bit(value, 9, not okl) + else: + value = 0b11111111111 self._bpm_status = value self.run_callbacks('BPMStatus-Mon', self._bpm_status) diff --git a/siriuspy/siriuspy/sofb/bpms.py b/siriuspy/siriuspy/sofb/bpms.py index 409fc013c..d12f159cf 100644 --- a/siriuspy/siriuspy/sofb/bpms.py +++ b/siriuspy/siriuspy/sofb/bpms.py @@ -32,35 +32,26 @@ def __init__(self, name, callback=None): self._ksum = _PV(pvpref + "PosKsum-RB", **opt) self._polyx = _PV(pvpref + "GEN_PolyXArrayCoeff-RB", **opt) self._polyy = _PV(pvpref + "GEN_PolyYArrayCoeff-RB", **opt) - self._arraya = _PV(pvpref + "GEN_AArrayData", **opt) - self._arrayb = _PV(pvpref + "GEN_BArrayData", **opt) - self._arrayc = _PV(pvpref + "GEN_CArrayData", **opt) - self._arrayd = _PV(pvpref + "GEN_DArrayData", **opt) - self._arrayx = _PV(pvpref + "GEN_XArrayData", **opt) - self._arrayy = _PV(pvpref + "GEN_YArrayData", **opt) - self._arrays = _PV(pvpref + "GEN_SUMArrayData", **opt) + self._arraya = _PV(pvpref + "GENAmplAData", **opt) + self._arrayb = _PV(pvpref + "GENAmplBData", **opt) + self._arrayc = _PV(pvpref + "GENAmplCData", **opt) + self._arrayd = _PV(pvpref + "GENAmplDData", **opt) + self._arrayx = _PV(pvpref + "GENPosXData", **opt) + self._arrayy = _PV(pvpref + "GENPosYData", **opt) + self._arrays = _PV(pvpref + "GENSumData", **opt) opt.pop("auto_monitor") self._offsetx = _PV(pvpref + "PosXOffset-RB", **opt) self._offsety = _PV(pvpref + "PosYOffset-RB", **opt) self._config_ok_vals = { - "asyn.ENBL": _CSBPM.EnblTyp.Enable, "SwMode": _CSBPM.SwModes.switching, - "ACQBPMMode": _CSBPM.OpModes.MultiBunch, "ACQChannel": _CSBPM.AcqChan.ADC, - # 'ACQNrShots': 1, "ACQShots": 1, - # 'ACQTriggerHwDly': 0.0, # NOTE: leave this property commented "ACQUpdateTime": 0.001, - # 'ACQNrSamplesPre': 0, "ACQSamplesPre": 0, - # 'ACQNrSamplesPost': 200, "ACQSamplesPost": 382, - # 'ACQCtrl': _CSBPM.AcqEvents.Stop, "ACQTriggerEvent": _CSBPM.AcqEvents.Stop, - # 'ACQTriggerType': _CSBPM.AcqTrigTyp.External, "ACQTrigger": _CSBPM.AcqTrigTyp.External, "ACQTriggerRep": _CSBPM.AcqRepeat.Repetitive, - # 'ACQTriggerDataChan': _CSBPM.AcqChan.FAcq, "ACQDataTrigChan": _CSBPM.AcqChan.ADC, "TbTPhaseSyncEn": _CSBPM.DsblEnbl.disabled, # Enable TbT sync "FOFBPhaseSyncEn": _CSBPM.DsblEnbl.disabled, # Enable FOFB sync @@ -70,30 +61,21 @@ def __init__(self, name, callback=None): "TbTDataMaskSamplesBeg": 0, "TbTDataMaskSamplesEnd": 0, "XYPosCal": _CSBPM.DsblEnbl.enabled, - "SUMPosCal": _CSBPM.DsblEnbl.enabled, + "SumPosCal": _CSBPM.DsblEnbl.enabled, "SwPhaseSyncEn": _CSBPM.DsblEnbl.enabled, # Enable Switching sync "TestDataEn": _CSBPM.DsblEnbl.disabled, } pvs = { - "asyn.ENBL": "asyn.ENBL", "SwMode": "SwMode-Sel", - "ACQBPMMode": "ACQBPMMode-Sel", - "ACQChannel": "ACQChannel-Sel", - # 'ACQNrShots': 'ACQNrShots-SP', - "ACQShots": "ACQShots-SP", - # 'ACQTriggerHwDly': 'ACQTriggerHwDly-SP', - "ACQUpdateTime": "ACQUpdateTime-SP", - # 'ACQNrSamplesPre': 'ACQNrSamplesPre-SP', - "ACQSamplesPre": "ACQSamplesPre-SP", - # 'ACQNrSamplesPost': 'ACQNrSamplesPost-SP', - "ACQSamplesPost": "ACQSamplesPost-SP", - # 'ACQCtrl': 'ACQCtrl-Sel', - "ACQTriggerEvent": "ACQTriggerEvent-Sel", - # 'ACQTriggerType': 'ACQTriggerType-Sel', - "ACQTrigger": "ACQTrigger-Sel", - "ACQTriggerRep": "ACQTriggerRep-Sel", - # 'ACQTriggerDataChan': 'ACQTriggerDataChan-Sel', - "ACQDataTrigChan": "ACQDataTrigChan-Sel", + "ACQChannel": "GENChannel-Sel", + "ACQShots": "GENShots-SP", + "ACQUpdateTime": "GENUpdateTime-SP", + "ACQSamplesPre": "GENSamplesPre-SP", + "ACQSamplesPost": "GENSamplesPost-SP", + "ACQTriggerEvent": "GENTriggerEvent-Cmd", + "ACQTrigger": "GENTrigger-Sel", + "ACQTriggerRep": "GENTriggerRep-Sel", + "ACQDataTrigChan": "GENDataTrigChan-Sel", "TbTPhaseSyncEn": "TbTPhaseSyncEn-Sel", # Enable TbT sync "FOFBPhaseSyncEn": "FOFBPhaseSyncEn-Sel", # Enable FOFB sync "FAcqPhaseSyncEn": "FAcqPhaseSyncEn-Sel", # Enable FAcq sync @@ -102,7 +84,7 @@ def __init__(self, name, callback=None): "TbTDataMaskSamplesBeg": "TbTDataMaskSamplesBeg-SP", "TbTDataMaskSamplesEnd": "TbTDataMaskSamplesEnd-SP", "XYPosCal": "XYPosCal-Sel", - "SUMPosCal": "SUMPosCal-Sel", + "SumPosCal": "SumPosCal-Sel", "SwPhaseSyncEn": "SwPhaseSyncEn-Sel", # Enable Switching sync "TestDataEn": "TestDataEn-Sel", } @@ -110,8 +92,6 @@ def __init__(self, name, callback=None): k: _PV(pvpref + v, **opt) for k, v in pvs.items() } pvs = { - "asyn.ENBL": "asyn.ENBL", - "asyn.CNCT": "asyn.CNCT", "INFOClkFreq": "INFOClkFreq-RB", "INFOHarmonicNumber": "INFOHarmonicNumber-RB", "INFOTbTRate": "INFOTbTRate-RB", @@ -119,25 +99,16 @@ def __init__(self, name, callback=None): "INFOMONITRate": "INFOMONITRate-RB", "INFOFAcqRate": "INFOFAcqRate-RB", "SwMode": "SwMode-Sts", - "ACQBPMMode": "ACQBPMMode-Sts", - "ACQChannel": "ACQChannel-Sts", - # 'ACQNrShots': 'ACQNrShots-RB', - "ACQShots": "ACQShots-RB", - # 'ACQTriggerHwDly': 'ACQTriggerHwDly-RB', - "ACQUpdateTime": "ACQUpdateTime-RB", - # 'ACQNrSamplesPre': 'ACQNrSamplesPre-RB', - "ACQSamplesPre": "ACQSamplesPre-RB", - # 'ACQNrSamplesPost': 'ACQNrSamplesPost-RB', - "ACQSamplesPost": "ACQSamplesPost-RB", - # 'ACQCtrl': 'ACQCtrl-Sts', - "ACQTriggerEvent": "ACQTriggerEvent-Sts", - # 'ACQStatus': 'ACQStatus-Mon', - "ACQStatus": "ACQStatus-Sts", - # 'ACQTriggerType': 'ACQTriggerType-Sts', - "ACQTrigger": "ACQTrigger-Sts", - "ACQTriggerRep": "ACQTriggerRep-Sts", - # 'ACQTriggerDataChan': 'ACQTriggerDataChan-Sts', - "ACQDataTrigChan": "ACQDataTrigChan-Sts", + "ACQChannel": "GENChannel-Sts", + "ACQShots": "GENShots-RB", + "ACQUpdateTime": "GENUpdateTime-RB", + "ACQSamplesPre": "GENSamplesPre-RB", + "ACQSamplesPost": "GENSamplesPost-RB", + "ACQTriggerEvent": "GENTriggerEvent-Cmd", + "ACQStatus": "GENStatus-Mon", + "ACQTrigger": "GENTrigger-Sts", + "ACQTriggerRep": "GENTriggerRep-Sts", + "ACQDataTrigChan": "GENDataTrigChan-Sts", "TbTPhaseSyncEn": "TbTPhaseSyncEn-Sts", "FOFBPhaseSyncEn": "FOFBPhaseSyncEn-Sts", "FAcqPhaseSyncEn": "FAcqPhaseSyncEn-Sts", @@ -146,7 +117,7 @@ def __init__(self, name, callback=None): "TbTDataMaskSamplesBeg": "TbTDataMaskSamplesBeg-RB", "TbTDataMaskSamplesEnd": "TbTDataMaskSamplesEnd-RB", "XYPosCal": "XYPosCal-Sts", - "SUMPosCal": "SUMPosCal-Sts", + "SumPosCal": "SumPosCal-Sts", "SwPhaseSyncEn": "SwPhaseSyncEn-Sel", "TestDataEn": "TestDataEn-Sel", } @@ -174,7 +145,7 @@ def connected(self): self._offsetx, self._offsety, self._polyx, - self._polyx, + self._polyy, self._arraya, self._arrayb, self._arrayc, @@ -200,13 +171,14 @@ def is_ok(self): okay = pvobj.value not in { stts.Error, stts.No_Memory, - stts.Too_Few_Samples, + stts.No_Samples, stts.Too_Many_Samples, - stts.Acq_Overflow, + stts.Overflow, + stts.Bad_Post_Samples, } if self._config_ok_vals["ACQTriggerEvent"] == _CSBPM.AcqEvents.Start: - okay &= pvobj.value not in {stts.Idle, stts.Aborted} + okay &= pvobj.value != stts.Idle else: okay &= pvobj.value not in { stts.Waiting, @@ -221,23 +193,6 @@ def is_ok(self): _log.warning(msg[5:]) return okay - @property - def state(self): - """.""" - pvobj = self._config_pvs_rb["asyn.ENBL"] - if pvobj.connected: - return pvobj.value == _CSBPM.EnblTyp.Enable - return False - - @state.setter - def state(self, boo): - """.""" - val = _CSBPM.EnblTyp.Enable if boo else _CSBPM.EnblTyp.Disable - pvobj = self._config_pvs_sp["asyn.ENBL"] - self._config_ok_vals["asyn.ENBL"] = val - if self.put_enable and pvobj.connected: - pvobj.put(val, wait=False) - @property def switching_mode(self): """.""" @@ -362,20 +317,6 @@ def ksum(self): val = pvobj.value if pvobj.connected else defv return val if val else defv - @property - def mode(self): - """.""" - pvobj = self._config_pvs_rb["ACQBPMMode"] - return pvobj.value if pvobj.connected else _CSBPM.OpModes.MultiBunch - - @mode.setter - def mode(self, mode): - """.""" - pvobj = self._config_pvs_sp["ACQBPMMode"] - self._config_ok_vals["ACQBPMMode"] = mode - if self.put_enable and pvobj.connected: - pvobj.value = mode - @property def arraya(self): """.""" @@ -656,9 +597,9 @@ def polycal(self, val): """.""" val = _CSBPM.DsblEnbl.enabled if val else _CSBPM.DsblEnbl.disabled pv1 = self._config_pvs_sp["XYPosCal"] - pv2 = self._config_pvs_sp["SUMPosCal"] + pv2 = self._config_pvs_sp["SumPosCal"] self._config_ok_vals["XYPosCal"] = val - self._config_ok_vals["SUMPosCal"] = val + self._config_ok_vals["SumPosCal"] = val if self.put_enable and pv1.connected: pv1.put(val, wait=False) if self.put_enable and pv2.connected: @@ -667,16 +608,13 @@ def polycal(self, val): @property def nrsamplespost(self): """.""" - # pvobj = self._config_pvs_rb['ACQNrSamplesPost'] pvobj = self._config_pvs_rb["ACQSamplesPost"] return pvobj.value if pvobj.connected else None @nrsamplespost.setter def nrsamplespost(self, val): """.""" - # pvobj = self._config_pvs_sp['ACQNrSamplesPost'] pvobj = self._config_pvs_sp["ACQSamplesPost"] - # self._config_ok_vals['ACQNrSamplesPost'] = val self._config_ok_vals["ACQSamplesPost"] = val if self.put_enable and pvobj.connected: pvobj.put(val, wait=False) @@ -684,16 +622,13 @@ def nrsamplespost(self, val): @property def nrsamplespre(self): """.""" - # pvobj = self._config_pvs_rb['ACQNrSamplesPre'] pvobj = self._config_pvs_rb["ACQSamplesPre"] return pvobj.value if pvobj.connected else None @nrsamplespre.setter def nrsamplespre(self, val): """.""" - # pvobj = self._config_pvs_sp['ACQNrSamplesPre'] pvobj = self._config_pvs_sp["ACQSamplesPre"] - # self._config_ok_vals['ACQNrSamplesPre'] = val self._config_ok_vals["ACQSamplesPre"] = val if self.put_enable and pvobj.connected: pvobj.put(val, wait=False) @@ -701,16 +636,13 @@ def nrsamplespre(self, val): @property def nrshots(self): """.""" - # pvobj = self._config_pvs_rb['ACQNrShots'] pvobj = self._config_pvs_rb["ACQShots"] return pvobj.value if pvobj.connected else None @nrshots.setter def nrshots(self, val): """.""" - # pvobj = self._config_pvs_sp['ACQNrShots'] pvobj = self._config_pvs_sp["ACQShots"] - # self._config_ok_vals['ACQNrShots'] = val self._config_ok_vals["ACQShots"] = val if self.put_enable and pvobj.connected: pvobj.put(val, wait=False) diff --git a/siriuspy/siriuspy/sofb/csdev.py b/siriuspy/siriuspy/sofb/csdev.py index 682b5f479..e3fe704d1 100644 --- a/siriuspy/siriuspy/sofb/csdev.py +++ b/siriuspy/siriuspy/sofb/csdev.py @@ -51,7 +51,6 @@ class ETypes(_csdev.ETypes): "TimingConnected", "TimingConfigured", "BPMsConnected", - "BPMsEnabled", "BPMsConfigured", "BPMsTestDsbld", "BPMsSwSyncEnbld", @@ -439,13 +438,13 @@ def get_orbit_database(self, prefix=""): "TrigAcqConfig-Cmd": {"type": "int", "value": 0}, "TrigAcqCtrl-Sel": { "type": "enum", - "unit": "Start_Stop_Abort", + "unit": "Start_Stop", "value": self.TrigAcqCtrl.Stop, "enums": self.TrigAcqCtrl._fields, }, "TrigAcqCtrl-Sts": { "type": "enum", - "unit": "Start_Stop_Abort.", + "unit": "Start_Stop.", "value": self.TrigAcqCtrl.Stop, "enums": self.TrigAcqCtrl._fields, }, @@ -1008,10 +1007,10 @@ def get_sofb_database(self, prefix=""): 'LoopState-Sts': { 'type': 'enum', 'enums': self.LoopState._fields, 'value': 0}, 'LoopFreq-SP': { - 'type': 'float', 'value': self.BPMsFreq, 'unit': 'Hz', + 'type': 'float', 'value': self.BPMsFreq / 10, 'unit': 'Hz', 'prec': 3, 'lolim': 1e-3, 'hilim': 60}, 'LoopFreq-RB': { - 'type': 'float', 'value': self.BPMsFreq, 'unit': 'Hz', + 'type': 'float', 'value': self.BPMsFreq / 10, 'unit': 'Hz', 'prec': 3, 'lolim': 1e-3, 'hilim': 60}, 'LoopPIDKpCH-SP': { 'type': 'float', 'value': 0.0, 'unit': 'frac', 'prec': 3, diff --git a/siriuspy/siriuspy/sofb/main.py b/siriuspy/siriuspy/sofb/main.py index 13c6b15ba..c2899871b 100644 --- a/siriuspy/siriuspy/sofb/main.py +++ b/siriuspy/siriuspy/sofb/main.py @@ -37,7 +37,7 @@ def __init__( self._tests = tests self._orbit = self._correctors = self._matrix = None self._loop_state = self._csorb.LoopState.Open - self._loop_freq = self._csorb.BPMsFreq + self._loop_freq = self._csorb.BPMsFreq / 10 self._loop_print_every_num_iter = 200 self._loop_max_orb_distortion = self._csorb.DEF_MAX_ORB_DISTORTION zer = _np.zeros(self._csorb.nr_corrs, dtype=float) @@ -274,7 +274,7 @@ def set_fofb_download_perc(self, value: float): bool: Whether property was set. """ - value = min(max(value / 300, 0), 1) + value = min(max(value / 100, 0), 1) self._download_fofb_kicks_perc = value self.run_callbacks("FOFBDownloadKicksPerc-RB", value * 100) return True diff --git a/siriuspy/siriuspy/sofb/orbit.py b/siriuspy/siriuspy/sofb/orbit.py index a715e8fa4..5a42f8b8d 100644 --- a/siriuspy/siriuspy/sofb/orbit.py +++ b/siriuspy/siriuspy/sofb/orbit.py @@ -367,7 +367,7 @@ def set_test_data_enbl(self, val, is_thread=False): def _prepare_mode(self, oldmode=None): """.""" oldmode = self._mode if oldmode is None else oldmode - self.set_trig_acq_control(self._csorb.TrigAcqCtrl.Abort) + self.set_trig_acq_control(self._csorb.TrigAcqCtrl.Stop) if not self.is_trigmode(): self.acq_config_bpms() @@ -426,12 +426,10 @@ def acq_config_bpms(self, *args): for i, bpm in enumerate(self.bpms): bpm.put_enable = mask[i] if self.is_multiturn(): - bpm.mode = _CSBPM.OpModes.MultiBunch bpm.switching_mode = _CSBPM.SwModes.direct bpm.configure() self.timing.configure() elif self.is_singlepass(): - bpm.mode = _CSBPM.OpModes.MultiBunch bpm.switching_mode = _CSBPM.SwModes.direct bpm.configure() self.timing.configure() @@ -890,9 +888,8 @@ def _update_status(self): bpms = self._get_used_bpms() bpm_conn = all(bpm.connected for bpm in bpms) - bpm_stt = all(bpm.state for bpm in bpms) + status = _util.update_bit(v=status, bit_pos=2, bit_val=not bpm_conn) - status = _util.update_bit(v=status, bit_pos=3, bit_val=not bpm_stt) isok = True if self.is_trigmode(): @@ -904,22 +901,22 @@ def _update_status(self): bpms, ) ) - status = _util.update_bit(v=status, bit_pos=4, bit_val=not isok) + status = _util.update_bit(v=status, bit_pos=3, bit_val=not isok) # Check if test data is disabled isok = all( map(lambda x: x.test_data_enbl == _CSBPM.DsblEnbl.disabled, bpms) ) - status = _util.update_bit(v=status, bit_pos=5, bit_val=not isok) + status = _util.update_bit(v=status, bit_pos=4, bit_val=not isok) # Check if switching sync is enabled isok = all( map(lambda x: x.sw_sync_enbl == _CSBPM.DsblEnbl.enabled, bpms) ) - status = _util.update_bit(v=status, bit_pos=6, bit_val=not isok) + status = _util.update_bit(v=status, bit_pos=5, bit_val=not isok) orb_conn = self._sloworb_raw_pv.connected if self.acc == "SI" else True - status = _util.update_bit(v=status, bit_pos=7, bit_val=not orb_conn) + status = _util.update_bit(v=status, bit_pos=6, bit_val=not orb_conn) self._status = status self.run_callbacks("OrbStatus-Mon", status)