Skip to content
Snippets Groups Projects
Commit 27cc0805 authored by Giulio Gaio's avatar Giulio Gaio
Browse files

Cration of the server class

parent a5a1d9e2
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
#
# This file is part of the EEHGMaster project
#
#
#
# Distributed under the terms of the GPL license.
# See LICENSE.txt for more info.
""" EEHG Master
Tango device server for EEHG operation for FERMI
"""
# PyTango imports
import tango
from tango import DebugIt
from tango.server import run
from tango.server import Device
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
# PROTECTED REGION ID(EEHGMaster.additionnal_import) ENABLED START #
# PROTECTED REGION END # // EEHGMaster.additionnal_import
__all__ = ["EEHGMaster", "main"]
class EEHGMaster(Device):
"""
Tango device server for EEHG operation for FERMI
**Properties:**
- Device Property
SuperGapDevice
- SuperGap tango device name
- Type:'DevString'
"""
# PROTECTED REGION ID(EEHGMaster.class_variable) ENABLED START #
# PROTECTED REGION END # // EEHGMaster.class_variable
# -----------------
# Device Properties
# -----------------
SuperGapDevice = device_property(
dtype='DevString',
)
# ----------
# Attributes
# ----------
fel_mode = attribute(
dtype='DevString',
access=AttrWriteType.READ_WRITE,
memorized=True,
hw_memorized=True,
doc="FEL operation mode:\nEEHG\nHGHG1\nHGHG1*\nHGHG2\n\nSpecify how the FEL need to be operated. EEHG is clear. \nHGHG1, means that one use seed1 on mod1 to to standard HGHG. \nHGHG1*, means that one use seed1 on mod2 to to standard HGHG. \nHGHG2 means that seed2 is used on mod2 for standard HGHG. \nThis setting define the method to be used for calculating the required configuration\n",
)
# ---------------
# General methods
# ---------------
def init_device(self):
"""Initialises the attributes and properties of the EEHGMaster."""
Device.init_device(self)
# PROTECTED REGION ID(EEHGMaster.init_device) ENABLED START #
self._fel_mode = ''
# PROTECTED REGION END # // EEHGMaster.init_device
def always_executed_hook(self):
"""Method always executed before any TANGO command is executed."""
# PROTECTED REGION ID(EEHGMaster.always_executed_hook) ENABLED START #
# PROTECTED REGION END # // EEHGMaster.always_executed_hook
def delete_device(self):
"""Hook to delete resources allocated in init_device.
This method allows for any memory or other resources allocated in the
init_device method to be released. This method is called by the device
destructor and by the device Init command.
"""
# PROTECTED REGION ID(EEHGMaster.delete_device) ENABLED START #
# PROTECTED REGION END # // EEHGMaster.delete_device
# ------------------
# Attributes methods
# ------------------
def read_fel_mode(self):
# PROTECTED REGION ID(EEHGMaster.fel_mode_read) ENABLED START #
"""Return the fel_mode attribute."""
return self._fel_mode
# PROTECTED REGION END # // EEHGMaster.fel_mode_read
def write_fel_mode(self, value):
# PROTECTED REGION ID(EEHGMaster.fel_mode_write) ENABLED START #
"""Set the fel_mode attribute."""
pass
# PROTECTED REGION END # // EEHGMaster.fel_mode_write
# --------
# Commands
# --------
@command(
)
@DebugIt()
def Calculate(self):
# PROTECTED REGION ID(EEHGMaster.Calculate) ENABLED START #
"""
:return:None
"""
pass
# PROTECTED REGION END # // EEHGMaster.Calculate
def is_Calculate_allowed(self):
# PROTECTED REGION ID(EEHGMaster.is_Calculate_allowed) ENABLED START #
return self.get_state() not in [DevState.RUNNING,DevState.MOVING]
# PROTECTED REGION END # // EEHGMaster.is_Calculate_allowed
# ----------
# Run server
# ----------
def main(args=None, **kwargs):
"""Main function of the EEHGMaster module."""
# PROTECTED REGION ID(EEHGMaster.main) ENABLED START #
return run((EEHGMaster,), args=args, **kwargs)
# PROTECTED REGION END # // EEHGMaster.main
if __name__ == '__main__':
main()
<?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="EEHGMaster" pogoRevision="9.6">
<description description="Tango device server for EEHG operation for FERMI" title="EEHG Master" sourcePath="/home/giulio.gaio/src/gitlab/cs/ds/eehg-master/src" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at elettra.eu - mauro.trovo" author="mauro.trovo" emailDomain="elettra.eu" classFamily="Calculation" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<deviceProperties name="SuperGapDevice" description="SuperGap tango device name">
<type xsi:type="pogoDsl:StringType"/>
<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"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Calculate" description="" execMethod="calculate" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<excludedStates>RUNNING</excludedStates>
<excludedStates>MOVING</excludedStates>
</commands>
<attributes name="fel_mode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<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="FEL operation mode:&#xA;EEHG&#xA;HGHG1&#xA;HGHG1*&#xA;HGHG2&#xA;&#xA;Specify how the FEL need to be operated. EEHG is clear. &#xA;HGHG1, means that one use seed1 on mod1 to to standard HGHG. &#xA;HGHG1*, means that one use seed1 on mod2 to to standard HGHG. &#xA;HGHG2 means that seed2 is used on mod2 for standard HGHG. &#xA;This setting define the method to be used for calculating the required configuration&#xA;" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<states name="ON" description="Everything os OK">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="RUNNING" description="Server is calculating the nel FEL parameters">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="MOVING" description="The server is applying the settings on the real machine">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="FAULT" description="Wavelength change failed">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="ALARM" description="No solutions avaliable">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.3.4/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment