RFSM guards

Hi (Markus),

I just installed guard functions on some of my transitions of a RFSM state
machine. I expected that the guard function would only be executed when the
transition was triggered by the installed event. But apparently the guards
are executed at each run of the fsm even when the event that triggers the
transition was not raised. Is this the desired behavior or a bug?

Ruben

RFSM guards

On Mi, Sep 18, 2013 at 02:58:46 +0200, Ruben Smits wrote:
> Hi (Markus),
> I just installed guard functions on some of my transitions of a RFSM state
> machine. I expected that the guard function would only be executed when the
> transition was triggered by the installed event. But apparently the guards are
> executed at each run of the fsm even when the event that triggers the transition
> was not raised. Is this the desired behavior or a bug?

It's desired, the guard is checked before the 'events' table
specification. As the guard is merely allowed to be a side-effect free
predicate function, the order does not matter, hence you should not
(have to) rely on it. If you need to do sth. during a transition, you
should use the 'effect' instead.

Markus

PS: Note that the 'events' table is merely a syntactic convenience,
the guard by itself would suffice to express the same behaviour. I
have a trigger module in my queue that allows to specify more complex
conditions, including AND, negation, XOR, over multiple
steps. Internally these are translated to an extended guard function.