Transition Action and Condition Action in Stateflow










0















In the below two state charts , the first one has an action to perform when it moves from StateA to StateD , ie. /z=5;
and the second one has to perform the action z=5;
I understand that this is a Transition Action , but i am unable to understand what is the different between the two transition



enter image description here



enter image description here










share|improve this question
























  • See uk.mathworks.com/help/stateflow/ug/transition-action-types.html

    – am304
    Nov 16 '18 at 9:08















0















In the below two state charts , the first one has an action to perform when it moves from StateA to StateD , ie. /z=5;
and the second one has to perform the action z=5;
I understand that this is a Transition Action , but i am unable to understand what is the different between the two transition



enter image description here



enter image description here










share|improve this question
























  • See uk.mathworks.com/help/stateflow/ug/transition-action-types.html

    – am304
    Nov 16 '18 at 9:08













0












0








0


0






In the below two state charts , the first one has an action to perform when it moves from StateA to StateD , ie. /z=5;
and the second one has to perform the action z=5;
I understand that this is a Transition Action , but i am unable to understand what is the different between the two transition



enter image description here



enter image description here










share|improve this question
















In the below two state charts , the first one has an action to perform when it moves from StateA to StateD , ie. /z=5;
and the second one has to perform the action z=5;
I understand that this is a Transition Action , but i am unable to understand what is the different between the two transition



enter image description here



enter image description here







matlab charts simulink statechart stateflow






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '18 at 0:35









Phil Goddard

9,2161925




9,2161925










asked Nov 16 '18 at 8:14









beastboybeastboy

73128




73128












  • See uk.mathworks.com/help/stateflow/ug/transition-action-types.html

    – am304
    Nov 16 '18 at 9:08

















  • See uk.mathworks.com/help/stateflow/ug/transition-action-types.html

    – am304
    Nov 16 '18 at 9:08
















See uk.mathworks.com/help/stateflow/ug/transition-action-types.html

– am304
Nov 16 '18 at 9:08





See uk.mathworks.com/help/stateflow/ug/transition-action-types.html

– am304
Nov 16 '18 at 9:08












2 Answers
2






active

oldest

votes


















1














See the link given by @am304 for specific information, but in brief,



  • in your first image you have a Transition Action, which executes when the transition occurs (and after any state exit actions - if you had any for State A),


  • in your second image you have a Condition Action, which executes when any condition associated with the transition is determined to be true. You do not have any explicit conditions (i.e. nothing like e1[cond1]z = 5) so the condition is considered to be true when any event occurs. This will execute even if the transition is not made (i.e. it is only dependent on the condition.) This means that it would occur before any state exit action (if you had any for State A.)


Given the above, in your specific case (i.e. no exit actions for State A and no conditions on the transition), the two will give the same result.






share|improve this answer

























  • Thanks Phil for you answer... i understood the concept

    – beastboy
    Nov 27 '18 at 11:37


















0














The "transition action" /z=5; is equal to an "entry action" of a destination state entry: z=5;. It might look like an "elegant" solution if you have multiple destination states but want to set a value based on the previous state and lots of additional logics (not in your example).



In the model reviews our people spent too much time figuring out what exctly happened in the charts using "transition actions". The generated code was also difficult to read. In our company-wide modeling guidelines we evntually prohibited using the "transition actions" because they make the models difficult to review.



The "condition actions" z=5; in combination with the "state actions" entry: z=5; are sufficient for any logics we needed to implement.



