]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
OPUS20: Unit, limits, alarms, severity
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Thu, 10 Aug 2017 07:23:59 +0000 (09:23 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Thu, 10 Aug 2017 07:23:59 +0000 (09:23 +0200)
LUFFT_OPUS20/lufft_opus20_ioc.py

index 42f134a7dfe99f56cd4002a0a263129b7ea8753a..5e4c8aef0148933b1e87b14f0911c602adebf708 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-from pcaspy import Driver, SimpleServer
+from pcaspy import Driver, SimpleServer, Alarm, Severity
 
 from opus20 import Opus20, OPUS20_CHANNEL_SPEC, PickleStore, Opus20ConnectionException
 
@@ -10,22 +10,45 @@ prefix = '{sys}:{sub}:ENVIRON:{esys}:'
 pvdb = {
     'Temperature' : {
         'prec' : 3,
+        'unit' : 'deg C',
+        'lolo' : 17,
+        'low'  : 20,
+        'high' : 28,
+        'hihi' : 30,
         #'scan' : 1,
     },
     'RelativeHumidity' : {
         'prec' : 3,
+        'unit' : '%',
+        'lolo' : 30,
+        'low'  : 40,
+        'high' : 60,
+        'hihi' : 70,
         #'scan' : 1,
     },
     'AbsoluteHumidity' : {
         'prec' : 3,
         #'scan' : 1,
+        'unit' : 'g/m3',
+        'low'  :  5,
+        'high' : 20,
     },
     'Dewpoint' : {
         'prec' : 3,
+        'unit' : 'deg C',
         #'scan' : 1,
+        'lolo' : -30,
+        'low'  : -10,
+        'high' :  16,
+        'hihi' :  20,
     },
     'BatteryVoltage' : {
         'prec' : 3,
+        'unit' : 'V',
+        'lolo' : 5.0,
+        'low'  : 5.3,
+        'high' : 6.2,
+        'hihi' : 6.5,
         #'scan' : 1,
     },
 }
@@ -55,9 +78,16 @@ class Opus20Driver(Driver):
                 'Dewpoint':          0x006e,
                 'BatteryVoltage':    0x2724,
             }
-            value = self.o20.channel_value(mapping[reason])
+            try:
+                value = self.o20.channel_value(mapping[reason])
+                self.setParamStatus(reason, Alarm.NO_ALARM, Severity.NO_ALARM)
+                self.setParam(reason, value)
+            except:
+                 self.setParamStatus(reason, Alarm.COMM_ALARM, Severity.MINOR_ALARM)
+                 value = self.getParam(reason)
         else:
             value = self.getParam(reason)
+
         return value
 
 if __name__ == '__main__':