rsarte statesandtransitions best explanation ever

Upload: volo-bonetskyy

Post on 01-Mar-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    1/23

    States and Transitions in RSARTE

    States and Transitions in RSARTE1.External State Transitions.............................................................................................................2

    1.1.Effect Code.............................................................................................................................3

    1.2.Transition Guard....................................................................................................................3

    1.3.State Entry and Exit Code......................................................................................................3

    1.4.Creating a Trigger for a Transition.......................................................................................41.5.Receiving a Trigger Event......................................................................................................5

    2.Explanation of Sy!ols................................................................................................................."

    3.Su! States......................................................................................................................................#3.1.State Entry $oints.................................................................................................................1%

    3.2.State Exit $oints...................................................................................................................123.3.Suary of Su! State Transitions.......................................................................................123.4.Code Execution &rder..........................................................................................................13

    4.'inds of Transitions....................................................................................................................15

    4.1.External Self Transitions......................................................................................................154.2.(nternal Transitions..............................................................................................................1"

    4.3.)ocal Transitions..................................................................................................................1*

    4.4.Exaple +se of ,ifferent 'inds of Transitions...................................................................1-

    5.State ,iagra ppearance.........................................................................................................23

    This document explains how states and transitions (including self-transitions) work in RSARTE.It also coers composite states and state entr! and exit points. "ote that this is an explanation of

    what is possi#le with the tool and is not meant to #e a design guide.

    $

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    2/23

    States and Transitions in RSARTE

    1. External State TransitionsExternal state transitions cause an o#%ect to change from one state to another. Refer to the picture

    #elow. Assume that the state machine is in State$. If the transition &ing is triggered it will cause a

    state change from State$ to State'. The transition &ing is considered to #e an external transition

    #ecause it causes the state machine to leae one state (State$) and then enter another (State').

    The transition &ing ma! hae a guard (a #oolean expression) that determines if the transition is

    ena#led. nl! ena#led transitions can #e triggered. A transition ma! also hae effect code thatexecutes when the transition is triggered. An example of guard and effect code is shown in the

    picture #elow.

    The *+ s!ntax for the text that is shown for a transition is,

    Transition name [guard] / effect

    which in our example is, Ping [booleanGuard()] / effectCode();

    Thus Ping is the name of the transition booleanGuard()is the guard a #oolean expression that ealuates to either true or false

    effectCode();is the effect code code that executes when the transition &ing is triggered

    "ote the following,$. The two pictures a#oe come from the same state machine diagram. The onl! difference is

    that in the lower picture we hae turned on the preferences to show the guards and effects of

    transitions. SeeState /iagram Appearancefor more information.'. The actual s!ntax to use in RSARTE for the a#oe example guard is

    return booleanGuard();

    '

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    3/23

    States and Transitions in RSARTE

    0oweer the return was left off for clarit!.

    In addition to transitions *+ allows each state to hae entr! and exit code that executes when a

    state is entered or exited. Transitions guards and entr! and exit code are further explained in the

    following sections.

    1.1. Effect Code

    Effect code is code that is executed when the transition is triggered. In our example a#oe theeffect code consists of a call to the operation effectCode(). The effect code can #e an! alid 122

    code that !ou can write in a function #od!. If it3s short (one or two lines) !ou can consider

    showing it on the state start diagram. 4ut if it3s longer it3s usuall! #etter to not show it since the

    diagram can #e too cluttered otherwise. se the state chart diagram filtering preferences (+/),evelopent 0 Real Tie 0 ,iagras 0 State Cart 0 State Cart iltering &ptions) to define

    what is isi#le on a state chart diagram.

    It is important that the effect code is not #locking (for example waiting for some input) #ecause

    this will #lock the entire capsule as well as other capsules that run in the same ph!sical thread.All code that executes when a transition triggers should #e as 5uick as possi#le. If !ou need toperform longer running operations !ou should consider placing such code in its own capsule so

    that it can #e run #! a separate thread.

    1.2. Transition Guard

    A transition guard is a #oolean expression that is ealuated #efore the transition is actuall!

    triggered. If the guard is true then the transition is ena#led and can #e triggered otherwise it isnot triggered and the o#%ect remains in the same state.

    Examples of guards are,

    6 77 $ isRead!() Assuming that isRead!() is a #oolean function.

    8or our a#oe example we used a guard effectCode(). This means that if this operation returnstrue the transition would trigger and take the o#%ect from State$ to State'. 0oweer if the

    function returns false then the o#%ect would sta! in State$.

    As mentioned a#oe RSARTE re5uires that the transition guard expression is returned using a

    return statement.

    1.3. State Entry and Exit Code

    States ma! hae entr! and exit code. Entr! code is code that is executed everytime the state isentered and exit code is executed everytime that the state is exited regardless of whichtransition is triggered.

    +et3s return to our example a#oe. If State$ had exit code and State' had entr! code then thecode would #e executed in the following order,

    $. State$ Exit 1ode

    '. &ing Effect 1ode

    9

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    4/23

    States and Transitions in RSARTE

    9. State' Entr! 1ode

    1.4. Creating a Trigger for a Transition

    Transitions that originate from a state must #e connected to at least one trigger. A trigger

    represents the arrial of an eent on one of the ports of the container capsule. :hen the specified

    eent arries on the specified port the transition ma! #e triggered #! the trigger. Triggers ma! #ecreated for a transition using the &roperties iew for the transition.

    Assume we hae a capsule 1 with a port p$ that is t!ped #! a protocol & which has an in-eent

    in&ing.

    :hen the in&ing eent arries on port p$ then we want it to cause the &ing transition on the state

    chart to fire. :e should therefore create a trigger for the &ing transition.

    $. n the state chart click on the transition.'. In the Propertiesiew click the Triggersta#.

    9. 1lick the Insert Ne Transition Trigger icon.

    ;. In the

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    5/23

    States and Transitions in RSARTE

    >ou can also create a trigger from the context menu of a transition that is selected in a state chartdiagram (dd +/) 0 Trigger).

    1.5. Receiving a Trigger Event

    :hen the in&ing eent arries at the p$ port the following happens (assuming that the o#%ect is

    initiall! in State$),

    $. Eent in&ing arries on port p$

    '. The guard on transition &ing is ealuated (either true or false)

    9. If the guard is true, State$ exit code is executed

    &ing effect code is executed

    State' entr! code is executed The capsule o#%ect is now in State'

    ;. If the guard is false, The capsule o#%ect remains in State$ and no code is executed

    ?

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    6/23

    States and Transitions in RSARTE

    2. Explanation of SymbolsThe following isual marking s!m#ols ma! appear on states and transitions,

    Effect code The #lue s!m#ol on a transition indicates that the transition containseffect code that is executed when the transition is triggered.

    @ 0oering the mouse oer the s!m#ol will displa! the effect code in

    a tooltip window.@ Single clicking the s!m#ol will displa! the effect code in the code

    iew.@ /ou#le clicking the s!m#ol will open the effect code in an editor.

    Entr! code The

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    7/23

    States and Transitions in RSARTE

    Exit code The

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    8/23

    States and Transitions in RSARTE

    :arning, no trigger The !ellow warning triangle on a transition indicates that the transitiondoes not hae an! triggers defined and that it must hae at least one

    trigger. In this case the Triggers ta# of the &roperties iew for the

    transition is empt!,

    0ow to create triggers for a transition is descri#ed in 1reating aTrigger for a Transition.

    Redefined transition The small #lue arrow shows that a transition is redefined. This means

    that there is an inherited ersion of the transition in the state machineof one of the super classes. The redefined transition contains some

    modification compared to this inherited transition. 8or example it ma!hae a different target state.

    The redefinition arrow ma! appear on all elements that ma! #e

    redefined not %ust transitions.

    Inherited state Inherited states are shown as shaded or gre!ed compared to locall!

    defined states. This applies to all elements that are inherited not %ust

    states.

    D

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    9/23

    States and Transitions in RSARTE

    3. Sub StatesStates ma! contain su# states that allow !ou to #reak down the #ehaior of a state (composite

    state) into smaller states (su# states). The picture #elow shows two states State$ and State'.

    State ' contains a su# state that descri#es the #ehaior when the state machine is in State'.

    There are three transitions from State$ to State',

    ping, to an entr! point on State ' (la#eled pingin the su# state) to0istor!, to an entr! point (la#eled to!istory" !#in the su# state) sameAs0istor!, to the edge of State' (which #ehaes the same as histor!)

    There is one transition from State' #ack to State$, pong, leaing an exit point of State' (la#eled pongin the su# state)

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    10/23

    States and Transitions in RSARTE

    :e3ll go through the modeling constructs used in this example in the sections #elow.

    3.1. State Entry Points

    Entr! and exit points allow transitions at different leels in a state machine hierarch! to #e

    connected. A transition can terminate at an entr! point on the edge of a composite state. Another

    transition can then connect the entr! point with a su# state inside the composite state. There#! it#ecomes possi#le to enter a composite state and proceed directl! to a certain su# state.

    There are three wa!s in which a transition can enter a composite state,

    $) Fia an entr! point') Fia a histor! point

    9) /irectl! to the edge of the state.

    $nter via an entry point

    In the a#oe example the transition ping enters State' ia an entr! point. If ping is triggered then

    the su# state State; will #e entered.

    "ote that the transitions in the su# state diagram that originate at entr! points do not hae an!

    triggers themseles. These transitions cannot #e triggered directl! on their own #ut onl!

    indirectl! when the transitions that connect at the entr! points in the enclosing state machine gettriggered. The! hence #ehae similar to a transition that leae a %unction point and ma! hae

    effect code and guard #ut no triggers.

    $nter via a %istory point

    $G

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    11/23

    States and Transitions in RSARTE

    In the a#oe example the transition to0istor! enters State' ia a histor! point. This is a special

    kind of entr! point which is not connected #! a transition inside the su# state diagram. It is alsomarked #!

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    12/23

    States and Transitions in RSARTE

    3.2. State Exit Points

    An exit point #ehaes er! much like a %unction point. :hen a transition that targets an exit point

    gets triggered then the composite state will #e exited and then the transition that originates at theexit point in the enclosing state chart diagram will execute. 0ence a transition that originates at

    an exit point ma! not hae a trigger #ut can hae effect code and a guard.

    In our example the transition pong leaes State' ia an exit point. If it is triggered the transition

    pong in the enclosing state machine will then execute which will cause State$ to #e entered.

    A composite state can also #e exited without using an exit point through a transition that is

    directl! connected to the edge of the composite state. Such a transition can #e triggered

    regardless of which su# state that is actie.

    In our example the transitions to0istor! and sameAs0istor! are drawn directl! from the edge of

    State$. "ow State$ is not a composite state #ut if it was these transitions could #e triggered

    regardless of which su# state of State$ that was actie.

    3.3. Summary of Su State Transitions

    The following ta#le summaries the #ehaior of different kinds of su# state transitions using the

    a#oe example.

    Transition $&a'ple escription

    To an entr! point ping :hen the ping transition from State$ toState' is triggered then State' will enter

    su# state State; directl!.

    To a histor! point to0istor! :hen the to0istor! transition is triggered

    from State$ to State' the su# state of

    State' that gets actiated will #e the samestate as was actie when State' was last

    exited. If this is the first time that State'

    is entered then the su# state State9 will #e

    actiated since this is the state targeted #!the initial transition.

    To the edge of a state sameAs0istor! This #ehaes exactl! the same as theto0istor! transition as descri#ed a#oe.

    "ote that this transition is not isi#le in

    the su# state diagram.

    8rom an exit point pong The pong exit transition will #e taken if

    either of the following occurs, The actie su# state is State9 and the

    transition pong gets triggered

    The actie su# state is State; and the

    transition pong' gets triggered

    8rom the edge of a state to0istor! If State$ had a su# state then the to0istor!

    transition could #e triggered regardless ofwhich of its su# states that was actie.

    $'

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    13/23

    States and Transitions in RSARTE

    3.4. Code Execution !rder

    :hen an eent arries that matches a trigger for a transition that exits andJor enters a composite

    state there are man! code snippets that will execute. The first thing that happens is that seeralguard conditions are ealuated starting with the triggered transition. The goal with this guard

    ealuation procedure is to find a path of transitions with fulfilled guard conditions starting with

    the triggered transition and ending with the last transition that would execute if that triggeredtransition would trigger. If during this ealuation procedure a transition is found along the path

    which has a false guard condition then the current path of transitions is not ena#led and the

    ealuation procedure #acktracks and tries to find another ena#led path.

    :hen a path of ena#led transitions hae #een found the next thing that happens is that the effect

    codes of the transitions execute. :hen reaching a transition on the path which exits a state theexit code of that state is first executed #efore executing the effect of the transition. And when

    reaching a transition on the path which enters a state the entr! code of that state executes after

    executing the effect of the transition.

    +et3s look at an example which illustrates the a#oe mentioned rules,

    Assume the following, The actie state is S'. This means that S$ also is actie since it encloses S'.

    4oth t$ and t; triggers on the same eent E receied on the same port &.

    The following happens when E arries on & if the guard of t' is false and all other guards aretrue,

    $. The guard of t$ and t' are ealuated. Since the guard of t' is false guard ealuation of thistransition path is a#orted and the guard of t9 does not get ealuated.

    '. The guard of t; is ealuated. This transition is the first path that is found where all the guard

    conditions (%ust one) are fulfilled so this transition is ena#led and will #e triggered.

    9. The exit code of S' executes.;. The exit code of S$ executes.

    ?. The effect code of t; executes.

    . The entr! code of T$ executes.C. The effect code of ta executes.

    D. The entr! code of T9 executes.

    $9

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    14/23

    States and Transitions in RSARTE

    0ere we hae assumed that T$ is entered for the first time and hence would use its initial

    transition to arrie at su# state T9.

    If instead all guard conditions are true at the time when E arries on & then the following will

    happen,

    $. The guard of t$ t' and t9 are ealuated. All are fulfilled which means that this path of

    transitions is ena#led and t$ will #e triggered.

    '. The exit code of S' executes.9. The effect code of t$ executes.

    ;. The exit code of S$ executes.

    ?. The effect code of t' executes.. The entr! code of T$ executes.

    C. The effect code of t9 executes.

    D. The entr! code of T' executes.

    $;

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    15/23

    States and Transitions in RSARTE

    4. Kinds of TransitionsThere are three different kinds of transitions, external internal and local. The! differ in how the

    entr! and exit code is handled.

    The transition kind is set in the indfield in the &roperties iew of the transition.

    A special categor! of transitions are self-transitions. These are transitions that hae the same stateas source and target. All internal transitions are self-transitions while external and local

    transitions ma! #e #ut does not hae to #e self-transitions.

    4.1. Externa" Se"f Transitions

    External self transitions #ehae like other external transitions (seeExternal State Transitions) i.e.

    the state is exited and then it is entered again. This means that the code execution order is thesame as for all other external transitions first the exit code of the state executes then the effect

    code of the transition and finall! the entr! code of the same state.

    The picture #elow shows a state Top with two external self-transitions goActie andExternalTrigger.

    $?

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    16/23

    States and Transitions in RSARTE

    Top is a composite state which means that when either of these self-transitions is triggered su#

    states will first #e exited (from inside out) then Top will #e exited then the transition effect willexecute then Top will #e entered and finall! su# states will #e entered (from outside in). In

    general the following happens,

    Exit code for the innermost state is executed Exit code for the next outer state is executed

    ..... Exit code for the outermost state is executed Transition effect code is executed

    Entr! code for the outermost state is executed Entr! code for the next inner state is executed .....

    Entr! code for the innermost state is executed

    See 1ode Execution rderfor the detailed rules of code execution when entering and exiting acomposite state.

    4.2. #nterna" Transitions

    :hen an internal transition triggers the state machine sta!s in the current state. This means that

    the onl! code snippet that executes is the effect code of the internal transition. The exit and entr!code of the state does not execute.

    Internal transitions are normall! shown in a separate compartment in a state s!m#ol. An icon in

    its top-right corner shows the presence of internal transitions and !ou can dou#le-click this iconto show or hide the internal transitions compartment. 0ere is an example of a state with an

    internal transition t$,

    If the state is composite RSARTE also supports showing the internal transitions as #order

    transitions in the su# state chart diagram. The! are shown using a dashed line and #! default the!are placed inside the state chart diagram to further emphasie that an internal transition does not

    leae the state when it is triggered.

    $

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    17/23

    States and Transitions in RSARTE

    An internal transition can #e used as an eent error handler. 8or example assume that !ou hae a

    state machine with man! states and transitions. If an eent arries when the state machine is in anunexpected state then the eent could go unhandled. To aoid this !ou can create an enclosing

    composite state (let3s call it Top) with an internal transition for eer! eent that can #e receied

    #! the state machine. If eer!thing is functioning as it should these internal transitions will neer

    execute since the transitions that go #etween the su# states will #e triggered instead of theinternal transitions on Top. 0oweer if an eent arries which does not trigger an! of the other

    transitions (#ecause the state machine is in an unexpected state) then an internal transition in Top

    will #e triggered and can handle the unexpected situation in its effect code.

    4.3. $oca" Transitions

    +ocal transitions execute the effect code for the transition and the exit and entr! code for all su#states #utnotthe exit and entr! code for the state to which it is connected. +ocal transitions are

    hence onl! meaningful for composite states (if the state is non-composite the! #ehae the same as

    internal transitions).

    A local transition alwa!s originates from the #order of a su# state chart diagram. The! are drawnusing solid lines to distinguish them from internal transitions in case the local transition is a self-transition.

    0ere is an example of a composite state State$ with a local self-transition +1,

    If the state I""ER is actie when the +1 transition is triggered the following will happen,

    $. The exit code of I""ER executes.'. The effect code of +1 executes.

    9. The entr! code of I""ER executes. "ote that the local transition terminates at a histor!

    point and since I""ER was preiousl! actie it will #e entered again without executing the

    initial transition.

    In general the following happens when a local transition is triggered,

    Exit code for the innermost state is executed

    Exit code for the next outer state is executed ..... Exit code for the outermost state is "T executed

    $C

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    18/23

    States and Transitions in RSARTE

    Transition effect code is executed Entr! code for the outermost state is "T executed Entr! code for the next inner state is executed

    .....

    Entr! code for the innermost state is executed

    +ocal transitions ma! #e used to simplif! a state diagram. If we hae man! states and want to #e

    a#le to go to a specific state regardless of which state we are in then we could create an

    enclosing composite state and draw a local transition from that state to the state that we want togo to. :ithout the enclosing composite state we would hae to create a transition from eer!

    state to the desired target state.

    An example of this is the go*iddleActie transition shown in the picture #elow. It originates

    from the edge of the Top state and terminates at the *iddleKActie su# state. :hen the transition

    is taken it will cause the Top state to go to the *iddleKActie su# state regardless of which su#

    state of Top that is actie. The transition is local to Top and will not cause an! exit or entr! codeof Top to execute #ut onl! the entr! code of *iddleKActie and its su# states.

    4.4. Exam%"e &se of 'ifferent (inds of Transitions

    As an example of using the different kinds of transitions let3s look a little more on the example

    with the Top state that was shown preiousl!. To get a #etter oeriew look at the picture #elow

    where the Top state is shown with its su# states isi#le inline.

    $D

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    19/23

    States and Transitions in RSARTE

    The Top state has the following transitions,

    $&ternal transitions*

    ExternalTrigger+eaes state Top and returns #ack to the edge of state Top. Therefore it is the same asentering Top ia a histor! point.

    goActie+eaes an exit point and returns to a specific entr! point which will go directl! to the

    *iddleKActie su# state ia the to*iddleActie transition and then further to the

    InnerKActie su# state ia the toInnerActie transition.

    Initial

    *akes the Top state the default state of its state machine. :hen the o#%ect is created

    the Initial transition is taken and its effect code executes. Then Top is entered.

    Top contains two su# states *iddleKInit and *iddleKActie and the following transitions,

    Internal Transition

    InternalTrigger

    :hen this transition triggers onl! its effect code is executed. "o entr! or exit code isexecuted.

    $

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    20/23

    States and Transitions in RSARTE

    +ocal Transitions

    +ocalTrigger

    This transition will execute its effect code and the exit and entr! code for the actie

    su# state (direct or indirect) #ut it will not execute the exit and entr! code for Top.

    go*iddleInit

    :hen this transition triggers it will cause a transition to state *iddleKInit regardless

    of if *iddleKInit or *iddleKActie was the actie state. The entr! code for*iddleKInit will #e executed #ut the exit and entr! code for Top will not #e executed.

    go*iddleActie:hen this transition triggers it will cause a transition to state *iddleKActie

    regardless of if *iddleKInit or *iddleKActie was the actie state. The entr! code for

    *iddleKActie will #e executed #ut the exit and entr! code for Top will not #e

    executed.

    to*iddleActie

    This transition originates at the entr! point where the goActie transition comes infrom the Top state in the enclosing state machine. Therefore this transition ma! not

    hae an! triggers. It can onl! execute when the goActie transition is triggered.

    0oweer this transition ma! hae effect code and a guard condition.

    $&ternal Transition

    InitialThis initial transition is taken when entering the Top state without using one of the

    entr! points. This happens when creating the o#%ect since the initial transition of the

    enclosing state machine goes to Top.

    8inall! let3s look at the *iddleKActie state machine. It contains two su# states InnerKInit and

    InnerKActie and the following transitions,

    +ocal Transitions

    goInnerInit

    :hen this transition triggers it will cause a transition to state InnerKInit regardless ofif InnerKInit or InnerKActie was the actie state. The entr! code for InnerKInit will #e

    executed #ut the exit and entr! code for *iddleKActie will not #e executed.

    goInnerActie:hen this transition triggers it will cause a transition to state InnerKActie regardless

    of if InnerKInit or InnerKActie was the actie state. The entr! code for InnerKActie

    will #e executed #ut the exit and entr! code for *iddleKActie will not #e executed.

    toInnerActie

    This transition originates at the entr! point where the to*iddleActie transition comesin. If we look in the enclosing state machines we see that this transition path originates

    in the Top state and consists of the transitions goActie to*iddleActie and

    'G

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    21/23

    States and Transitions in RSARTE

    toInnerActie. All these transitions ma! hae their own effect codes and guard

    conditions #ut onl! the first one (goActie) ma! hae a trigger.

    $&ternal Transition

    Initial

    This initial transition is taken when entering the *iddleKActie state without usingone of the entr! points. This happens when creating the o#%ect since the initial

    transition of the enclosing state machine goes to *iddleKActie and the initial

    transition of the top-leel state machine goes to Top.

    The ta#le #elow shows some scenarios for the a#oe example and the order of code execution

    that takes place in each case,

    ,cenario Initially

    -ctive ,tates

    Code $&ecution ,e.uence

    1apsule incarnation "one Effect code of Initial (to Top state)

    Entr! code of Top Effect code of Initial (to *iddleKInit state)

    Entr! code of *iddleKInit

    The local transition

    go*iddleActie is

    triggered

    Top

    *iddleKInit

    Exit code of *iddleKInit

    Effect code of go*iddleActie Entr! code of *iddleKActie Effect code of Initial (to InnerKInit state)

    Entr! code of InnerKInit

    "ote that the Top state is neer left since

    go*iddleActie is a local transition.

    The local transition

    +ocalTrigger istriggered

    Top

    *iddleKActieInnerKInit

    Exit code of InnerKInit

    Exit code of *iddleKActie Effect code of +ocalTrigger

    Entr! code of *iddleKActie Entr! code of InnerKInit

    "ote that the Top state is neer left since +ocalTrigger

    is a local transition. 4oth InnerKInit and *iddleKActie

    are howeer exited and then entered again.

    The internal

    transition

    InternalTrigger istriggered

    Top

    *iddleKActie

    InnerKInit

    Effect code of InternalTrigger

    Since InternalTrigger is internal no states will #e exited

    and entered when it triggers. nl! its effect codeexecutes.

    The local transitiongo*iddleInit is

    triggered

    Top*iddleKActie

    InnerKInit

    Exit code of InnerKInit Exit code of *iddleKActie

    Effect code of go*iddleInit Entr! code of *iddleKInit

    '$

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    22/23

    States and Transitions in RSARTE

    The externaltransition goActie

    is triggered

    Top*iddleKInit

    Exit code of *iddleKInit Exit code of Top

    Effect code of goActie

    Entr! code of Top Effect code of to*iddleActie

    Entr! code of *iddleKActie Effect code of toInnerActie Entr! code of InnerKActie

    goActie is an external transition so all states are exited

    all the wa! up to Top. The path of transitions that start

    with goActie consists of 9 transitions and leads to theInnerKActie state.

    The externaltransition

    ExternalTrigger is

    triggered

    Top*iddleKActie

    InnerKActie

    Exit code of InnerKActie Exit code of *iddleKActie

    Exit code of Top

    Effect code of ExternalTrigger

    Entr! code of Top Entr! code of *iddleKActie

    Entr! code of InnerKActie

    "ote that the ExternalTrigger transition terminates atthe #order of the T& state. This is e5uialent of

    entering the state using a histor! point which is wh!

    the states Top *iddleKActie and InnerKActie areentered again without executing the initial transitions.

    ''

  • 7/25/2019 RSARTE StatesAndTransitions Best explanation ever

    23/23

    States and Transitions in RSARTE

    5. State Diaram Appearan!eThe appearance of a state chart can #e changed #! using the &roperties iew of the selected state

    chart diagram. As a reader of a state chart diagram !ou ma! find it useful to temporaril! change

    some of the appearance settings. 8or example turning ,%o Transition $ffectson could help to

    de#ug the transition effect code. Another setting that could #e useful is the ,%o Transition$vents. It will displa! the eent(s) that trigger a transition. The picture #elow shows the

    Appearance ta# of the &ropertites iew for a state diagram.

    The picture #elow shows the effect of the