Skip to content

Commit

Permalink
Merge pull request #909 from lnls-sirius/add-lienergy-device
Browse files Browse the repository at this point in the history
Add LIEnergy device
  • Loading branch information
fernandohds564 authored Feb 10, 2023
2 parents 3af9339 + d32a8a3 commit 7debfb5
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
4 changes: 3 additions & 1 deletion siriuspy/siriuspy/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
from .timing import EVG, Event, Trigger, HLTiming
from .tune import TuneFrac, TuneProc, Tune, TuneCorr
from .dvf import DVF
from .lienergy import LIEnergy


del device, bpm, dcct, egun, ict, lillrf, modltr
del pwrsupply, posang, psconv, pssofb, rf, injsys, injctrl
del screen, tune, sofb, timing, syncd, energy
del ids, currinfo, bbb, machshift, dvf
del ids, currinfo, bbb, machshift, dvf, lienergy
67 changes: 67 additions & 0 deletions siriuspy/siriuspy/devices/lienergy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""."""

from .device import Device as _Device


class LIEnergy(_Device):
"""Linac Energy Measurement Device."""

class DEVICES:
"""Devices names."""

LI = 'LI-Glob:AP-MeasEnergy'
ALL = (LI, )

_properties = (
'Dispersion-SP', 'Dispersion-RB',
'IntDipole-Mon', 'Energy-Mon', 'Spread-Mon',
'MeasureCtrl-Sel', 'MeasureCtrl-Sts')

def __init__(self, devname=None):
"""."""
# check if device exists
devname = devname if devname else self.DEVICES.LI
if devname not in LIEnergy.DEVICES.ALL:
raise NotImplementedError(devname)

# call base class constructor
super().__init__(devname, properties=LIEnergy._properties)

@property
def dispersion(self):
"""."""
return self['Dispersion-RB']

@dispersion.setter
def dispersion(self, val):
self['Dispersion-SP'] = val

@property
def intdipole(self):
"""."""
return self['IntDipole-Mon']

@property
def energy(self):
"""."""
return self['Energy-Mon']

@property
def energy_spread(self):
"""."""
return self['Spread-Mon']

@property
def is_measuring(self):
"""."""
return self['MeasureCtrl-Sts']

def cmd_turn_on_measurement(self, timeout=10):
"""."""
self['MeasureCtrl-Sel'] = 1
return self._wait('MeasureCtrl-Sts', 1, timeout=timeout)

def cmd_turn_off_measurement(self, timeout=10):
"""."""
self['MeasureCtrl-Sel'] = 0
return self._wait('MeasureCtrl-Sts', 0, timeout=timeout)

0 comments on commit 7debfb5

Please sign in to comment.