Module 9 - State Machine Part 1 Flashcards
state machines define the behavior of a system . a state machine diagram provides a view of a state machine behavior.
three kinds of behaviors are
state machine shows up on a STM
activity shows up ACT
interaction shows up SD
weakness of activity diagram ?
cannot answer which ____ invokes that action
structure
swimlane tells reader which structure performs the action
1 not an intuitive diagram
weakness of a sequence diagram ?
#2 harder for people to understand who are not familiar with sysml
#3
3 cannot model an idea to wait before an event is occuring
weakness of a state machine diagram
its the most specific behavior .. it defines a set of states and transitions between states as events occurs . BUT not every object falls in line with a state machine diagram
an owned behavior is a behavior under a block within your model.
a single block can have multiple behaviors nested
under it
classifier behavior
classifier behavior = owned behavior . the attitude control state machine is nested under the block
a classifier behavior is a special role that the behavior plays in the owning block
the behavior that you select to be the classifier behavior for a given block is the behavior that will begin executing ___________ when the block is instantiated
automatically
two top level categories of elements that a state machine can own
Vertices
Transitions
which are vertices in this diagram ?
orbit insertions
knowledge check
two kinds of vertices
1) states
2) pseudo states
and two kinds of transitions
1) external transitions
2)
internal transitions
when is an internal tranistion
three common kinds of states
1) simple state
2)
3) final state
4) submachine state ( not covered in the course) but its how you represent a nested state machine inside a state machine
composite state
two common pseudo states
1) junction pseudo state
2) ______ pseudo state
initial
state machines can have multiple _____ represented by dashed lines
regions. Each region must have at least one active state in a region.
a state machine may transition from one event to another one when an event occurs.
what are the names of the events in this state machine ? when an event occurs a transition may fire resulting in a change in a state.
guard must be true when the event occurs in order for an transition to fire.
startup Event
Shutdown Event
focus on the may if a sensor is in the offline state and a startup event occurs . might happen that powerAvailable == False.
“at rest” in a state means the state is looking at the event pool waiting for the state to
occur
what happens when an event occurs in a state machine ?
it begins by going to that owning ___________ event pool .
object
The state machine consumes that event pool occurrence . at the moment of consuming an event pool the guard gets evaluated
what happens when an outgoing transition fires ?
The run to completion STEP is
#1 Do behavior is terminated
#2 then the run to completion step _____
#3 exit behaviors run and cannot be interrupted
#4 Transition effect behavior cannot be interrupted.
#6 then the next entry behavior is guaranteed to finish
and the state machine is not at rest and is not looking into the event pool.
begins
Transition effect behaviors is
when a run to completion step is executing the state machine behavior is not at rest . Its not looking a the owning objects ____ ______
event pool.
a state machine is at rest and a trigger event occurs for a transition coming out of a different state
ORBIT INSERTION STATE – what is the run to complete step ( sequence )
1. the STM begins executing and there is a run to completion step in the beginning of the STM.
2. Fire thruster transition executes
3. (entry behavior ) Read Temp executes
the state machine is not at ____while the run to completion step is running
rest
ORBIT INSERTION STATE goes into rest behavior and then what behavior executes ?
Do behavior - Execute Spin Stabalization
when does a state look at the event pool ?
only when the state is at rest.
when does a Do behavior get interrupted ?
when a transition gets fired/begins .
the STM has a run to completion step when it executes so the STM is not at rest.
1. entry executes
4. STM is at rest and look at that event pool
2. do
3. exit
sometime later a transfer complete event occurs. the STM is at rest but it detects a new trigger happened and all of the guards get evaluated.
whichever guard is true determine which will
note : another transition is coming out of the orbit insertion state
fire
events can trigger a behavior to executing.
four common events are
1.
2. change
3. signal
4. time
call
Triggerless transition with no Do behavior .. how does it behave ? when does a completion event generate
remember a triggerless transition may fire in response to a completion event only if guard = true
the moment the run to completion step is finished. If a state has no Do behavior specified the completion event will be generated the moment the completion step is finished
which state is unreachable ?
state 3 has no Do behavior and has a behavior4 coming out of it.
when does the completion event get generated ? The moment the entry behavior in state 3 gets triggered.
it transitions immediately from state 3 to state 5
state 4 never gets reached .
which transition will never fire from the Orbit Insertion state ?
how does this get resolved ?
– Add a Do behavior in Orbit insertion - this creates a window of time to be at rest while that Do behavior is running.
– add a guard to Initialize Mans transition – this creates a window for the transition to Acquisition state to fire
Acquisition transition
what is a composite state ?
- have nested substates under it.
and how do they work ?
- they must have exactly one active state at all times ( same for multiple regions)
- could ( optional) have an initial pseudo state
- could transition from one state to another when the trigger and guard = true
exit and entry - part of a run to completion step when transition fires
Do - begins automatically when the rest period of that state ____
also extry , do and exit behaviors are optional slots in states in STM
begins
this is legal . transitions can cross over the composite state. If you do this , it does not change the run to completion step. What is different is the starting ____
substate.
What are the run to completion steps from acquisition state
- entry
- do
- Activity J transition guard = true
- Activity K transition guard = true
- Activity A entry behavior (composite state On station )
- Then the state is at rest ..
think of a composite state like an onion with layers . tunneling from outer layer into onion layer
then after some time , the state is at rest and is looking at the event pool . Now Do behaviors are possible to continue .
Activity C entry behavior ( substate )
when a state machine transitions from a composite state.
a trigger event occurs and enters the event pool. The composite states are at rest so the state machine consumes it and removes it from the event pool
when system error event occurs Activity L transition fires. Doesn’t matter which state in the composite states. The Do behaviors in the composite states get ____
aborted
when leaving a composite state .. the inner activates execute first and then the outer exit behavior executes then the transition effect executes
a check out and check in event occurs . which state will the state machine be in when it comes to rest.
checkedout.unmodifed
internal and external transitions