Components in State Machine
Description
The
AState stateMachine machineis consistscreated inby combining components such as “State” and “Transition”. These elements are used to construct rules that define a setseries of states, a setseries of possible inputsinputs, and rules to trigger transitions to another state or transition to itself forin anyresponse to the input.
The following eight types of elements can be used as components of a State Machine in the Scene Composer. These can be selected from the toolbar at the top of the possibleState inputs.Machine Editor panel and placed on the diagram.
States
A
Initial State
The Initial State is a special state denotesthat a given logical status. Each state machine shall have an initial state, which isindicates the entrystarting point forof the state machine. WhenThere ais always one of these in each state machine, and when the state machine is executedexecuted, itprocessing always starts alwaysfrom this Initial State.

State
A State represents a specific logical state. It indicates the current operation and conditions within a State Machine, and specific actions can be performed when a State starts or ends. All actions associated with a State are executed sequentially when a State starts (OnEntry) or ends (OnExit). These actions can be set in the initialproperties state.panel or Fusion editor after selecting the target State.


Transition
A stateTransition can haverepresents a setconnection ofbetween actionstwo associated when the state is activated (On Entry)States and when deactivated (On Exit). All actions defined for the state changes are executed when enteringspecific orconditions leavingare met. Transitions aggregate the state.

Transitions
One or more transitions can be defined between two states. A transition is executed when the associated condition is met.
A transition aggregates a sendersending object, a conditioncondition, and an action. If the condition is evaluatedevaluates to true, the action is executed. Transitions are evaluated based on theirthe logical order according to their definition.defined.

In
CGI Studio provides a large number of standard events for its controls and a predefined set of conditions to choose from.

Set Transition Priority
Whenif multiple transitions are connected to the same state, you can set the priority of the transitionstransitions. For details, see here.

Subchart
A Subchart is a structure that groups one or more States and Transitions. The lower right corner of a Subchart in the diagram is marked with an “S” to distinguish it from a normal State.

Subcharts can be setconnected into twoother ways. Transitions are checked in order of priority,States and theSubcharts transitions that matchon the conditionsdiagram, areallowing executed.you Thisto featyrecreate isflexible usefulflow whenstructures. Double-clicking on a Subchart will display the conditionsdetails forwithin theit. occurrenceAs of multiple transitions are the same.

Entry/Exit Point
A Entry Point and a Exit Point are pseudo-states that enable controlled entry and exit to and from a Subchart. They function as clear starting and ending points for entering a Subchart. By setting multiple Entry Points, you can start a Subchart from different points depending on the conditions. Similarly, by draggingsetting multiple Exit Points, you can provide different exits depending on the conditions.

Example of Subchart Configuration Using Entry/Exit Point
The following is a simple example of a configuration using a Subchart and droppingEntry/Exit themPoints.

In the figure below,above, Transition_1the Subchart "SubChartState_1" is placed on the diagram.
History State
A History State is a special State that is placed within a Subchart, and it has the highestrole priorityof and Transition_3 hasremembering the lowest priority.


Example Exitof TransitionsHistory ].State TransitionsConfiguration
The orderedfollowing fromis highesta prioritysimple toexample lowestof priority,a andconfiguration canwith bea reorderedHistory usingState placed in the [Subchart.

In the figure below, ExitTransitions 0 (= Transition_1) hasabove, the highestSubchart priority"Media" andwith ExitTransitionsHistory 2State (=is Transition_3)placed hason the lowestdiagram.

State Machine Behavior
When entering the Media state as well as when exiting the Media state, OnEnter of the Media state as well as OnEnter of the stored most recently selected Media device state (Bluetooth/USB/Radio) will be called.
See State Machine Solution for a sample state machine solution using History State.
Note
In a State Machine Editor, you can add Note to the diagram to supplement the information. This helps you to visually organize the design content and notes.


Choice
Choice allows you to branch Transitions. This makes it easy to edit state machines that define different behaviors based on multiple conditions.
Example of Choice Usage
In the State Machine diagram below, the transition starts from the Initial State on the diagram and transitions to the Evaluate State.

The priority of a Transition (Exit Transition) connected to a Choice is the same as the normal Transition priority change procedure.
By utilizing Choice, multiple conditions can be clearly organized within the state machine, making it easier to visually grasp the branching structure. This makes it possible to design complex logic in a simple manner.