From: Philipp Klaus Date: Thu, 10 Aug 2017 07:23:59 +0000 (+0200) Subject: OPUS20: Unit, limits, alarms, severity X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=99f8d2ea97de6a9d301a9e3d38774f2bac00a0bc;p=mvd_epics.git OPUS20: Unit, limits, alarms, severity --- diff --git a/LUFFT_OPUS20/lufft_opus20_ioc.py b/LUFFT_OPUS20/lufft_opus20_ioc.py index 42f134a..5e4c8ae 100755 --- a/LUFFT_OPUS20/lufft_opus20_ioc.py +++ b/LUFFT_OPUS20/lufft_opus20_ioc.py @@ -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__':