It would be a good move for MathWorks to discontinue the transition action semantics in the future releases.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333849%2ftransition-action-and-condition-action-in-stateflow%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    See the link given by @am304 for specific information, but in brief,



    • in your first image you have a Transition Action, which executes when the transition occurs (and after any state exit actions - if you had any for State A),


    • in your second image you have a Condition Action, which executes when any condition associated with the transition is determined to be true. You do not have any explicit conditions (i.e. nothing like e1[cond1]z = 5) so the condition is considered to be true when any event occurs. This will execute even if the transition is not made (i.e. it is only dependent on the condition.) This means that it would occur before any state exit action (if you had any for State A.)


    Given the above, in your specific case (i.e. no exit actions for State A and no conditions on the transition), the two will give the same result.






    share|improve this answer

























    • Thanks Phil for you answer... i understood the concept

      – beastboy
      Nov 27 '18 at 11:37















    1














    See the link given by @am304 for specific information, but in brief,



    • in your first image you have a Transition Action, which executes when the transition occurs (and after any state exit actions - if you had any for State A),


    • in your second image you have a Condition Action, which executes when any condition associated with the transition is determined to be true. You do not have any explicit conditions (i.e. nothing like e1[cond1]z = 5) so the condition is considered to be true when any event occurs. This will execute even if the transition is not made (i.e. it is only dependent on the condition.) This means that it would occur before any state exit action (if you had any for State A.)


    Given the above, in your specific case (i.e. no exit actions for State A and no conditions on the transition), the two will give the same result.






    share|improve this answer

























    • Thanks Phil for you answer... i understood the concept

      – beastboy
      Nov 27 '18 at 11:37













    1












    1








    1







    See the link given by @am304 for specific information, but in brief,



    • in your first image you have a Transition Action, which executes when the transition occurs (and after any state exit actions - if you had any for State A),


    • in your second image you have a Condition Action, which executes when any condition associated with the transition is determined to be true. You do not have any explicit conditions (i.e. nothing like e1[cond1]z = 5) so the condition is considered to be true when any event occurs. This will execute even if the transition is not made (i.e. it is only dependent on the condition.) This means that it would occur before any state exit action (if you had any for State A.)


    Given the above, in your specific case (i.e. no exit actions for State A and no conditions on the transition), the two will give the same result.






    share|improve this answer















    See the link given by @am304 for specific information, but in brief,



    • in your first image you have a Transition Action, which executes when the transition occurs (and after any state exit actions - if you had any for State A),


    • in your second image you have a Condition Action, which executes when any condition associated with the transition is determined to be true. You do not have any explicit conditions (i.e. nothing like e1[cond1]z = 5) so the condition is considered to be true when any event occurs. This will execute even if the transition is not made (i.e. it is only dependent on the condition.) This means that it would occur before any state exit action (if you had any for State A.)


    Given the above, in your specific case (i.e. no exit actions for State A and no conditions on the transition), the two will give the same result.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 17 '18 at 14:52

























    answered Nov 17 '18 at 0:45









    Phil GoddardPhil Goddard

    9,2161925




    9,2161925












    • Thanks Phil for you answer... i understood the concept

      – beastboy
      Nov 27 '18 at 11:37

















    • Thanks Phil for you answer... i understood the concept

      – beastboy
      Nov 27 '18 at 11:37
















    Thanks Phil for you answer... i understood the concept

    – beastboy
    Nov 27 '18 at 11:37





    Thanks Phil for you answer... i understood the concept

    – beastboy
    Nov 27 '18 at 11:37













    0














    The "transition action" /z=5; is equal to an "entry action" of a destination state entry: z=5;. It might look like an "elegant" solution if you have multiple destination states but want to set a value based on the previous state and lots of additional logics (not in your example).



    In the model reviews our people spent too much time figuring out what exctly happened in the charts using "transition actions". The generated code was also difficult to read. In our company-wide modeling guidelines we evntually prohibited using the "transition actions" because they make the models difficult to review.



    The "condition actions" z=5; in combination with the "state actions" entry: z=5; are sufficient for any logics we needed to implement.



    It would be a good move for MathWorks to discontinue the transition action semantics in the future releases.






    share|improve this answer



























      0














      The "transition action" /z=5; is equal to an "entry action" of a destination state entry: z=5;. It might look like an "elegant" solution if you have multiple destination states but want to set a value based on the previous state and lots of additional logics (not in your example).



      In the model reviews our people spent too much time figuring out what exctly happened in the charts using "transition actions". The generated code was also difficult to read. In our company-wide modeling guidelines we evntually prohibited using the "transition actions" because they make the models difficult to review.



      The "condition actions" z=5; in combination with the "state actions" entry: z=5; are sufficient for any logics we needed to implement.



      It would be a good move for MathWorks to discontinue the transition action semantics in the future releases.






      share|improve this answer

























        0












        0








        0







        The "transition action" /z=5; is equal to an "entry action" of a destination state entry: z=5;. It might look like an "elegant" solution if you have multiple destination states but want to set a value based on the previous state and lots of additional logics (not in your example).



        In the model reviews our people spent too much time figuring out what exctly happened in the charts using "transition actions". The generated code was also difficult to read. In our company-wide modeling guidelines we evntually prohibited using the "transition actions" because they make the models difficult to review.



        The "condition actions" z=5; in combination with the "state actions" entry: z=5; are sufficient for any logics we needed to implement.



        It would be a good move for MathWorks to discontinue the transition action semantics in the future releases.






        share|improve this answer













        The "transition action" /z=5; is equal to an "entry action" of a destination state entry: z=5;. It might look like an "elegant" solution if you have multiple destination states but want to set a value based on the previous state and lots of additional logics (not in your example).



        In the model reviews our people spent too much time figuring out what exctly happened in the charts using "transition actions". The generated code was also difficult to read. In our company-wide modeling guidelines we evntually prohibited using the "transition actions" because they make the models difficult to review.



        The "condition actions" z=5; in combination with the "state actions" entry: z=5; are sufficient for any logics we needed to implement.



        It would be a good move for MathWorks to discontinue the transition action semantics in the future releases.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 24 at 15:58









        Evgeni VerbitskiEvgeni Verbitski

        212




        212



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333849%2ftransition-action-and-condition-action-in-stateflow%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            政党