diff --git a/config/devices.properties b/config/devices.properties index 907946d..cc3e05b 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -18,4 +18,4 @@ adc_xh1=ch.psi.pshell.epics.ChannelInteger|SARFE10-PBPG050:HAMP-014-x-h1-DATA-SU adc_yh2=ch.psi.pshell.epics.ChannelInteger|SARFE10-PBPG050:HAMP-011-y-h2-DATA-SUM|||true m2rx=ch.psi.pshell.epics.Motor|SAROP21-OOMV096:W_RX|||true #camtool=ch.psi.pshell.bs.Camtool|localhost:10000||| -invalid=ch.psi.pshell.epics.ChannelDouble|SARUN15-UIND030:INVALID-PV -1 true Nullify|||true +invalid1=ch.psi.pshell.epics.ChannelDouble|SARUN15-UIND030:INVALID-PV -1 true Nullify|||true diff --git a/script/test/TestInvalid.py b/script/test/TestInvalid.py index d313f0e..d02e95f 100644 --- a/script/test/TestInvalid.py +++ b/script/test/TestInvalid.py @@ -1,11 +1,33 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble +#Creating a timestamped channel (timestamp from the IOC) and accessing the severity +channel = ChannelDouble("test_inv1", "SARUN15-UIND030:INVALID-PV", -1, True) +add_device(channel, True) +print "Value=", test_inv1.read() +print "Severity=", val.severity -channel = ChannelDouble("test_inv", "SARUN15-UIND030:INVALID-PV", -1, True, InvalidValueAction.Nullify) -avg = create_averager(channel, 5, interval = -1, name = "avg") -avg.monitored = True +#Creating a channel with PC timestamp from the IOC and accessing the severity atomically +channel = ChannelDouble("test_inv2", "SARUN15-UIND030:INVALID-PV", -1, False, InvalidValueAction.None) +add_device(channel, True) +channel.read() +val = channel.takeTimestamped() +print "Value=", val.value +print "Timestamp=", val.timestamp +print "Severity=", val.severity + + +#Creating a channel nullifying the invalid values and averaging next valid values in 5 following monitor values +channel = ChannelDouble("test_inv3", "SARUN15-UIND030:INVALID-PV", -1, False, InvalidValueAction.Nullify) channel.monitored = True +avg = create_averager(channel, 5, interval = -1, name = "test_avg_1") +add_device(channel, True) +add_device(avg, True) + +#Creating a channel ignoring the invalid values and an averager averaging next 5 valid monitor values. +channel = ChannelDouble("test_inv4", "SARUN15-UIND030:INVALID-PV", -1, False, InvalidValueAction.Exception) +channel.monitored = True +avg = create_averager(channel, 5, interval = -1, name = "test_avg_2") add_device(channel, True) add_device(avg, True)