Table of Contents
02 Getting Started
Installation
The easiest way to get started with the HSE State Machine is by installing and using it as a module template. However, the State Machine implementation is not restricted to be used inside a DQMH module. To use it in an already existing project, follow these steps:
-
download and unzip the latest source distribution from our Releases page
-
open the
TEMPLATE.lvproj
and navigate toStateMachine.lvlib
-
right click on
HSE-State-Machine.lvlib
and selectSave
–>Save As…
; uncheckAdd copy
options and follow the dialog -
open your existing project and add the newly saved lvlib
-
open
SM DEMO.vi
and copy theState Machine Loop
,SM Create Event
andSM Destroy Event
to your Block Diagram as needed -
remove / replace the following dependencies from your project as needed
-
SM DEMO.vi
-
HSE Logger in
SM Wait for Transition.vi
-
DQMH Message Queue in
SM Update UI State.vi
-
DQMH Message Queue in
SM Process Exception Transition.vi
Adaption
-
edit
SM_States.ctl
to reflect the needed states for your project -
edit
SM_Transitions.ctl
to reflect the needed transitions for your project -
implement states and transitions as needed
-
create a case for every state
-
in each state, create a case fo each allowed transition
-
in each case, which defines an allowed transition, define the next state and, if needed, trigger an action calling a MHL case
callSM Request Transition.vi
in MHL or EHL as needed to request transitionsCommunication to the State Machine
Communication to the State Machine Helper Loop takes place over a local user event. The event reference is created when the module starts and destroyed afterwards. The events can be triggered from the Event Handling Loop (EHL) and the Message Handling Loop (MHL) to request a transition. For transitions, we always use the verb
request
and nottrigger
, indicating that a transition only informs the state machine about a command or something that happened. Only the state machine itself decides if this transition will actually change its state. -
code/dqmh/state-machine/getting-started.txt · Last modified: 2023/02/13 15:36 by alexander.elbert
-