valueIsMax
Short summary
This assertion method checks if the current value is less than or equal to the maximum value
Attention:
Any comparsion to NaN is FALSE that means if currentValue OR maximumValue
is NaN then is the assertion false.
For details check IEEE 754_ and the truth table below.
Attention: Every number is smaller than infinity except infinity, it's equal. Every number is greater than -infinity except -infinity, it's equal. For details check IEEE 754 and the truth table below.
truth table for special values
+----------------------+----------------------+---------------+
| currentValue | maximumValue | assertion |
+======================+======================+===============+
| NaN | Any value | FASLE |
+----------------------+----------------------+---------------+
| Any value | NaN | FALSE |
+----------------------+----------------------+---------------+
| NOT NaN | infinity | TRUE |
+----------------------+----------------------+---------------+
| -infinity | NOT NaN | TRUE |
+----------------------+----------------------+---------------+
| infinity | NOT infinity | FALSE |
+----------------------+----------------------+---------------+
| NOT -infinity | -infinity | FALSE |
+----------------------+----------------------+---------------+
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| currentValue | REAL | current value to check | input |
| maximumValue | REAL | upper limit for the current value | input |
| message | AssertMessage | message if the assertion is false | input |
Code
Declaration
METHOD valueIsMax
VAR_INPUT
(* current value to check *)
currentValue :REAL;
(* upper limit for the current value *)
maximumValue :REAL;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR