FUNCTION_BLOCK SHAFT_MDL

ECC
ALGORITHM INIT IN ST :
  POS := 0;
END_ALGORITHM

ALGORITHM REQ IN ST :
  POS := (POS + V) MOD 360;
END_ALGORITHM

An instance of this function block type provides a simple model for a rotating shaft. Its operation is defined by the ECC and algorithms shown above, as described below.

An occurrence of an event at the INIT input resets the shaft position POS to zero, followed by an INITO event.

An occurrence of an event at the REQ input advances the shaft position POS by V degrees, followed by a CNF event.

The shaft position "wraps around" the range {-360..360} degrees. For instance, when POS=355° and V=10° , after the next occurrence of an REQ event the value of POS will be . Similarly, when POS=-355° and V=-10° , after the next occurrence of an REQ event the value of POS will be -5° .

See the TANK_MVL system configuration for an example of the use of an instance of this function block type.