Skip to content
Snippets Groups Projects
Commit 31a1b333 authored by BRONES Romain's avatar BRONES Romain
Browse files

fix: Change access to reforbit

* On FofbCommand side we are in nm
* On Matlab side its in mm
* Add a simple conversion stage
parent 7fa367a1
No related branches found
No related merge requests found
......@@ -172,6 +172,18 @@ class DG_PY_FOFBLegacy(Device):
doc="This attribute is forwarded from Fofb-Manager",
)
xRefOrbit = attribute(
dtype=('DevDouble',),
access=AttrWriteType.READ_WRITE,
max_dim_x=512,
)
zRefOrbit = attribute(
dtype=('DevDouble',),
access=AttrWriteType.READ_WRITE,
max_dim_x=512,
)
xInvRespMatrix = attribute(
dtype=(('DevDouble',),),
access=AttrWriteType.READ_WRITE,
......@@ -196,16 +208,6 @@ class DG_PY_FOFBLegacy(Device):
label="xFofbRunning",
forwarded=True
)
xRefOrbit = attribute(
name="xRefOrbit",
label="xRefOrbit",
forwarded=True
)
zRefOrbit = attribute(
name="zRefOrbit",
label="zRefOrbit",
forwarded=True
)
# ---------------
# General methods
# ---------------
......@@ -475,6 +477,47 @@ class DG_PY_FOFBLegacy(Device):
# PROTECTED REGION END # // DG_PY_FOFBLegacy.bpmCnt_read
def read_xRefOrbit(self):
# PROTECTED REGION ID(DG_PY_FOFBLegacy.xRefOrbit_read) ENABLED START #
"""Return the xRefOrbit attribute."""
try:
ref = self.prx_fofbcommand["x_ref_orbit"].value
self.debug_stream("Read x_ref_orbit from {} :\n{}".format(self.prx_fofbcommand.name(), str(ref)))
except Exception as e:
self.error_stream(str(e))
return np.nan*np.ones(2)
return ref*1e-6
# PROTECTED REGION END # // DG_PY_FOFBLegacy.xRefOrbit_read
def write_xRefOrbit(self, value):
# PROTECTED REGION ID(DG_PY_FOFBLegacy.xRefOrbit_write) ENABLED START #
"""Set the xRefOrbit attribute."""
try:
self.prx_fofbcommand.x_ref_orbit = (value*1e6).astype('int')
except Exception as e:
self.error_stream("Failed to Write ref orbit:\n"+str(e))
# PROTECTED REGION END # // DG_PY_FOFBLegacy.xRefOrbit_write
def read_zRefOrbit(self):
# PROTECTED REGION ID(DG_PY_FOFBLegacy.zRefOrbit_read) ENABLED START #
"""Return the zRefOrbit attribute."""
try:
ref = self.prx_fofbcommand["y_ref_orbit"].value
self.debug_stream("Read y_ref_orbit from {} :\n{}".format(self.prx_fofbcommand.name(), str(ref)))
except Exception:
return np.nan*np.ones(2)
return ref*1e-6
# PROTECTED REGION END # // DG_PY_FOFBLegacy.zRefOrbit_read
def write_zRefOrbit(self, value):
# PROTECTED REGION ID(DG_PY_FOFBLegacy.zRefOrbit_write) ENABLED START #
"""Set the zRefOrbit attribute."""
try:
self.prx_fofbcommand.y_ref_orbit = (value*1e6).astype('int')
except Exception as e:
self.error_stream("Failed to Write ref orbit:\n"+str(e))
# PROTECTED REGION END # // DG_PY_FOFBLegacy.zRefOrbit_write
def read_xInvRespMatrix(self):
#----- PROTECTED REGION ID(DG_PY_FOFBLegacy.xInvRespMatrix_read) ENABLED START -----#attr.set_value(self.attr_xInvRespMatrix_read)
# Read from FofbCommand, reshape before forwarding
......
......@@ -236,6 +236,22 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="This attribute is forwarded from Fofb-Manager" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="xRefOrbit" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="512" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:DoubleType"/>
<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="zRefOrbit" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="512" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:DoubleType"/>
<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="xInvRespMatrix" attType="Image" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="512" maxY="512" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:DoubleType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......@@ -258,12 +274,6 @@
<forwardedAttributes name="xFofbRunning" label="xFofbRunning">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</forwardedAttributes>
<forwardedAttributes name="xRefOrbit" label="xRefOrbit">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</forwardedAttributes>
<forwardedAttributes name="zRefOrbit" label="zRefOrbit">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</forwardedAttributes>
<preferences docHome="../doc/doc_html" makefileHome="$(TANGO_HOME)"/>
</classes>
</pogoDsl:PogoSystem>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment