|
|
Re: Model validation error [message #1752626 is a reply to message #1752462] |
Wed, 25 January 2017 16:14 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
Huh. I had not performed validation on PingPong in a while, so that's a bit new to me.
You should take the Validation results with a grain of salt. Validation is an area where PapyrusRT is quite a bit behind, so there are models with errors that "pass" validation, and, as you seem to have found out, there can be false positives too.
How did you obtain the PingPong project? Was it by implementing the instructions from the wiki?
It is possible that the possible that the instructions are a bit outdated.
Anyway, according the the UML-RT profile definition, the "isReentrant" attribute of any capsule state machine must be false. This is because in UML-RT, the behaviour of state machines has "run-to-completion" semantics, this is, an event is handled and fully processed by a state machine, going from one stable state to another, before the next event is processed. According to the UML specification the "isReentrant" attribute of a Behavior "Tells whether the Behavior can be invoked while it is still executing from a previous invocation." So it must be false to comply with run-to-completion semantics.
The code generator ignores this attribute and simply generates code that behaves as is isReentrant is false, even if it isn't. So this explains why you can generate code that compiles and runs.
So you can ignore the error, but if it troubles you, you can manually set "isReentrant" to false in the Properties view of the state machine in question. In the Model Explorer, select the State Machine, and in the UML tab of the Properties view you should see a radio button for "is reentrant" with the options "true" and "false".
|
|
|
|
|
Re: Model validation error [message #1752799 is a reply to message #1752763] |
Fri, 27 January 2017 12:37 |
Peter Cigehn Messages: 49 Registered: September 2014 |
Member |
|
|
Ashiqur Rahman wrote on Thu, 26 January 2017 23:13
Sorry for not providing enough information in my question.
I was implementing the PingPong project demonstrated in: https://wiki.eclipse.org/Papyrus-RT/User/User_Guide/Getting_Started.
I downloaded Papyrus from http://download.eclipse.org/papyrus-rt/frozen/nightlies/0.8.0/20170112/papyrus-rt-win.zip
I checked the Papyrus with a new project and found it's setting "Is reentrant" to "true" for a state by default. I don't understand why the behavior is different from your version. Both are 0.8.
Okay, now I understand what the problem is. Unfortunately that user guide has become rather outdated. It was originally written for Papyrus-RT 0.7 (you can see this mentioned at the top of this guide). A lot of improvements have been made in the Papyrus-RT tooling since then, and they way that you create the UML-RT state-machine has improved a lot.
I see that the user-guide instructs you to create a state-machine by first creating a state-machine diagram using New Diagram > StateMachine Diagram. The problem is that this creates an ordinary UML state-machine diagram and state-machine, without any UML-RT specific customization, so you have to manually apply all UML-RT stereotypes as you can see from the guide. With the latest version of Papyrus-RT, this has changed.
The way to create the state-machine, and get all UML-RT specific customizations in place, e.g. regarding the automatic application of any UML-RT specific stereotypes, you should really be creating the state-machine by right-clicking on the capsule and select New UML-RT Child > StateMachine.
If you create the state-machine this way, then the state-machine diagram will be created automatically, and the state-machine itself will have the RTStateMachine stereotype applied automatically, including also setting isReentrant = false correctly (to avoid the validation error you got).
I guess this could explain the issues you have been seeing.
/Peter Cigéhn
|
|
|
|
Re: Model validation error [message #1752957 is a reply to message #1752943] |
Tue, 31 January 2017 10:18 |
Peter Cigehn Messages: 49 Registered: September 2014 |
Member |
|
|
Ashiqur Rahman wrote on Tue, 31 January 2017 06:29
I followed all the steps in the same way you have suggested in Papyrus-RT 0.8 but getting "isReentrant" "true" by default. Do you have any idea? I have added a short video (1:35 min) showing my steps.
-Ashiqur
I checked the video you provided, and I think that we are talking about two different things.
What you originally was referring to was whether the state-machine itself was reentrant or not. So my description was only related to how the creation of the state-machine should be made to ensure that it is created with isReentrant = false.
What you showed in the video was that when you created the opaque behavior for defining the entry code of a state, that this opaque behavior got created with isReentrant = true.
Unfortunately the support for editing the entry code is not fully in place yet. The idea is that the entry code eventually shall be edited using a separate code snippet view, see bug 494288 for more information, and the creation of the opaque behavior (and selection of language) all shall be handled by the tooling.
So there is no functionality in place yet for the creation of the opaque behaviors, and what you used in the video was the ordinary UML tab with the basic UML functionality of Papyrus.
I don't think that having isReentrant = true for the opaque behavior specifying the entry code for a state matters either. There is no UML-RT specific constraint that checks this, only whether the top-level UML-RT state-machine itself is reentrant or not.
/Peter Cigéhn
PS. I can just mention that a lot of the "bolierplate" steps that you had to perform in the video, e.g. related to importing libraries and applying additional profiles, have been improved in later versions that 0.8, e.g. if you test one the nightly builds. There is now a number of templates available in the template drop-down-list, e.g. a "UML-RT for C++" template, which apart from setting the default action language of the model to C++, also imports needed libraries like the run-time services model library and the C++ primitive types library, also applies the C++ properties profile as well as the optional UML-RT state-machine profiles. DS.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05261 seconds