Functions linked to states

How Functions are treated

The figure below shows how functions (that are state dependent) are treated.

 

FunctionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. (function step)

run function

- Initializes exceptions on new state M1_CmdState <> M1_ReqState and on errors set in M1_StatusWord

- Goes to exit function when an exception occurs

- Acknowledges running

- Performs all actions needed for the function until the function call command is reset

stop function

- Performs all actions to properly leave this function

- Acknowledges end of exit, by setting M1_AckState to M1_ReqState

- Returns to last state

 

How to add a new function

To add a new function, do as follows:

  1. copy a similar existing function sequence
  2. replace the old function name by the new one (e.g. 'Running' by 'MyFunction')
  3. modify the exit section of the new function to perform the relevant actions
  4. insert the needed function code into the run part
  5. add the function call command line to the state sequence where the function is used