diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..65c5ca88a67c30becee01c5a8816d964b03862f9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/src/DimFBEinterf.py b/src/DimFBEinterf.py new file mode 100644 index 0000000000000000000000000000000000000000..ddaa642d5520ec55edb0ef4796931d22aea378e6 --- /dev/null +++ b/src/DimFBEinterf.py @@ -0,0 +1,114 @@ +######################################### +### DimFBEinterf.py - threaded - StCl ### +######################################### + +import threading +import time +import socket +import sys + +aval = 1 + +cr = '\r' +lf = '\n' +crlf = cr + lf + +tempval = 1000 +ScanVal = 0 + +RcvLen = 50 + +def Test(inval): + try: + return inval + except: + print "Error: Test error" + + +def SendAndGetT(invals, setvals, ConvFun, RDBstuff): + try: + global aval + if aval == 1: + aval = 0 + + else: + RDBstuff('SendAndGetT socket locked', '*', '@') + return -20 + + th = threading.Thread(target=SendAndGet, args=(invals, setvals, ConvFun, RDBstuff )) + th.start() + return 1 + except: + RDBstuff('SendAndGetT threading error', '*', 'X') + aval = 1 + return -30 + + +def SendAndGet(invals, setvals, ConvFun, RDBstuff): + global aval + try: + IP = setvals[0] + PORT = int(setvals[1]) + server_address = (IP, PORT) + except: + RDBstuff('SendAndGet socket wrong params', '*', 'X') + return -1 + + try: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.settimeout(10) + except: + RDBstuff('SendAndGet socket error', '*', 'X') + aval = 1 + return -2 + + try: + sock.connect(server_address) + + except: + RDBstuff('SendAndGet connect error','*','X') + sock.close() + aval = 1 + return -3 + + try: + ArgNum = len(invals) + message = invals[0] + except: + RDBstuff('SendAndGet command error','*','X') + sock.close() + aval = 1 + return -4 + + try: + sock.sendall(message.encode()) + except: + RDBstuff('SendAndGet sendall error','*','X') + sock.close() + aval = 1 + return -5 + + for answs in range(1, ArgNum): + receiving = True + received = 0 + buf = '' + while receiving: + data = sock.recv(RcvLen) + received += len(data) + buf = buf + data.decode() + if (buf.find(crlf) != -1): + receiving = False + RDBstuff('*',buf,'*') + + sock.close() + aval = 1 + tempval = ConvFun(buf) + RDBstuff('*','*', tempval) + return 0 + + + + + + + diff --git a/src/fbelt-srv b/src/fbelt-srv new file mode 100755 index 0000000000000000000000000000000000000000..5f87a38990d53d4551b89024bbdbd9ae98194a9a --- /dev/null +++ b/src/fbelt-srv @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# +# Template of main python server wrapper +# Solves the problem of pogo generated Tango server file names which are not easily handled by databeds and Starter. +# 1) copy this template in the server directoy using the canonical server (executable) name: cp ../python-srv.template myclass-srv +# 2) chmod +x myclass-srv +# 3) edit myclass-srv ename MyClass to the actual class name of the python Tango server (you can also clean up these notes) +# + + +from fbelt import main +if __name__ == '__main__': + main() diff --git a/src/fbelt.py b/src/fbelt.py new file mode 100644 index 0000000000000000000000000000000000000000..1067db172d05c11f3c77cb5ab372d156f6b6779a --- /dev/null +++ b/src/fbelt.py @@ -0,0 +1,1290 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + + +# ############################################################################ +# license : +# ============================================================================ +# +# File : fbelt.py +# +# Project : DimTel FBE-LTE controller +# +# This file is part of Tango device class. +# +# Tango is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Tango is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Tango. If not, see <http://www.gnu.org/licenses/>. +# +# +# $Author : stefano.cleva$ +# +# $Revision : $ +# +# $Date : $ +# +# $HeadUrl : $ +# ============================================================================ +# This file is generated by POGO +# (Program Obviously used to Generate tango Object) +# ############################################################################ + +__all__ = ["fbelt", "fbeltClass", "main"] + +__docformat__ = 'restructuredtext' + +import PyTango +import sys +# Add additional import +#----- PROTECTED REGION ID(fbelt.additionnal_import) ENABLED START -----# + +import DimFBEinterf +import phaseFitter + +#----- PROTECTED REGION END -----# // fbelt.additionnal_import + +# Device States Description +# ON : +# MOVING : +# FAULT : + + +class fbelt (PyTango.Device_4Impl): + """DimTel FBE-LTE controller""" + + # -------- Add you global variables here -------------------------- + #----- PROTECTED REGION ID(fbelt.global_variables) ENABLED START -----# + + + interpdat = [] + + def CheckAttdB(self, a): + val = a * 2 + check = int(val) + diff = abs(check - val) + if (diff != 0.0): + # self.set_status('Att Out Of Range') + return -1 + + if (not((0 <= check) and (check <= 63))): + # self.set_status('Att Out Of Range') + return -2 + + return check + + def BuildConvTab(self): + global interpdat + interpdat = phaseFitter.interpol() + + def RDBstuffI(self, a,b,c): + #print('RDBstuffI: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.attr_ID_read = c + self.set_state(PyTango.DevState.ON) + self.set_status('Get ID OK') + + def RDBstuffHP(self, a,b,c): + #print('RDBstuffHP: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'pha:OK' in c: + self.attr_HorizontalPhase_read = self.SetHP + self.set_state(PyTango.DevState.ON) + self.set_status('Hor Phase Set OK') + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Hor Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffHPDeg(self, a,b,c): + #print('RDBstuffHPDeg: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + self.set_status(a) + if 'pha:OK' in c: + self.attr_HorizontalPhase_read = self.SetHP + self.attr_HorizontalPhaseDeg_read = self.SetHPDeg + self.set_status('Hor Phase Set OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Hor Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffVP(self, a,b,c): + #print('RDBstuffVP: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'pha:OK' in c: + self.attr_VerticalPhase_read = self.SetVP + self.set_status('Ver Phase Set OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Ver Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffVPDeg(self, a,b,c): + #print('RDBstuffVPDeg: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + self.set_status(a) + if 'pha:OK' in c: + self.attr_VerticalPhase_read = self.SetVP + self.attr_VerticalPhaseDeg_read = self.SetVPDeg + self.set_status('Ver Phase Set OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Ver Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffLP(self, a,b,c): + #print('RDBstuffLP: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'pha:OK' in c: + self.attr_LongitudinalPhase_read = self.SetLP + self.set_state(PyTango.DevState.ON) + self.set_status('Long Phase Set OK') + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Long Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffLPDeg(self, a,b,c): + #print('RDBstuffLPDeg: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + self.set_status(a) + if 'pha:OK' in c: + self.attr_LongitudinalPhase_read = self.SetLP + self.attr_LongitudinalPhaseDeg_read = self.SetLPDeg + self.set_status('Long Phase Set OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Long Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffBEP(self, a,b,c): + #print('RDBstuffBEP: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'pha:OK' in c: + self.attr_BackEndPhase_read = self.SetBEP + self.set_state(PyTango.DevState.ON) + self.set_status('BE Phase Set OK') + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('BE Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffBEPDeg(self, a,b,c): + #print('RDBstuffBEPDeg: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + self.set_status(a) + if 'pha:OK' in c: + self.attr_BackEndPhase_read = self.SetBEP + self.attr_BackEndPhaseDeg_read = self.SetBEPDeg + self.set_status('BE Set Phase OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('BE Phase Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffHAdB(self, a,b,c): + #print('RDBstuffHA_dB: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_HorizontalAttenuation_read = self.SetHA + self.attr_HorizontalAttenuation_dB_read = self.SetHAdB + self.set_status('Hor Atten dB OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Hor Atten dB Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffHA(self, a,b,c): + #print('RDBstuffHA-TI: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_HorizontalAttenuation_read = self.SetHA + self.set_status('Hor Atten OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Hor Atten Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffVAdB(self, a,b,c): + #print('RDBstuffVA_dB: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_VerticalAttenuation_read = self.SetVA + self.attr_VerticalAttenuation_dB_read = self.SetVAdB + self.set_status('Ver Atten dB OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Ver Atten dB Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffVA(self, a,b,c): + #print('RDBstuffVA-TI: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_VerticalAttenuation_read = self.SetVA + self.set_status('Ver Atten OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Ver Atten Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffLAdB(self, a,b,c): + #print('RDBstuffLA_dB: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_LongitudinalAttenuation_read = self.SetLA + self.attr_LongitudinalAttenuation_dB_read = self.SetLAdB + self.set_status('Long Atten dB OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Long Atten dB Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffLA(self, a,b,c): + #print('RDBstuffLA-TI: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_LongitudinalAttenuation_read = self.SetLA + self.set_status('Long Atten OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('Long Atten Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffBEAdB(self, a,b,c): + #print('RDBstuffBEA_dB: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_BackEndAttenuation_read = self.SetBEA + self.attr_BackEndAttenuation_dB_read = self.SetBEAdB + self.set_status('BE Atten dB OK') + self.set_state(PyTango.DevState.ON) + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('BE Atten dB Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffBEA(self, a,b,c): + #print('RDBstuffBEA-TI: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if 'att:OK' in c: + self.attr_BackEndAttenuation_read = self.SetBEA + self.set_state(PyTango.DevState.ON) + self.set_status('BE Atten OK') + elif '*' in c: + self.set_state(PyTango.DevState.MOVING) + self.set_status('') + elif 'X' in c: + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + elif '@' in c: + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + else: + self.set_status('BE Atten Out Of Range') + self.set_state(PyTango.DevState.ALARM) + + def RDBstuffT(self, a,b,c): + #print('RDBstuffT: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if (c == 'X'): + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + return + if (c == '@'): + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + return + if ((a == '*') and (b == '*')): + self.attr_Temperature_read = c + self.set_status('TempMeasCompleted') + self.set_state(PyTango.DevState.ON) + + def RDBstuffR(self, a,b,c): + #print('RDBstuffR: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if (c == 'X'): + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + return + if (c == '@'): + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + return + self.attr_RPM_read = c + self.set_state(PyTango.DevState.ON) + self.set_status('RPM OK') + + def PassThrough(self, val): + return val + + def ScaleTemp(self, val): + tempval = float(val) + tempval = tempval/16 + return tempval + + def ScaleRPM(self, val): + tempval = float(val) + tempval = tempval * 30 + return int(tempval) + + def RDBstuffOWid(self, a,b,c): + #print('RDBstuffOW: %s %s %s' %(a, b, c)) + self.error = a + self.status = b + if (c == 'X'): + self.set_status(a) + self.set_state(PyTango.DevState.FAULT) + return + if (c == '@'): + self.set_status(a) + self.set_state(PyTango.DevState.MOVING) + return + + self.attr_OneWireID_read = c #eg: '2493130903606263845' + self.set_state(PyTango.DevState.ON) + self.set_status('Get OW OK') + + + #----- PROTECTED REGION END -----# // fbelt.global_variables + + def __init__(self, cl, name): + PyTango.Device_4Impl.__init__(self,cl,name) + self.debug_stream("In __init__()") + fbelt.init_device(self) + #----- PROTECTED REGION ID(fbelt.__init__) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.__init__ + + def delete_device(self): + self.debug_stream("In delete_device()") + #----- PROTECTED REGION ID(fbelt.delete_device) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.delete_device + + def init_device(self): + self.debug_stream("In init_device()") + self.get_device_properties(self.get_device_class()) + self.attr_Temperature_read = 0.0 + self.attr_RPM_read = 0 + self.attr_ID_read = "" + self.attr_HorizontalPhase_read = 0 + self.attr_VerticalPhase_read = 0 + self.attr_LongitudinalPhase_read = 0 + self.attr_BackEndPhase_read = 0 + self.attr_HorizontalAttenuation_read = 0 + self.attr_VerticalAttenuation_read = 0 + self.attr_LongitudinalAttenuation_read = 0 + self.attr_BackEndAttenuation_read = 0 + self.attr_IP_read = "" + self.attr_Port_read = "" + self.attr_HorizontalPhaseDeg_read = 0 + self.attr_VerticalPhaseDeg_read = 0 + self.attr_LongitudinalPhaseDeg_read = 0 + self.attr_BackEndPhaseDeg_read = 0 + self.attr_OneWireID_read = "" + self.attr_HorizontalAttenuation_dB_read = 0.0 + self.attr_VerticalAttenuation_dB_read = 0.0 + self.attr_BackEndAttenuation_dB_read = 0.0 + self.attr_LongitudinalAttenuation_dB_read = 0.0 + #----- PROTECTED REGION ID(fbelt.init_device) ENABLED START -----# + self.BuildConvTab() + self.attr_Temperature_read = '---' + self.attr_RPM_read = '---' + self.attr_ID_read = '---' + self.value = '' + self.error = '' + self.status = '' + self.SetHP = 0 + self.SetVP = 0 + self.SetLP = 0 + self.SetBEP = 0 + self.SetHPDeg = 0 + self.SetVPDeg = 0 + self.SetLPDeg = 0 + self.SetBEPDeg = 0 + self.SetHA = 0 + self.SetVA = 0 + self.SetLA = 0 + self.SetBEA = 0 + self.SetHAdB = 0 + self.SetVAdB = 0 + self.SetLAdB = 0 + self.SetBEAdB = 0 + + #print self.device_property_list + #print self.device_property_list['DeviceIP'] + #print self.device_property_list['DevicePort'] + + self.IP = self.device_property_list['DeviceIP'][2] + self.Port = self.device_property_list['DevicePort'][2] + self.attr_IP_read = self.IP + self.attr_Port_read = self.Port + self.set_status('Init Completed') + self.set_state(PyTango.DevState.ON) + + #----- PROTECTED REGION END -----# // fbelt.init_device + + def always_executed_hook(self): + self.debug_stream("In always_excuted_hook()") + #----- PROTECTED REGION ID(fbelt.always_executed_hook) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.always_executed_hook + + # ------------------------------------------------------------------------- + # fbelt read/write attribute methods + # ------------------------------------------------------------------------- + + def read_Temperature(self, attr): + self.debug_stream("In read_Temperature()") + #----- PROTECTED REGION ID(fbelt.Temperature_read) ENABLED START -----# + attr.set_value(self.attr_Temperature_read) + + #----- PROTECTED REGION END -----# // fbelt.Temperature_read + + def read_RPM(self, attr): + self.debug_stream("In read_RPM()") + #----- PROTECTED REGION ID(fbelt.RPM_read) ENABLED START -----# + attr.set_value(self.attr_RPM_read) + + #----- PROTECTED REGION END -----# // fbelt.RPM_read + + def read_ID(self, attr): + self.debug_stream("In read_ID()") + #----- PROTECTED REGION ID(fbelt.ID_read) ENABLED START -----# + attr.set_value(self.attr_ID_read) + + #----- PROTECTED REGION END -----# // fbelt.ID_read + + def read_HorizontalPhase(self, attr): + self.debug_stream("In read_HorizontalPhase()") + #----- PROTECTED REGION ID(fbelt.HorizontalPhase_read) ENABLED START -----# + attr.set_value(self.attr_HorizontalPhase_read) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalPhase_read + + def write_HorizontalPhase(self, attr): + self.debug_stream("In write_HorizontalPhase()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.HorizontalPhase_write) ENABLED START -----# + message = 'PHA:F:' + str(data) +'\r' + self.SetHP = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffHP) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalPhase_write + + def read_VerticalPhase(self, attr): + self.debug_stream("In read_VerticalPhase()") + #----- PROTECTED REGION ID(fbelt.VerticalPhase_read) ENABLED START -----# + attr.set_value(self.attr_VerticalPhase_read) + + #----- PROTECTED REGION END -----# // fbelt.VerticalPhase_read + + def write_VerticalPhase(self, attr): + self.debug_stream("In write_VerticalPhase()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.VerticalPhase_write) ENABLED START -----# + message = 'PHA:G:' + str(data) +'\r' + self.SetVP = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffVP) + #----- PROTECTED REGION END -----# // fbelt.VerticalPhase_write + + def read_LongitudinalPhase(self, attr): + self.debug_stream("In read_LongitudinalPhase()") + #----- PROTECTED REGION ID(fbelt.LongitudinalPhase_read) ENABLED START -----# + attr.set_value(self.attr_LongitudinalPhase_read) + + #----- PROTECTED REGION END -----# // fbelt.LongitudinalPhase_read + + def write_LongitudinalPhase(self, attr): + self.debug_stream("In write_LongitudinalPhase()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.LongitudinalPhase_write) ENABLED START -----# + message = 'PHA:H:' + str(data) +'\r' + self.SetLP = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffLP) + #----- PROTECTED REGION END -----# // fbelt.LongitudinalPhase_write + + def read_BackEndPhase(self, attr): + self.debug_stream("In read_BackEndPhase()") + #----- PROTECTED REGION ID(fbelt.BackEndPhase_read) ENABLED START -----# + attr.set_value(self.attr_BackEndPhase_read) + + #----- PROTECTED REGION END -----# // fbelt.BackEndPhase_read + + def write_BackEndPhase(self, attr): + self.debug_stream("In write_BackEndPhase()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.BackEndPhase_write) ENABLED START -----# + message = 'PHA:E:' + str(data) +'\r' + self.SetBEP = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffBEP) + #----- PROTECTED REGION END -----# // fbelt.BackEndPhase_write + + def read_HorizontalAttenuation(self, attr): + self.debug_stream("In read_HorizontalAttenuation()") + #----- PROTECTED REGION ID(fbelt.HorizontalAttenuation_read) ENABLED START -----# + attr.set_value(self.attr_HorizontalAttenuation_read) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalAttenuation_read + + def write_HorizontalAttenuation(self, attr): + self.debug_stream("In write_HorizontalAttenuation()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.HorizontalAttenuation_write) ENABLED START -----# + message = 'ATT:H:' + str(data) +'\r' + self.SetHA = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffHA) + #----- PROTECTED REGION END -----# // fbelt.HorizontalAttenuation_write + + def read_VerticalAttenuation(self, attr): + self.debug_stream("In read_VerticalAttenuation()") + #----- PROTECTED REGION ID(fbelt.VerticalAttenuation_read) ENABLED START -----# + attr.set_value(self.attr_VerticalAttenuation_read) + + #----- PROTECTED REGION END -----# // fbelt.VerticalAttenuation_read + + def write_VerticalAttenuation(self, attr): + self.debug_stream("In write_VerticalAttenuation()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.VerticalAttenuation_write) ENABLED START -----# + message = 'ATT:V:' + str(data) +'\r' + self.SetVA = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffVA) + #----- PROTECTED REGION END -----# // fbelt.VerticalAttenuation_write + + def read_LongitudinalAttenuation(self, attr): + self.debug_stream("In read_LongitudinalAttenuation()") + #----- PROTECTED REGION ID(fbelt.LongitudinalAttenuation_read) ENABLED START -----# + attr.set_value(self.attr_LongitudinalAttenuation_read) + + #----- PROTECTED REGION END -----# // fbelt.LongitudinalAttenuation_readviry + + def write_LongitudinalAttenuation(self, attr): + self.debug_stream("In write_LongitudinalAttenuation()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.LongitudinalAttenuation_write) ENABLED START -----# + message = 'ATT:L:' + str(data) +'\r' + self.SetLA = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffLA) + #----- PROTECTED REGION END -----# // fbelt.LongitudinalAttenuation_write + + def read_BackEndAttenuation(self, attr): + self.debug_stream("In read_BackEndAttenuation()") + #----- PROTECTED REGION ID(fbelt.BackEndAttenuation_read) ENABLED START -----# + attr.set_value(self.attr_BackEndAttenuation_read) + + #----- PROTECTED REGION END -----# // fbelt.BackEndAttenuation_read + + def write_BackEndAttenuation(self, attr): + self.debug_stream("In write_BackEndAttenuation()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.BackEndAttenuation_write) ENABLED START -----# + message = 'ATT:B:' + str(data) +'\r' + self.SetBEA = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffBEA) + #----- PROTECTED REGION END -----# // fbelt.BackEndAttenuation_write + + def read_IP(self, attr): + self.debug_stream("In read_IP()") + #----- PROTECTED REGION ID(fbelt.IP_read) ENABLED START -----# + attr.set_value(self.attr_IP_read) + + #----- PROTECTED REGION END -----# // fbelt.IP_read + + def read_Port(self, attr): + self.debug_stream("In read_Port()") + #----- PROTECTED REGION ID(fbelt.Port_read) ENABLED START -----# + attr.set_value(self.attr_Port_read) + + #----- PROTECTED REGION END -----# // fbelt.Port_read + + def read_HorizontalPhaseDeg(self, attr): + self.debug_stream("In read_HorizontalPhaseDeg()") + #----- PROTECTED REGION ID(fbelt.HorizontalPhaseDeg_read) ENABLED START -----# + attr.set_value(self.attr_HorizontalPhaseDeg_read) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalPhaseDeg_read + + def write_HorizontalPhaseDeg(self, attr): + self.debug_stream("In write_HorizontalPhaseDeg()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.HorizontalPhaseDeg_write) ENABLED START -----# + + val = phaseFitter.DegToDigit(data, interpdat) + if val < 0: + self.set_status('HorizontalPhaseDeg Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + self.SetHPDeg = data + self.SetHP = val + message = 'PHA:F:' + str(val) +'\r' + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffHPDeg) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalPhaseDeg_write + + def read_VerticalPhaseDeg(self, attr): + self.debug_stream("In read_VerticalPhaseDeg()") + #----- PROTECTED REGION ID(fbelt.VerticalPhaseDeg_read) ENABLED START -----# + attr.set_value(self.attr_VerticalPhaseDeg_read) + + #----- PROTECTED REGION END -----# // fbelt.VerticalPhaseDeg_read + + def write_VerticalPhaseDeg(self, attr): + self.debug_stream("In write_VerticalPhaseDeg()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.VerticalPhaseDeg_write) ENABLED START -----# + + val = phaseFitter.DegToDigit(data, interpdat) + if val < 0: + self.set_status('VerticalPhaseDeg Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + self.SetVPDeg = data + self.SetVP = val + message = 'PHA:G:' + str(val) +'\r' + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffVPDeg) + + #----- PROTECTED REGION END -----# // fbelt.VerticalPhaseDeg_write + + def read_LongitudinalPhaseDeg(self, attr): + self.debug_stream("In read_LongitudinalPhaseDeg()") + #----- PROTECTED REGION ID(fbelt.LongitudinalPhaseDeg_read) ENABLED START -----# + attr.set_value(self.attr_LongitudinalPhaseDeg_read) + + #----- PROTECTED REGION END -----# // fbelt.LongitudinalPhaseDeg_read + + def write_LongitudinalPhaseDeg(self, attr): + self.debug_stream("In write_LongitudinalPhaseDeg()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.LongitudinalPhaseDeg_write) ENABLED START -----# + + val = phaseFitter.DegToDigit(data, interpdat) + if val < 0: + self.set_status('LongitudinalPhaseDeg Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + self.SetLPDeg = data + self.SetLP = val + message = 'PHA:H:' + str(val) +'\r' + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffLPDeg) + + #----- PROTECTED REGION END -----# // fbelt.LongitudinalPhaseDeg_write + + def read_BackEndPhaseDeg(self, attr): + self.debug_stream("In read_BackEndPhaseDeg()") + #----- PROTECTED REGION ID(fbelt.BackEndPhaseDeg_read) ENABLED START -----# + attr.set_value(self.attr_BackEndPhaseDeg_read) + + #----- PROTECTED REGION END -----# // fbelt.BackEndPhaseDeg_read + + def write_BackEndPhaseDeg(self, attr): + self.debug_stream("In write_BackEndPhaseDeg()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.BackEndPhaseDeg_write) ENABLED START -----# + + val = phaseFitter.DegToDigit(data, interpdat) + if val < 0: + self.set_status('BackEndPhaseDeg Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + self.SetBEPDeg = data + self.SetBEP = val + message = 'PHA:E:' + str(val) +'\r' + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffBEPDeg) + + #----- PROTECTED REGION END -----# // fbelt.BackEndPhaseDeg_write + + def read_OneWireID(self, attr): + self.debug_stream("In read_OneWireID()") + #----- PROTECTED REGION ID(fbelt.OneWireID_read) ENABLED START -----# + attr.set_value(self.attr_OneWireID_read) + + #----- PROTECTED REGION END -----# // fbelt.OneWireID_read + + def read_HorizontalAttenuation_dB(self, attr): + self.debug_stream("In read_HorizontalAttenuation_dB()") + #----- PROTECTED REGION ID(fbelt.HorizontalAttenuation_dB_read) ENABLED START -----# + attr.set_value(self.attr_HorizontalAttenuation_dB_read) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalAttenuation_dB_read + + def write_HorizontalAttenuation_dB(self, attr): + self.debug_stream("In write_HorizontalAttenuation_dB()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.HorizontalAttenuation_dB_write) ENABLED START -----# + + sv = self.CheckAttdB(data) + if sv < 0: + self.set_status('Hor att Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + message = 'ATT:H:' + str(sv) +'\r' + self.SetHAdB = data + self.SetHA = sv + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffHAdB) + + #----- PROTECTED REGION END -----# // fbelt.HorizontalAttenuation_dB_write + + def read_VerticalAttenuation_dB(self, attr): + self.debug_stream("In read_VerticalAttenuation_dB()") + #----- PROTECTED REGION ID(fbelt.VerticalAttenuation_dB_read) ENABLED START -----# + attr.set_value(self.attr_VerticalAttenuation_dB_read) + + #----- PROTECTED REGION END -----# // fbelt.VerticalAttenuation_dB_read + + def write_VerticalAttenuation_dB(self, attr): + self.debug_stream("In write_VerticalAttenuation_dB()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.VerticalAttenuation_dB_write) ENABLED START -----# + + sv = self.CheckAttdB(data) + if sv < 0: + self.set_status('Ver att Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + message = 'ATT:V:' + str(sv) +'\r' + self.SetVAdB = data + self.SetVA = sv + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffVAdB) + + #----- PROTECTED REGION END -----# // fbelt.VerticalAttenuation_dB_write + + def read_BackEndAttenuation_dB(self, attr): + self.debug_stream("In read_BackEndAttenuation_dB()") + #----- PROTECTED REGION ID(fbelt.BackEndAttenuation_dB_read) ENABLED START -----# + attr.set_value(self.attr_BackEndAttenuation_dB_read) + + #----- PROTECTED REGION END -----# // fbelt.BackEndAttenuation_dB_read + + def write_BackEndAttenuation_dB(self, attr): + self.debug_stream("In write_BackEndAttenuation_dB()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.BackEndAttenuation_dB_write) ENABLED START -----# + + sv = self.CheckAttdB(data) + if sv < 0: + self.set_status('BE att Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + message = 'ATT:B:' + str(sv) +'\r' + self.SetBEA = sv + self.SetBEAdB = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffBEAdB) + + #----- PROTECTED REGION END -----# // fbelt.BackEndAttenuation_dB_write + + def read_LongitudinalAttenuation_dB(self, attr): + self.debug_stream("In read_LongitudinalAttenuation_dB()") + #----- PROTECTED REGION ID(fbelt.LongitudinalAttenuation_dB_read) ENABLED START -----# + attr.set_value(self.attr_LongitudinalAttenuation_dB_read) + + #----- PROTECTED REGION END -----# // fbelt.LongitudinalAttenuation_dB_read + + def write_LongitudinalAttenuation_dB(self, attr): + self.debug_stream("In write_LongitudinalAttenuation_dB()") + data = attr.get_write_value() + #----- PROTECTED REGION ID(fbelt.LongitudinalAttenuation_dB_write) ENABLED START -----# + + sv = self.CheckAttdB(data) + if sv < 0: + self.set_status('Long att Out Of Range') + self.set_state(PyTango.DevState.ALARM) + return + + message = 'ATT:L:' + str(sv) +'\r' + self.SetLA = sv + self.SetLAdB = data + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffLAdB) + + #----- PROTECTED REGION END -----# // fbelt.LongitudinalAttenuation_dB_write + + + + + def read_attr_hardware(self, data): + self.debug_stream("In read_attr_hardware()") + #----- PROTECTED REGION ID(fbelt.read_attr_hardware) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.read_attr_hardware + + + # ------------------------------------------------------------------------- + # fbelt command methods + # ------------------------------------------------------------------------- + + def GetID(self): + """ *idn? + :rtype: PyTango.DevString + """ + self.debug_stream("In GetID()") + argout = "" + #----- PROTECTED REGION ID(fbelt.GetID) ENABLED START -----# + + message = '*IDN?' +'\r' + #print(sys.version) + DimFBEinterf.Test(message) + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffI) + + #----- PROTECTED REGION END -----# // fbelt.GetID + return argout + + def GetTemperature(self): + """ GetTemperature + :rtype: PyTango.DevFloat + """ + self.debug_stream("In GetTemperature()") + argout = 0.0 + #----- PROTECTED REGION ID(fbelt.GetTemperature) ENABLED START -----# + self.set_status('TempMeasStarted') + self.set_state(PyTango.DevState.MOVING) + message = 'temp?' +'\r' + + DimFBEinterf.SendAndGetT([message, 'ReadTempStarted', '*'], [self.IP, self.Port], self.ScaleTemp, self.RDBstuffT) + + + #----- PROTECTED REGION END -----# // fbelt.GetTemperature + return argout + + def GetRPM(self): + """ GetRPM + :rtype: PyTango.DevLong + """ + self.debug_stream("In GetRPM()") + argout = 0 + #----- PROTECTED REGION ID(fbelt.GetRPM) ENABLED START -----# + + message = 'RPM?' +'\r' + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.ScaleRPM, self.RDBstuffR) + + #----- PROTECTED REGION END -----# // fbelt.GetRPM + return argout + + def SetRPM(self, argin): + """ SetRPM + :param argin: + :type argin: PyTango.DevLong + :rtype: PyTango.DevString + """ + self.debug_stream("In SetRPM()") + argout = "" + #----- PROTECTED REGION ID(fbelt.SetRPM) ENABLED START -----# + + message = 'PHA:A:' + str(argin) +'\r' + DimFBEinterf.SendAndGetT([message, '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffR) + + #----- PROTECTED REGION END -----# // fbelt.SetRPM + return argout + + def GetOneWireID(self): + """ retrieve one wire temp sensor serial number + """ + self.debug_stream("In GetOneWireID()") + #----- PROTECTED REGION ID(fbelt.GetOneWireID) ENABLED START -----# + + message = 'owid?' +'\r' + + DimFBEinterf.SendAndGetT([message, 'ReadOneWireIDstarted', '*'], [self.IP, self.Port], self.PassThrough, self.RDBstuffOWid) + + #----- PROTECTED REGION END -----# // fbelt.GetOneWireID + + def ApplyDefault(self): + """ + """ + self.debug_stream("In ApplyDefault()") + #----- PROTECTED REGION ID(fbelt.ApplyDefault) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.ApplyDefault + + + #----- PROTECTED REGION ID(fbelt.programmer_methods) ENABLED START -----# + + + + + #----- PROTECTED REGION END -----# // fbelt.programmer_methods + +class fbeltClass(PyTango.DeviceClass): + # -------- Add you global class variables here -------------------------- + #----- PROTECTED REGION ID(fbelt.global_class_variables) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.global_class_variables + + + # Class Properties + class_property_list = { + } + + + # Device Properties + device_property_list = { + 'DeviceIP': + [PyTango.DevString, + '', + [] ], + 'DevicePort': + [PyTango.DevString, + '', + [] ], + 'OneWireID': + [PyTango.DevString, + "One Wire Serial", + [] ], + } + + + # Command definitions + cmd_list = { + 'GetID': + [[PyTango.DevVoid, "none"], + [PyTango.DevString, "none"]], + 'GetTemperature': + [[PyTango.DevVoid, "none"], + [PyTango.DevFloat, "none"]], + 'GetRPM': + [[PyTango.DevVoid, "none"], + [PyTango.DevLong, "none"]], + 'SetRPM': + [[PyTango.DevLong, "none"], + [PyTango.DevString, "none"]], + 'GetOneWireID': + [[PyTango.DevVoid, "none"], + [PyTango.DevVoid, "none"]], + 'ApplyDefault': + [[PyTango.DevVoid, "none"], + [PyTango.DevVoid, "none"]], + } + + + # Attribute definitions + attr_list = { + 'Temperature': + [[PyTango.DevDouble, + PyTango.SCALAR, + PyTango.READ]], + 'RPM': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ]], + 'ID': + [[PyTango.DevString, + PyTango.SCALAR, + PyTango.READ]], + 'HorizontalPhase': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'VerticalPhase': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'LongitudinalPhase': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'BackEndPhase': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'HorizontalAttenuation': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'VerticalAttenuation': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'LongitudinalAttenuation': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'BackEndAttenuation': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'IP': + [[PyTango.DevString, + PyTango.SCALAR, + PyTango.READ]], + 'Port': + [[PyTango.DevString, + PyTango.SCALAR, + PyTango.READ]], + 'HorizontalPhaseDeg': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'VerticalPhaseDeg': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'LongitudinalPhaseDeg': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'BackEndPhaseDeg': + [[PyTango.DevLong, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'OneWireID': + [[PyTango.DevString, + PyTango.SCALAR, + PyTango.READ]], + 'HorizontalAttenuation_dB': + [[PyTango.DevDouble, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'VerticalAttenuation_dB': + [[PyTango.DevDouble, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'BackEndAttenuation_dB': + [[PyTango.DevDouble, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + 'LongitudinalAttenuation_dB': + [[PyTango.DevDouble, + PyTango.SCALAR, + PyTango.READ_WRITE], + { + 'Memorized':"true_without_hard_applied" + } ], + } + + +def main(): + try: + py = PyTango.Util(sys.argv) + py.add_class(fbeltClass, fbelt, 'fbelt') + #----- PROTECTED REGION ID(fbelt.add_classes) ENABLED START -----# + + #----- PROTECTED REGION END -----# // fbelt.add_classes + + U = PyTango.Util.instance() + U.server_init() + U.server_run() + + except PyTango.DevFailed as e: + print ('-------> Received a DevFailed exception:', e) + except Exception as e: + print ('-------> An unforeseen exception occured....', e) + +if __name__ == '__main__': + main() diff --git a/src/fbelt.xmi b/src/fbelt.xmi new file mode 100644 index 0000000000000000000000000000000000000000..60972db2b0851c692fc6c043c74f2c1ff74b77a9 --- /dev/null +++ b/src/fbelt.xmi @@ -0,0 +1,279 @@ +<?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="fbelt" pogoRevision="9.6"> + <description description="DimTel FBE-LTE controller" title="DimTel FBE-LTE controller" sourcePath="/home/stefano/DimTelDetector/fbelt" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="Elettra-Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> + <inheritances classname="Device_Impl" sourcePath=""/> + <identification contact="at elettra.eu - stefano.cleva" author="stefano.cleva" emailDomain="elettra.eu" classFamily="DimTel FBE-LT controller" siteSpecific="" platform="All Platforms" bus="Ethernet" manufacturer="DimTel" reference=""/> + </description> + <deviceProperties name="DeviceIP" description=""> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </deviceProperties> + <deviceProperties name="DevicePort" description=""> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </deviceProperties> + <deviceProperties name="OneWireID" description="One Wire Serial"> + <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="GetID" description="*idn?" execMethod="get_id" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <argin description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:StringType"/> + </argout> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </commands> + <commands name="GetTemperature" description="GetTemperature" execMethod="get_temperature" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <argin description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:FloatType"/> + </argout> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </commands> + <commands name="GetRPM" description="GetRPM" execMethod="get_rpm" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <argin description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:IntType"/> + </argout> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </commands> + <commands name="SetRPM" description="SetRPM" execMethod="set_rpm" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <argin description=""> + <type xsi:type="pogoDsl:IntType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:StringType"/> + </argout> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </commands> + <commands name="GetOneWireID" description="retrieve one wire temp sensor serial number" execMethod="get_one_wire_id" 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"/> + </commands> + <commands name="ApplyDefault" description="" execMethod="apply_default" 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"/> + </commands> + <attributes name="Temperature" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" 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="RPM" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="ID" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" 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="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="HorizontalPhase" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="VerticalPhase" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="LongitudinalPhase" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="BackEndPhase" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="HorizontalAttenuation" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="VerticalAttenuation" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="LongitudinalAttenuation" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="BackEndAttenuation" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="IP" attType="Scalar" rwType="READ" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" 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="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="Port" attType="Scalar" rwType="READ" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" 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="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="HorizontalPhaseDeg" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="VerticalPhaseDeg" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="LongitudinalPhaseDeg" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="BackEndPhaseDeg" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="OneWireID" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" 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="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="HorizontalAttenuation_dB" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" 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="VerticalAttenuation_dB" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" 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="BackEndAttenuation_dB" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" 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="LongitudinalAttenuation_dB" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" 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> + <states name="ON" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="MOVING" 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> + <preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.3.3/share/pogo/preferences"/> + </classes> +</pogoDsl:PogoSystem> diff --git a/src/phaseFitter.py b/src/phaseFitter.py new file mode 100644 index 0000000000000000000000000000000000000000..cc484b5db915845f5177212d66612f65e1bd743f --- /dev/null +++ b/src/phaseFitter.py @@ -0,0 +1,413 @@ +############################## +### phaseFitter.py - StCl ### +############################## + +import copy + +MisVoltaBoysHorizontal = [ +[0, -178.522, -179.6, -177.7], +#cambio segno +[50, 169.086, 167.2, 170.0], +[100, 156.515, 155.7, 157.7], +[150, 145.411, 144.3, 146.7], +[200, 136.130, 134.8, 136.8], +[250, 126.865, 126.3, 127.4], +[300, 117.681, 117.0, 118.5], +[350, 110.422, 108.6, 111.5], +[400, 102.418, 101.3, 102.8], +[450, 95.330, 94.27, 96.2], +[500, 87.833, 87.15, 88.77], +[550, 81.240, 80.36, 82.35], +[600, 74.274, 73.19, 75.49], +[650, 68.242, 68.86, 69.37], +[700, 61.717, 60.98, 62.18], +[750, 55.094, 54.05, 56.53], +[800, 48.633, 47.7, 49.35], +[850, 42.356, 41.43, 43.11], +[900, 37.083, 36.28, 38.01], +[950, 30.686, 29.46, 31.56], +[1000, 24.416, 23.86, 25.66], +[1050, 17.881, 17.07, 20.39], +[1100, 13.502, 11.56, 14.23], +[1150, 7.854, 6.203, 9.422], +[1200, 2.554, 1.352, 3.484], +#cambio segno +[1250, -3.193, -4.954, -2.291], +[1300, -8.301, -9.732, -7.192], +[1350, -14.448, -16.25, -13.17], +[1400, -19.241, -20.43, -17.67], +[1450, -24.735, -26.0, -23.62], +[1500, -30.413, -31.76, -29.56], +[1550, -35.167, -35.76, -34.4], +[1600, -40.408, -40.89, -39.44], +[1650, -46.082, -47.48, -44.5], +[1700, -50.686, -52.4, -48.61], +[1750, -56.070, -57.38, -55.5], +[1800, -61.327, -62.67, -59.93], +[1850, -65.900, -66.88, -64.78], +[1900, -71.826, -72.42, -70.118], +[1950, -75.962, -77.12, -75.38], +[2000, -80.741, -82.77, -79.5], +[2050, -84.880, -85.79, -83.6], +[2100, -90.230, -91.52, -88.77], +[2150, -95.360, -96.32, -93.66], +[2200, -100.365, -101.7, -98.8], +[2250, -104.396, -105.9, -103.1], +[2300, -108.213, -109.5, -107.7], +[2350, -113.288, -115.4, -111.9], +[2400, -116.671, -118.5, -116.0], +[2450, -120.726, -122.1, -119.0], +[2500, -124.208, -126.7, -123.2], +[2550, -128.691, -130.4, -126.9], +[2600, -132.922, -135.5, -130.9], +[2650, -136.550, -138.0, -134.9], +[2700, -141.033, -142.6, -139.3], +[2750, -145.215, -146.8, -143.5], +[2800, -149.829, -151.3, -149.0], +[2850, -152.435, -154.2, -150.7], +[2900, -156.400, -154.7, -158.2], +[2950, -160.589, -161.9, -159.8], +[3000, -164.492, -165.4, -163.3], +[3050, -166.323, -168.7, -165.1], +[3100, -171.951, -172.8, -171.5], +[3150, -175.803, -176.6, -175.1], +#cambio segno +[3210, 178.978, 178.1, 179.8], +[3250, 176.641, 175.8, 177.7], +[3300, 173.938, 171.8, 175.6], +[3350, 169.636, 168.2, 170.3], +[3400, 166.648, 165.7, 167.5], +[3450, 163.153, 162.3, 164.7], +[3500, 160.039, 159.3, 160.8], +[3550, 156.404, 155.9, 157.7], +[3600, 152.752, 152.0, 154.1], +[3650, 149.911, 148.6, 150.9], +[3700, 146.750, 146.0, 147.8], +[3750, 142.728, 141.7, 144.2], +[3800, 140.453, 139.0, 142.3], +[3850, 137.345, 136.6, 137.9], +[3900, 134.517, 133.7, 135.2], +[3950, 131.636, 130.6, 132.6], +[4000, 129.499, 128.2, 131.0], +[4050, 127.136, 126.1, 128.1], +[4095, 126.494, 125.2, 127.4] +] + + +MisVoltaBoysVertical = [ +[0, 125.203, 124.0, 125.9], +[50, 111.853, 110.3, 113.4], +[100, 100.327, 99.34, 101.3], +[150, 89.213, 87.53, 90.28], +[200, 79.078, 78.11, 79.96], +[250, 69.917, 69.19, 70.73], +[300, 61.925, 60.5, 62.41], +[350, 53.608, 52.66, 55.52], +[400, 46.267, 45.5, 47.1], +[450, 38.485, 36.87, 39.93], +[500, 31.200, 30.27, 32.49], +[550, 24.837, 23.86, 25.73], +[600, 18.300, 16.59, 19.2], +[650, 11.460, 10.4, 13.18], +[700, 4.985, 4.247, 5.78], +[750, -1.642, -2.189, -0.4], +[800, -7.498, -8.0, -6.681], +[850, -14.416, -16.1, -13.74], +[900, -19.678, -20.95, -18.26], +[950, -26.500, -27.58, -27.12], +[1000, -32.533, -33.41, -30.85], +[1050, -37.970, -39.19, -36.72], +[1100, -44.303, -45.51, -41.87], +[1150, -50.000, -51.58, -48.6], +[1200, -55.638, -56.4, -54.53], +[1250, -60.855, -61.42, -59.78], +[1300, -67.053, -68.04, -65.84], +[1350, -72.328, -73.15, -70.75], +[1400, -77.282, -78.36, -76.88], +[1450, -82.648, -83.6, -81.73], +[1500, -88.361, -90.1, -86.53], +[1550, -93.616, -95.48, -92.7], +[1600, -98.467, -99.38, -97.09], +[1650, -103.274, -104.7, -102.6], +[1700, -108.649, -109.8, -107.7], +[1750, -113.876, -115.9, -112.5], +[1800, -118.604, -119.6, -117.2], +[1850, -123.877, -127.1, -121.7], +[1900, -127.986, -129.3, -127.1], +[1950, -133.283, -134.4, -132.1], +[2000, -135.265, -135.9, -134.4], +[2050, -140.166, -140.9, -139.4], +[2100, -144.621, -146.0, -144.1], +[2150, -148.972, -149.8, -148.3], +[2200, -153.423, -154.8, -152.1], +[2250, -158.595, -159.5, -157.6], +[2300, -162.700, -163.5, -162.0], +[2350, -167.241, -168.3, -166.1], +[2400, -172.133, -173.1, -170.3], +[2450, -176.626, -177.2, -175.1], +[2510, 178.819, 178.3, 179.7], +[2550, 175.158, 174.2, 175.9], +[2600, 170.674, 170.0, 171.9], +[2650, 165.735, 165.2, 167.1], +[2700, 162.400, 161.7, 164.0], +[2750, 158.160, 152.4, 159.2], +[2800, 153.852, 153.1, 155.1], +[2850, 149.628, 148.9, 150.6], +[2900, 145.687, 145.0, 146.6], +[2950, 142.355, 141.7, 143.0], +[3000, 138.380, 137.5, 139.2], +[3050, 135.085, 132.0, 136.0], +[3100, 131.043, 128.4, 132.4], +[3150, 127.108, 126.0, 128.1], +[3200, 123.369, 120.9, 124.8], +[3250, 120.212, 117.3, 121.8], +[3300, 116.253, 113.1, 117.7], +[3350, 112.035, 109.2, 113.8], +[3400, 109.234, 107.9, 110.2], +[3450, 105.825, 105.0, 106.7], +[3500, 102.685, 99.81, 103.8], +[3550, 99.525, 96.22, 100.7], +[3600, 96.089, 93.64, 97.83], +[3650, 92.318, 90.19, 94.23], +[3700, 90.359, 89.33, 91.0], +[3750, 89.833, 88.52, 91.05], #warning!!! +[3800, 84.144, 82.98, 84.77], +[3850, 81.183, 80.5, 82.25], +[3900, 78.025, 75.9, 79.26], +[3950, 75.757, 71.74, 77.03], +[4000, 73.194, 70.69, 75.13], +[4050, 71.934, 70.49, 72.98], +[4095, 70.446, 67.97, 72.13] +] + +MisVoltaBoysLongitudinal = [ +[0, 139.240,137.4 ,140.3 ], +[50, 125.931, 125.3, 126.9 ], +[100, 113.449, 112.5, 114.4], +[150, 101.410, 100.1, 103.7], +[200, 91.552, 89.73, 92.95], +[250, 82.395, 81.56, 83.37], +[300,73.143, 72.1, 73.89], +[350, 64.831, 63.03, 65.71], +[400, 56.906, 56.0, 58.47], +[450, 49.088, 47.7, 50.66], +[500, 42.834, 41.25, 43.76], +[550, 36.300, 34.3, 37.73], +[600, 29.624, 28.24, 31.33], +[650, 22.796, 21.86, 23.74], +[700, 15.963, 14.99, 17.26], +[750, 9.554, 8.091, 10.73], +[800, 3.560, 2.351, 4.179], +[850, -2.164, -3.241, -0.9], +[900, -8.745, -9.75, -3.398], +[950, -14.528, -16.04, -12.89], +[1000, -20.718, -21.49, -20.07], +[1050, -26.615, -28.42, -25.17], +[1100, -32.245, -32.76, -31.65], +[1150, -37.826, -38.45, -36.61], +[1200, -43.284, -43.01, -42.76], +[1250, -48.622, -50.34, -47.41], +[1300, -53.575, -54.08, -52.82], +[1350, -59.911, -60.71, -57.57], +[1400, -64.957, -65.61, -64.61], +[1450, -70.310, -71.12, -68.62], +[1500, -75.850, -76.83, -74.71], +[1550, -81.747, -84.2, -80.81], +[1600, -86.382, -87.43, -85.54], +[1650, -91.296, -92.74, -90.46], +[1700, -96.591, -97.31, -95.54], +[1750, -102.198, -103.5, -101.4], +[1800, -107.632, -108.6, -106.9], +[1850, -112.093, -114.3, -111.5], +[1900, -117.459, -118.3, -116.3], + +[1950, -122.457, -123.2, -121.4], +[2000, -127.449, -128.1, -126.3], +[2050, -133.017, -134.3, -131.8], +[2100, -136.781, -138.2, -135.9], +[2150, -141.574, -142.6, -140.5], +[2200, -146.105, -146.7, -145.3], +[2250, -150.731, -151.4, -149.2], +[2300, -155.050, -156.0, -153.8], +[2350, -159.648, -160.5, -158.8], +[2400, -164.353, -165.4, -163.3], +[2450, -168.424, -169.6, -167.5], +[2500, -172.740, -173.4, -172.1], #warning!!!!!! +[2550, -175.545, -173.2, -178.8], +[2610, 178.492, 177.4, 179.4], +[2650, 175.929, 175.1, 176.8], +[2700, 171.318, 170.6, 172.7], +[2750, 167.556, 166.6, 168.8], +[2800, 163.558, 162.5, 164.6], +[2850, 159.709, 158.9, 161.1], +[2900, 156.524, 155.3, 157.4], +[2950, 152.736, 152.2, 153.4], +[3000, 149.380, 148.5, 150.5], +[3050, 144.903, 144.1, 146.1], +[3100, 141.177, 140.3, 142.2], +[3150, 138.129, 136.9, 139.7], +[3200, 134.515, 133.0, 135.8], +[3250, 130.260, 129.5, 131.6], +[3300, 129.148, 127.3, 132.4], +[3350, 124.933, 124.3, 126.3], +[3400, 121.067, 119.7, 122.5], +[3450, 118.077, 117.3, 118.9], +[3500, 113.887, 113.0, 115.4], +[3550, 111.537, 109.8, 112.3], +[3600, 107.765, 106.6, 108.5], +[3650, 104.460, 102.3, 105.7], +[3700, 101.169, 100.2, 102.5], +[3750, 98.568, 96.85, 99.65], +[3800, 95.314, 94.04, 96.19], +[3850, 92.482, 91.52, 93.54], +[3900, 89.103, 88.08, 91.32], +[3950, 86.359, 85.54, 87.11], +[4000, 84.083, 83.18, 84.88], +[4050, 81.740, 80.82, 82.52], +[4095, 80.980, 80.01, 81.66] +] + +interpdat = [] + +def DigitToDeg(a, b): + return + +def DegToDigit(a, b): + for scan in b: + # + index = scan[0] + dgt = scan[1] + deg = scan[2] + + if(a < 0): + return -1 + + if(a == deg): + return dgt + + if(a < deg): + diffDeg = b[index][2] - b[index - 1][2] + diffDgt = b[index][1] - b[index - 1][1] + delta = ((diffDgt * (deg - a))/diffDeg) + val = b[index][1] - delta + roundval = round(val) + retval = int(roundval) + return retval + + if(a > deg): + pass + + + return -2 + + +def Normalize(inval): + size = 0 + for scan in inval: + size = size + 1 + + if size == 0: + #print '***** len error *****' + return -1 #to be checked + + t = inval[0] + offset = t[1] + fin = [] + aux = [] + tmp = [] + data = [] + final = [] + count = 0 + + for val in inval: + index = count + setpoint = val[0] + degs = val[1] + tmp = [index ,setpoint, degs] + fin.append(tmp) + count = count + 1 + + support = copy.deepcopy(fin) + applyjump = 0 + onlyone = 0 + turn = 0 + + applyjump = 0 + tmp = fin[0] + aux = [fin[0][0], fin[0][1], 0] + offset = fin[0][2] + data.append(aux) + + for scan in range(1,count - 1): + a = fin[scan - 1][2] + b = fin[scan][2] + + diff = b - a + + if ((diff >= 180)): + #print 'saltofase' + if (applyjump == 0): + applyjump = 1 + else: + if (applyjump == 1): + applyjump = 2 + + index = scan + setpoint = fin[scan][1] + if(applyjump == 0): + degs = fin[scan][2] + + if(applyjump == 1): + degs = fin[scan][2] - 360 + + if(applyjump == 2): + degs = fin[scan][2] - 720 + + #tmp = [index, b, degs] + #aux.append(tmp) + + degs = degs - offset + aux = [index, fin[scan][1], -1 * round(degs,2)] + #print ' scan ended' + data.append(aux) + + return data + + for val in fin: + tmp = val + if (val[0] != 0): + ind = val[0] + op1 = fin[ind - 1] + op2 = fin[ind] + diff = op2[2] - op1[2] + + if ((diff >= 180)): + #print 'saltofase' + if (applyjump == 0): + applyjump = 1 + else: + if (applyjump == 1): + applyjump = 2 + + if(applyjump == 1): + newval = op2[2] - 360 + tmp[2] = newval + + if(applyjump == 2): + newval = op2[2] - 720 + tmp[2] = newval + + aux.append(tmp) + + for scan in aux: + tmp = scan + + tmp[2] = -1 * round((tmp[2] - offset),2) + + final.append(tmp) + return final + +def interpol(): + clone = copy.deepcopy(MisVoltaBoysLongitudinal) + data = Normalize(clone) + return data