Engineering System Design

 View Only
  • 1.  State Machine Transition Guards

    Posted Thu February 04, 2021 10:50 AM
    Edited by System Test Wed March 22, 2023 11:52 AM
    Is there any limit to what Rhapsody will accept as a Transition Guard on a State Machine?  We tried to set an exact date and time for the guard and we were unable to compile the simulation.

    ------------------------------
    Katherine Spencer
    ------------------------------
    #EngineeringSystemDesign
    #Sustainability


  • 2.  RE: State Machine Transition Guards

    Posted Fri February 05, 2021 08:07 AM
    The content of a transition guard should resolve to a boolean - true or false.   If it is a date you want to check, you could make that work if you had an operation or function you could call that checked that date and returned a true or false.

    ------------------------------
    Edmund Mayer
    Systems and Software Engineer
    IBM Engineering
    ------------------------------



  • 3.  RE: State Machine Transition Guards

    Posted Mon October 07, 2024 08:28 AM

    Whenever I run through the list of discussion, I get the feeling, that I need to add additional information to that one. Even though it may be solved since a very long time.

    Ed's answer is fully correct. 

    However it is important, to either check that guard condition at that exact point in time (only then it returns true), or it must be checked very very often (typically with a resolution, which is by factor two higher, than the checked time). 

    Why is that? 

    That is because the guard condition will only be checked directly after entry of the state, which can be left via the guarded transition, or if any other parallel state in an AND-region gets triggered.

    If the guard condition evaluates to false while checked initially, but becomes true somewhat later, the transition will not happen automatically. It requires a new external trigger to that state machine, to force a new evaluation of the condition. If that does not happen, the transition will never be taken.

    On the other hand, a timeout based self transition every 500 ms at that state may create thousands of useless checks, if the time to be checked, having a resolution of one second is rather far away. 

    In such a case I'd recommend to get the current date & time at state entry, calculate the number of milliseconds until the guard will/shall become true, and then start a timeout based transition with exactly that delay time. But of course verify, that the number of milliseconds does not exceed the maximum value range for timeouts in the framework.

    I think, this is relevant information, which shall be available, when running through the discussions and reading this one.

    Have fun developing with Rhapsody,
    Martin



    ------------------------------
    [Martin] [Stockl]
    [SodiusWillert Germany]
    [
    Embedded Real-Time Systems Modeling Specialist]
    ------------------------------