Skip to content

Commit

Permalink
Merge pull request #755 from lnls-sirius/add-sync-bpm
Browse files Browse the repository at this point in the history
Improve BPM device
  • Loading branch information
xresende authored Nov 1, 2021
2 parents 18af1c8 + 8843089 commit bcbeea7
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
40 changes: 40 additions & 0 deletions siriuspy/siriuspy/devices/bpm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""."""
import time as _time

import numpy as _np

Expand Down Expand Up @@ -50,6 +51,7 @@ class BPM(_Device):
'ACQTriggerDataThres-SP', 'ACQTriggerDataThres-RB',
'ACQTriggerDataPol-Sel', 'ACQTriggerDataPol-Sts',
'ACQTriggerDataHyst-SP', 'ACQTriggerDataHyst-RB',
'SwTagEn-Sel', 'SwTagEn-Sts',
'TbtTagEn-Sel', 'TbtTagEn-Sts',
'Monit1TagEn-Sel', 'Monit1TagEn-Sts',
'MonitTagEn-Sel', 'MonitTagEn-Sts',
Expand Down Expand Up @@ -203,6 +205,16 @@ def tbt_mask_end(self, val):
"""."""
self['TbtDataMaskSamplesEnd-SP'] = val

@property
def fofb_sync_enbl(self):
"""."""
return self['SwTagEn-Sts']

@fofb_sync_enbl.setter
def fofb_sync_enbl(self, val):
"""."""
self['SwTagEn-Sel'] = val

@property
def fofb_rate(self):
"""."""
Expand Down Expand Up @@ -723,3 +735,31 @@ def cmd_turn_off_switching(self):
"""Command Turn off Switching."""
self.switching_mode = _csbpm.SwModes.direct
return self._wait('SwMode-Sts', _csbpm.SwModes.direct)

def cmd_sync_tbt(self):
"""Synchronize TbT acquisitions with Timing System."""
self.tbt_sync_enbl = 1
_time.sleep(0.1)
self.tbt_sync_enbl = 0
return self._wait('TbtTagEn-Sts', 0)

def cmd_sync_fofb(self):
"""Synchronize FOFB acquisitions with Timing System."""
self.fofb_sync_enbl = 1
_time.sleep(0.1)
self.fofb_sync_enbl = 0
return self._wait('SwTagEn-Sts', 0)

def cmd_sync_monit1(self):
"""Synchronize Monit1 acquisitions with Timing System."""
self.monit1_sync_enbl = 1
_time.sleep(0.1)
self.monit1_sync_enbl = 0
return self._wait('Monit1TagEn-Sts', 0)

def cmd_sync_monit(self):
"""Synchronize Monit acquisitions with Timing System."""
self.monit_sync_enbl = 1
_time.sleep(0.1)
self.monit_sync_enbl = 0
return self._wait('Monit1TagEn-Sts', 0)
17 changes: 17 additions & 0 deletions siriuspy/siriuspy/sofb/bpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, name, callback=None):
'ACQTriggerDataPol': _csbpm.Polarity.Positive,
'ACQTriggerDataHyst': 0,
'TbtTagEn': _csbpm.EnbldDsbld.disabled, # Enable TbT sync Timing
'SwTagEn': _csbpm.EnbldDsbld.disabled, # Enable FOFB sync Timing
'Monit1TagEn': _csbpm.EnbldDsbld.disabled,
'MonitTagEn': _csbpm.EnbldDsbld.disabled,
'TbtDataMaskEn': _csbpm.EnbldDsbld.disabled, # Enable use of mask
Expand Down Expand Up @@ -100,6 +101,7 @@ def __init__(self, name, callback=None):
'ACQTriggerDataPol': 'ACQTriggerDataPol-Sel',
'ACQTriggerDataHyst': 'ACQTriggerDataHyst-SP',
'TbtTagEn': 'TbtTagEn-Sel', # Enable TbT sync with timing
'SwTagEn': 'SwTagEn-Sel', # Enable FOFB sync with timing
'Monit1TagEn': 'Monit1TagEn-Sel', # Enable Monit1 sync with timing
'MonitTagEn': 'MonitTagEn-Sel', # Enable Monit sync with timing
'TbtDataMaskEn': 'TbtDataMaskEn-Sel', # Enable use of mask
Expand Down Expand Up @@ -145,6 +147,7 @@ def __init__(self, name, callback=None):
'ACQTriggerDataPol': 'ACQTriggerDataPol-Sts',
'ACQTriggerDataHyst': 'ACQTriggerDataHyst-RB',
'TbtTagEn': 'TbtTagEn-Sts',
'SwTagEn': 'SwTagEn-Sts',
'Monit1TagEn': 'Monit1TagEn-Sts',
'MonitTagEn': 'MonitTagEn-Sts',
'TbtDataMaskEn': 'TbtDataMaskEn-Sts',
Expand Down Expand Up @@ -593,6 +596,20 @@ def tbt_sync_enbl(self, val):
if pvobj.connected:
pvobj.put(val, wait=False)

@property
def fofb_sync_enbl(self):
"""."""
pvobj = self._config_pvs_rb['SwTagEn']
return pvobj.value if pvobj.connected else None

@fofb_sync_enbl.setter
def fofb_sync_enbl(self, val):
"""."""
pvobj = self._config_pvs_sp['SwTagEn']
self._config_ok_vals['SwTagEn'] = val
if pvobj.connected:
pvobj.put(val, wait=False)

@property
def monit1_sync_enbl(self):
"""."""
Expand Down
4 changes: 4 additions & 0 deletions siriuspy/siriuspy/sofb/orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,14 @@ def acq_config_bpms(self, *args):

def _synchronize_bpms(self):
for bpm in self.bpms:
bpm.tbt_sync_enbl = _csbpm.EnbldDsbld.enabled
bpm.fofb_sync_enbl = _csbpm.EnbldDsbld.enabled
bpm.monit1_sync_enbl = _csbpm.EnbldDsbld.enabled
bpm.monit_sync_enbl = _csbpm.EnbldDsbld.enabled
_time.sleep(0.5)
for bpm in self.bpms:
bpm.tbt_sync_enbl = _csbpm.EnbldDsbld.disabled
bpm.fofb_sync_enbl = _csbpm.EnbldDsbld.disabled
bpm.monit_sync_enbl = _csbpm.EnbldDsbld.disabled
bpm.monit1_sync_enbl = _csbpm.EnbldDsbld.disabled

Expand Down

0 comments on commit bcbeea7

Please sign in to comment.