My module is set up with the following as the CALC block expression:
IF 'IN1.CV' = 1 OR '^/PID1/PV.ST' = BAD THEN
IF '^/PID1/MODE.TARGET' != MAN THEN
'^/PID1/MODE.TARGET' := MAN
END_IF;
'^/PID1/OUT.CV' := 0;
'^/START.CV' := 0;
IF '^/PID1/PV.ST' = BAD THEN
'OUT1.CV' := 1
ELSE
'OUT1.CV' := 0
We recently had the 5th line (and only this line) of the code not execute for over 30+ minutes of the IN1.CV = 1, but we have no visibility retrospectively as to why it didn’t execute
If I add a PV_BAD alarm to the entire module, will it capture all device problems that might prevent me from closing my valve per the 5th line in the code in the future?
Not sure if this is the problem or not, but as a general rule... never use .ST = BAD. Statuses are an 8-bit unsigned integer where >= 128 are all various types of "good" and < 128 are various types of "bad". There is a table of all status codes in BOL. You need your comparison to be PV.ST < 128 or you can use PV.ST < GOOD as the constant GOOD=128.
The lower bad value is worse, so it is common to use the following in a CALC block: 'OUT1.ST' := MIN('IN1.ST', 'IN2.ST');
Edit: Added table screenshot.
In reply to Matt Forbis:
Andre Dicaire