Skip to content

FSM

The FSM (Finite State Machine) struct is needed to provide the necessary information and structs to run a State Machine.

In the FSM class you will find the functions FSM_getTime and FSM_checkTimeEvent, which implement the behavior to get the current system/target time and check if the time trigger set in the state has elapsed.

The FSM class/package can be downloaded from the Examples page.

The implementation of both functions is currently coded into the model and can/should be changed to fit your system/target needs.

It has everything predefined what you need to get started, and you are of course free to change the supplied implementations as you want. The template is called FSM and is accessible through the toolbox. You can also add it to your model by using the dialog New Model from Pattern (Ctrl + Shift + M) in your project browser.

To use this template, just put it into your model somewhere in the package that you will generate code for. You then have to draw a using relation between the classes which contain state machines, and the class FSM from the template:

FSM Struct