State Machines Part-2: Guard Conditions

Posted Mar 2, 2021, 2:24 PM UTC

12
active-objectOP•

This second lesson about STATE MACHINES introduces "GUARD CONDITIONS" as a mechanism of making your state machines more flexible. This concept will be needed in the upcoming lessons where I'll discuss the promised other variants of state machines.

The project for this lesson is to build a state machine for a time-bomb controller. You'll see why the static state transitions are insufficient to down-count for an arbitrary number of seconds. You'll then see how a choice pseudostate and GUARD CONDITIONS checked at run-time can be applied to make the state machine flexible to do what you want.

You'll see the state machine design performed in the freeware QM modeling tool. Later the design will be manually coded in C, whereas you will see how the choice pseudostate and guard conditions map to the C code.

2
AutoModeratorMOD•

To respect Reddit's Self-Promotion rules, AutoModerator will submit your content for you in a little bit. Thank you for your patience.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1