|Re: Change event in state machine [message #1016508 is a reply to message #1011334]
||Wed, 06 March 2013 17:28
| Yannick S.
Registered: February 2013
Hello, Marc-Florian, and thank you for answering.|
Although I don't know the UML/SysML specification in detail, I understand that a "when" expression can be any boolean expression.
My concern is "how do I do this in Papyrus" ?
I have a block which owns an "in" flow port (named "fp"), of boolean type.
This block has a behavior, which is a state machine.
What I've been able to do is :
1/ create a "trigger" which owns a "change event"
2/ this "change event" owns a "change expression"
3/ now, how do I express a simple thing like : when "value of flow port changes to true" ? I have 14 different types of expressions available; some of them don't make sense in this case, but what's the best solution between : "expression", "opaque expression", and so on ?
I tried to enter a natural language opaque expression ("fp = true"), named "myopaqueexp" and what Papyrus shows on the transition is :
When "myopaqueexp = fp = true"
What does this mean ?
If I don't name the expression, I get :
When " = fp = true"
which does not make more sense to me.
So could you explain how I can get :
When "fp = true"
on my state diagram ?
I could just name the expression "fp" and put "true" in the body, but then the diagram is understandable but not the model.
Also, it would be better to make a reference to the flow port itself (maybe in OCL there is a way of expressing this, but I'm not yet fluent enough ...).
Thanks a lot.
|Re: Change event in state machine [message #1016534 is a reply to message #1016508]
||Wed, 06 March 2013 19:30
| Camille Letavernier
Registered: February 2011
The diagram displays the name of the expression (If the expression has a name), then its body.|
The problem is that EMF (And Papyrus) make a difference between the empty String ("") and the absence of String (null). And the Papyrus widgets to edit a String do not allow you to actually unset a String. So, in your case... Your expression has a name, which is empty. This is a Papyrus bug. We should either allow the user to unset a String (In your case, the name of the OpaqueExpression), or improve the diagram to avoid displaying the name when it is empty.
If you really want to display "fp = true", you should remove the OpaqueExpression, and create a new one (With natural language, and Fp = true in the body). Be careful to avoid editing the name of the expression, so that it remains unset.
Powered by FUDForum
. Page generated in 0.01853 seconds