Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » Model validation error(An RT state machine is never re-entrant)
Model validation error [message #1752462] Tue, 24 January 2017 07:07 Go to next message
Ashiqur Rahman is currently offline Ashiqur RahmanFriend
Messages: 9
Registered: January 2017
Junior Member
Hi,
When Validating the simple Ping Pong project I am getting the following error but it doesn't stop me from generating the c++ code and runs fine. Can you please explain the reason or what the error means? I am novice to Papyrus.

Error Message:
An RT state machine is never re-entrant <<RTStateMachine>> <State Machine> PingerStateMachine PingPongRootElement::PingerCapsule EMF Problem

Thank you
Re: Model validation error [message #1752624 is a reply to message #1752462] Wed, 25 January 2017 15:58 Go to previous messageGo to next message
Peter Cigehn is currently offline Peter CigehnFriend
Messages: 49
Registered: September 2014
Member
Hi,

If you check the properties view for the offending state machine (you can double click on the error in the model validation view to navigate to the state machine) you will see a property named "Is reentrant". That one should be false for UML-RT state-machines.

I am not fully sure how you have created this model and this state-machine. but the tooling in Papyrus-RT should create UML-RT state-machines with this property set correctly to false. I checked this in the latest Papyrus-RT 0.8 release and there it works as expected. It could be that you have created the state-machine in some other way, or have managed to reset this property back to its default value, which is the value true.

/Peter Cigéhn
Re: Model validation error [message #1752626 is a reply to message #1752462] Wed, 25 January 2017 16:14 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 351
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 #1752763 is a reply to message #1752624] Thu, 26 January 2017 23:13 Go to previous messageGo to next message
Ashiqur Rahman is currently offline Ashiqur RahmanFriend
Messages: 9
Registered: January 2017
Junior Member
Hi Peter!
Thank you very much.

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.

However, I have got the answer of my question.

Thank you,
Ashiqur
icon14.gif  Re: Model validation error [message #1752764 is a reply to message #1752626] Thu, 26 January 2017 23:19 Go to previous messageGo to next message
Ashiqur Rahman is currently offline Ashiqur RahmanFriend
Messages: 9
Registered: January 2017
Junior Member
Hi Ernesto!
Your reply is very informative. Thank you very much for clearing my idea about isreentrant. Now I understand.

-Ashqiur
Re: Model validation error [message #1752799 is a reply to message #1752763] Fri, 27 January 2017 12:37 Go to previous messageGo to next message
Peter Cigehn is currently offline Peter CigehnFriend
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 #1752943 is a reply to message #1752799] Tue, 31 January 2017 06:29 Go to previous messageGo to next message
Ashiqur Rahman is currently offline Ashiqur RahmanFriend
Messages: 9
Registered: January 2017
Junior Member
Hello Peter!
Now the reason behind model validation error is clear. To avoid that "isReentrant" should be false.

But I am wondering why my version of Papyrus-RT which is also 0.8 is not working as expected.

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.

Thanks for your help.
-Ashiqur
Re: Model validation error [message #1752957 is a reply to message #1752943] Tue, 31 January 2017 10:18 Go to previous messageGo to next message
Peter Cigehn is currently offline Peter CigehnFriend
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.
icon14.gif  Re: Model validation error [message #1752991 is a reply to message #1752957] Tue, 31 January 2017 18:48 Go to previous messageGo to next message
Ashiqur Rahman is currently offline Ashiqur RahmanFriend
Messages: 9
Registered: January 2017
Junior Member
Thanks a lot Peter! You are a great help. Now It's clear.
-Ashiqur
Re: Model validation error [message #1753019 is a reply to message #1752991] Wed, 01 February 2017 07:59 Go to previous message
Peter Cigehn is currently offline Peter CigehnFriend
Messages: 49
Registered: September 2014
Member
Ashiqur Rahman wrote on Tue, 31 January 2017 18:48
Thanks a lot Peter! You are a great help. Now It's clear.
-Ashiqur


No problem! And you should also have a "Thank you" for providing a video of the steps that you performed, which in its turn made it very easy for me to help you! So thank you, for providing such an excellent video. Very often the "devil is in the details", and when only providing some steps to reproduce in textual form, there could be those small details not included (or implicitly implied "between the lines") that makes all the difference.

/Peter Cigéhn
Previous Topic:Access message recipients programmatically
Next Topic:why no triggerless transitions out of non-pseudo states?
Goto Forum:
  


Current Time: Mon Sep 24 05:13:26 GMT 2018

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

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

Back to the top