Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Change event in state machine(How do I express a simple change event)
Change event in state machine [message #1008636] Wed, 13 February 2013 11:25 Go to next message
Yannick S. is currently offline Yannick S.Friend
Messages: 15
Registered: February 2013
Junior Member
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 #1011334 is a reply to message #1008636] Tue, 19 February 2013 10:44 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Yannick S. is currently offline Yannick S.Friend
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 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
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
Re: Change event in state machine [message #1018191 is a reply to message #1016534] Wed, 13 March 2013 10:59 Go to previous message
Yannick S. is currently offline Yannick S.Friend
Messages: 15
Registered: February 2013
Junior Member
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.
Previous Topic:how to create a ClassDiagram which can get all elements of another ClassDiagram created?
Next Topic:Using ports for state machine interactions
Goto Forum:
  


Current Time: Wed Apr 24 21:05:59 GMT 2024

Powered by FUDForum. Page generated in 0.02949 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top