|
Re: Change event in state machine [message #1011334 is a reply to message #1008636] |
Tue, 19 February 2013 10:44 |
Eclipse User |
|
|
|
Hi Yannick,
such an expression can be as simple as a LiteralString or as complex as an
AST (expressed with UML::Expression). The only restriction is that the type
of the ValueSpecification being used must be of type Boolean (well, this
isn't even a formal constraint). The spec says "A Boolean-valued
ValueSpecification that will result in a ChangeEvent whenever its value
changes from false to true."
Regards,
Marc-Florian
"Yannick S." schrieb im Newsbeitrag news:kfft6o$nm3$1@xxxxxxxxe.org...
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 17:28 |
Yannick S. Messages: 15 Registered: February 2013 |
Junior Member |
|
|
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 19:30 |
Camille Letavernier Messages: 952 Registered: February 2011 |
Senior Member |
|
|
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
Camille Letavernier
|
|
|
|
Powered by
FUDForum. Page generated in 0.02949 seconds