Files
sf-ph/script/test/TestInvalid.py
2021-08-11 10:58:39 +02:00

34 lines
1.4 KiB
Python
Executable File

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
#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)