Change event in state machine [message #1008636] |
Wed, 13 February 2013 06:25  |
Eclipse User |
|
|
|
Hello,
another beginner's question.
I have been trying to model a change event for a transition but I'm unable to express a simple statement like "when <flowport> becomes true" where <flowport> is an atomic boolean in(put) flow port.
I have created a trigger, which owns a "change event" which owns a "change expression" but I'm still unable to understand how to edit the expression to say what I want.
Would somebody have a tutorial or some explanation about how expressions are built ?
I was unable to find anything useful on the web or in this forum.
I'm using Papyrus 0.8.2.
Thank you for your help.
|
|
|
|
Re: Change event in state machine [message #1016508 is a reply to message #1011334] |
Wed, 06 March 2013 12:28   |
Eclipse User |
|
|
|
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.
Yannick.
|
|
|
Re: Change event in state machine [message #1016534 is a reply to message #1016508] |
Wed, 06 March 2013 14:30   |
Eclipse User |
|
|
|
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.
Regards,
Camille
|
|
|
Re: Change event in state machine [message #1018191 is a reply to message #1016534] |
Wed, 13 March 2013 06:59  |
Eclipse User |
|
|
|
Hello,
thank you for the explanation.
I tried removing the opaque expression and re-creating it as you instructed, but even if I take care not touching the name, it still shows the leading "=".
However, I understand why it's there and I can ignore it for the time being.
We can expect it is or will be fixed in another release (0.8.2 comes with Topcased in fact) so it's not a problem.
Best regards.
Yannick.
|
|
|
Powered by
FUDForum. Page generated in 0.34214 seconds