Hi all,
To enable/disable some functionality, I sometimes do something like:
# Evaluates to 1 (true) if all condtions good otherwise 0 (false)
#
record (calc, "GOOD_TO_GO") {
field (INPA, "PV1")
field (INPB, "PV2")
field (CALC, "(A=1)&&(B>=25):?1:0")
}
But what if PV1 or PV2 are invalid/undefined. Next I tried:
record (calc, "GOOD_TO_GO") {
field (INPA, "PV1")
field (INPB, "PV2")
field (INPC, "PV1.SEVR")
field (INPD, "PV2.SEVR")
# Note: INVALID_ALARM state value is 3.
field (CALC, "(C#3)&&(D#3)&&(A=1)&&(B>=25):?1:0")
}
This works fine of PV1 and PV2 hosted on the same IOC as GOOD_TO_GO,
but if
hosted on another IOC which is currently not available, the calc
record is itself invalid.
3rd attemp.
record (ai, PV1_ALIAS") {
field (INP, "PV1")
}
record (calc, "GOOD_TO_GO") {
field (INPA, "PV1_ALIAS")
field (INPB, "PV2")
field (INPC, "PV1_ALIAS.SEVR")
field (INPD, "PV2.SEVR")
field (CALC, "(C#3)&&(D#3)&&(A=1)&&(B>=25):?1:0")
}
This helps. Even if the IOC hosting PV1 is down, PV1_ALIAS still exists
(albeit in an invalid state) and GOOD_TO_GO can evaluate successfully.
But if the IOC hosting PV1 is up and running, then PV1_ALIAS is not
invalid
even when PV1 itself is invalid. I suppose I could create an alias
process
varaible for PV1.SEVR as well, but that seems to be getting very messy.
record (ai, PV1_ALIAS") {
field (INP, "PV1")
}
record (ai, PV1_SEVR_ALIAS") {
field (INP, "PV1.SEVR")
}
record (calc, "GOOD_TO_GO") {
field (INPA, "PV1_ALIAS")
field (INPB, "PV2")
field (INPC, "PV1_ALIAS.SEVR")
field (INPD, "PV2.SEVR")
field (INPE, "PV1_SEVR_ALIAS")
field (INPF, "PV1_SEVR_ALIAS.SEVR")
field (CALC, "(C#3)&&(D#3)&&(E#3)&&(F#3)&&(A=1)&&(B>=25):?1:0")
}
Is there a simpler more elagant way do do this?
Regards
Andrew Starritt
_______________________________________
Senior Systems Engineer - Software Specialist
Australian Synchrotron Project
800 Blackburn Road, Clayton, Victoria 3168
Tel: +61 3 8540 4164
Fax: +61 3 8540 4200