How I can calculate First Our for more than 16 Alarms?
It is possible to use several BF blocksI, for instance two BFI (BFI1 and BFI2) in parallel to receive up to 32 inputs. Then BFI1 and BFI2 OUT_D should be conected to a third BFI (BFI3) IN_D1 and IN_D2 inputs respectively.
BFI3 tells if BFI1 or BFI2 OUT_D became active first. Then, BFI1 has first out of 1 to 16 conditions and BFI2 has first out of 17 to 32.
With that info a calc block can be used to provide first out of 1 to 32 conditions. The trick is to use LOG2 funtion in calc block:
Having
- BFI3 FIRST_OUT conected to CALC IN1 (conditions group first_out)
- BFI1 FIRST_OUT conected to CALC IN2 (conditions 1 to 16 first_out)
- BFI2 FIRST_OUT conected to CALC IN3 (conditions 17 to 32 first_out)
Expresion providing 1 to 32 condition first out into CALC block OUT2 will be:
out2:=(in1=1) ? (log2(2,in2)+1):(in1=2) ? (log2(2,in3)+17):-1;
NOTE: When more than one condition becomes active at same time(same scan cycle) not first out is calculated, a -1 value is set instead.
This can be extended to 16 inputs of BFI3, just adding more BFI blocks and changing CALC expression; giving a maximim of 16*16=256 conditions.
Regards
In reply to gamella:
In reply to Samuel Bandeira:
It works for me, including 9 to 16 and 25 to 32 conditions.
In reply to Greg Bayne: