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]
------------------------------
Original Message:
Sent: Thu February 04, 2021 10:49 AM
From: Katherine Spencer
Subject: State Machine Transition Guards
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