From e87e21404b092caa2f55da8c74a6d1e5506a03f1 Mon Sep 17 00:00:00 2001 From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl> Date: Tue, 20 Oct 2020 16:25:18 +0200 Subject: [PATCH] Add states and first MP/CP --- RCUSCC-DS/RCUSCC.py | 67 +++++++++++++++++++++++++++++++++++++++++++- RCUSCC-DS/RCUSCC.xmi | 45 ++++++++++++++++++++++++++++- 2 files changed, 110 insertions(+), 2 deletions(-) diff --git a/RCUSCC-DS/RCUSCC.py b/RCUSCC-DS/RCUSCC.py index 27536abad..525851439 100644 --- a/RCUSCC-DS/RCUSCC.py +++ b/RCUSCC-DS/RCUSCC.py @@ -16,7 +16,8 @@ import tango from tango import DebugIt from tango.server import run from tango.server import Device -from tango.server import command +from tango.server import attribute, command +from tango.server import device_property from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType # Additional import @@ -28,10 +29,52 @@ __all__ = ["RCUSCC", "main"] class RCUSCC(Device): """ + + **Properties:** + + - Device Property + OPC_Server_Name + - Type:'DevString' + OPC_Server_Port + - Type:'DevULong' + OPC_Time_Out + - Type:'DevDouble' """ # PROTECTED REGION ID(RCUSCC.class_variable) ENABLED START # # PROTECTED REGION END # // RCUSCC.class_variable + # ----------------- + # Device Properties + # ----------------- + + OPC_Server_Name = device_property( + dtype='DevString', + mandatory=True + ) + + OPC_Server_Port = device_property( + dtype='DevULong', + mandatory=True + ) + + OPC_Time_Out = device_property( + dtype='DevDouble', + mandatory=True + ) + + # ---------- + # Attributes + # ---------- + + time_offset_RW = attribute( + dtype='DevLong64', + access=AttrWriteType.READ_WRITE, + ) + + time_offset_R = attribute( + dtype='DevLong64', + ) + # --------------- # General methods # --------------- @@ -56,6 +99,28 @@ class RCUSCC(Device): """ # PROTECTED REGION ID(RCUSCC.delete_device) ENABLED START # # PROTECTED REGION END # // RCUSCC.delete_device + # ------------------ + # Attributes methods + # ------------------ + + def read_time_offset_RW(self): + # PROTECTED REGION ID(RCUSCC.time_offset_RW_read) ENABLED START # + """Return the time_offset_RW attribute.""" + return self._time_offset__rw + # PROTECTED REGION END # // RCUSCC.time_offset_RW_read + + def write_time_offset_RW(self, value): + # PROTECTED REGION ID(RCUSCC.time_offset_RW_write) ENABLED START # + """Set the time_offset_RW attribute.""" + pass + # PROTECTED REGION END # // RCUSCC.time_offset_RW_write + + def read_time_offset_R(self): + # PROTECTED REGION ID(RCUSCC.time_offset_R_read) ENABLED START # + """Return the time_offset_R attribute.""" + return self._time_offset__r + # PROTECTED REGION END # // RCUSCC.time_offset_R_read + # -------- # Commands # -------- diff --git a/RCUSCC-DS/RCUSCC.xmi b/RCUSCC-DS/RCUSCC.xmi index 7cc84cea7..72803e959 100644 --- a/RCUSCC-DS/RCUSCC.xmi +++ b/RCUSCC-DS/RCUSCC.xmi @@ -1,10 +1,22 @@ <?xml version="1.0" encoding="ASCII"?> <pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl"> <classes name="RCUSCC" pogoRevision="9.6"> - <description description="" title="RCU-SCC Device Server for LOFAR2.0" sourcePath="/opt/tango/RCUSCC-DS" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="APACHE" copyright="" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false"> + <description description="" title="RCU-SCC Device Server for LOFAR2.0" sourcePath="/opt/tango/RCUSCC-DS" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="APACHE" copyright="" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <inheritances classname="Device_Impl" sourcePath=""/> <identification contact="at astron.nl - jurges" author="jurges" emailDomain="astron.nl" classFamily="OtherInstruments" siteSpecific="" platform="Unix Like" bus="Socket" manufacturer="ASTRON" reference=""/> </description> + <deviceProperties name="OPC_Server_Name" mandatory="true" description=""> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </deviceProperties> + <deviceProperties name="OPC_Server_Port" mandatory="true" description=""> + <type xsi:type="pogoDsl:UIntType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </deviceProperties> + <deviceProperties name="OPC_Time_Out" mandatory="true" description=""> + <type xsi:type="pogoDsl:DoubleType"/> + <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"/> @@ -23,6 +35,37 @@ </argout> <status abstract="true" inherited="true" concrete="true"/> </commands> + <attributes name="time_offset_RW" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:LongType"/> + <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="time_offset_R" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:LongType"/> + <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> + <states name="ON" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="OFF" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="FAULT" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="ALARM" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="STANDBY" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> <preferences docHome="./doc_html" makefileHome="/usr/local/share/pogo/preferences"/> </classes> </pogoDsl:PogoSystem> -- GitLab