Appendix 10.5.6 Selection Operators 10.5.6.1 SEL Binary Selection. OUT := SEL(G, IN0, IN1) means: OUT := IN0 if G=FALSE;OUT := IN1 if G=TRUE. IN0, IN1 and OUT can be any type of variable, G must be BOOL. The result of the selection is IN0 if G is FALSE, IN1 if G is TRUE. Example in IL: LD TRUE SEL 3,4 ST Var1 (* Result is 4 *) LD FALSE SEL 3,4 ST Var1 (* Result is 3 *) Example in FBD: For the purpose of the run time optimization one processes as follows: An expression, which is up- stream IN0, is calculated only if G is FALSE. An expression of the IN1 is upstream, is calculated only if G is TRUE! 10.5.6.2 MAX Maximum function. Returns the greater of the two values.
OUT := MAX(IN0, IN1) IN0, IN1 and OUT can be any type of variable. Example in IL: LD 90 MAX 30 MAX 40 MAX 77 ST Var1 (* Result is 90 *) Example in FBD: TwinCAT 2 PLC Control 320 Version: 1.0