Skip to content
Snippets Groups Projects
Commit 3a6b1e89 authored by Samuel GARNIER's avatar Samuel GARNIER
Browse files

Add success boolean, remove argin on align

* Attributes for command sync, start, align success
* Move the argin of align_fa to a property
parent a8b1a1ce
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,9 @@ class DG_PY_FOFBTool(Device):
includeLBP
- Do not include LBP in the com.\nThis will skip the starting of comlbp during the start command.
- Type:'DevBoolean'
align_cellnode
- Index of cellnode used for sequence align. Counting from index 0.
- Type:'DevUShort'
"""
# PROTECTED REGION ID(DG_PY_FOFBTool.class_variable) ENABLED START #
......@@ -198,6 +201,11 @@ class DG_PY_FOFBTool(Device):
mandatory=True
)
align_cellnode = device_property(
dtype='DevUShort',
mandatory=True
)
# ----------
# Attributes
# ----------
......@@ -214,6 +222,18 @@ class DG_PY_FOFBTool(Device):
dtype='DevString',
)
success_start = attribute(
dtype='DevBoolean',
)
success_align = attribute(
dtype='DevBoolean',
)
success_sync = attribute(
dtype='DevBoolean',
)
logs = attribute(
dtype=('DevString',),
max_dim_x=1024,
......@@ -228,6 +248,9 @@ class DG_PY_FOFBTool(Device):
Device.init_device(self)
#----- PROTECTED REGION ID(DG_PY_FOFBTool.init_device) ENABLED START -----#
self.lock = threading.Lock()
self._success_start=False
self._success_align=False
self._success_sync=False
if not self.lock.acquire(False):
self.error_stream("Device is running, skiping command")
......@@ -299,6 +322,24 @@ class DG_PY_FOFBTool(Device):
return self._last_start
# PROTECTED REGION END # // DG_PY_FOFBTool.lastStart_read
def read_success_start(self):
# PROTECTED REGION ID(DG_PY_FOFBTool.success_start_read) ENABLED START #
"""Return the success_start attribute."""
return self._success_start
# PROTECTED REGION END # // DG_PY_FOFBTool.success_start_read
def read_success_align(self):
# PROTECTED REGION ID(DG_PY_FOFBTool.success_align_read) ENABLED START #
"""Return the success_align attribute."""
return self._success_align
# PROTECTED REGION END # // DG_PY_FOFBTool.success_align_read
def read_success_sync(self):
# PROTECTED REGION ID(DG_PY_FOFBTool.success_sync_read) ENABLED START #
"""Return the success_sync attribute."""
return self._success_sync
# PROTECTED REGION END # // DG_PY_FOFBTool.success_sync_read
def read_logs(self):
# PROTECTED REGION ID(DG_PY_FOFBTool.logs_read) ENABLED START #
"""Return the logs attribute."""
......@@ -431,6 +472,7 @@ class DG_PY_FOFBTool(Device):
def target():
self.info_stream("Starting all")
self._success_start = False
self.d_status["nodes"]="FofbNode: starting"
success=True
......@@ -453,6 +495,7 @@ class DG_PY_FOFBTool(Device):
if success:
self.d_status["nodes"]="FofbNode: started"
self._success_start=True
else:
self.d_status["nodes"]="FofbNode: start failed"
self.set_state(tango.DevState.ON)
......@@ -486,6 +529,7 @@ class DG_PY_FOFBTool(Device):
def target():
db = tango.Database()
self._success_sync=False
self.d_status["synchronize"]="Synchronize: starting"
if self.includeLBP:
self.d_status["align"]="FA Align: Not done since sync"
......@@ -507,6 +551,7 @@ class DG_PY_FOFBTool(Device):
success=FofbTool.Operation.sync_bpm(bpmidlist, lbpevrx, tlocal, self.tangopath_centraltiming)
if success:
self._success_sync=True
self.d_status["synchronize"]="Synchronize: done"
else:
self.d_status["synchronize"]="Synchronize: failed"
......@@ -523,28 +568,20 @@ class DG_PY_FOFBTool(Device):
# PROTECTED REGION END # // DG_PY_FOFBTool.sync
@command(
dtype_in='DevLong',
doc_in="cellnode",
)
@DebugIt()
def align_fa(self, argin):
def align_fa(self):
# PROTECTED REGION ID(DG_PY_FOFBTool.align_fa) ENABLED START #
"""
:param argin: 'DevLong'
cellnode
:return:None
"""
if not self.lock.acquire(False):
self.error_stream("Device is running, skiping command")
return
cn=self.tangopath_cellnode[argin]
cn=self.tangopath_cellnode[self.align_cellnode]
def target(cn):
self.debug_stream("Launch align FA on {}".format(cn))
self._success_align=False
try:
seqoffset = FofbTool.Operation.align_ccn(cn, 0)
......@@ -558,6 +595,7 @@ class DG_PY_FOFBTool(Device):
for cn in self.tangopath_cellnode:
FofbTool.Configuration.cellnode_configure_comlbp(cn, seqoffset)
self._success_align = True
self.d_status["align"]="FA Align: OK"
self.set_state(tango.DevState.ON)
......
......@@ -69,6 +69,10 @@
<type xsi:type="pogoDsl:BooleanType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="align_cellnode" mandatory="true" description="Index of cellnode used for sequence align. Counting from index 0.">
<type xsi:type="pogoDsl:UShortType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
......@@ -125,7 +129,7 @@
</commands>
<commands name="align_fa" description="" execMethod="align_fa" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="cellnode">
<type xsi:type="pogoDsl:IntType"/>
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
......@@ -174,6 +178,30 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="success_start" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="success_align" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="success_sync" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="logs" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="1024" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment