Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » code error for "choice" in SMD(bizarre C++ code generated for the "choice" pseudostate of a SMD)
icon4.gif  code error for "choice" in SMD [message #1729542] Fri, 15 April 2016 09:15 Go to next message
Antonio Giovannini is currently offline Antonio GiovanniniFriend
Messages: 3
Registered: April 2016
Junior Member
hi guys,
I'm quite new with UML RT and papyrus but, first of all, let me thank you all for your job.

now, I modelled the attached SMD. I arrive at the choice with one of the three triggers that are visible in the picture.
when I compile the code I receive an error due to the absence of an IF statement in the choice method...there is only an else.

Capsule_SYSImplementRules::State Capsule_SYSImplementRules::choice_____top__whichFeedback( const UMLRTMessage * msg )
{
    else
    {
        actionchain_____top__onSensing__ActionChain2( msg );
        return top__control;
    }
    return currentState;
}


in order to get the wished behaviour, I needed to modify as following
apsule_SYSImplementRules::State Capsule_SYSImplementRules::choice_____top__Choice1( const UMLRTMessage * msg )
{
	switch( msg->getSignalId() )
        {
        case signal::signal_sensorsError:
        	actionchain_____top__onSensorsError__ActionChain5( msg );
        	return top__FinalState1;
		break;
        case signal::signal_actuatorsError:
        	actionchain_____top__onActuatorsError__ActionChain6( msg );
        	return top__FinalState1;
		break;
        case signal::signal_sensingSignal:
        	actionchain_____top__onSensing__ActionChain2( msg );
        	return top__control;
		break;
        default:
    		return currentState;
            break;
        }
}


I modelled something wrong? how should I model my SMD to generate the right code?





---------------
Antonio
  • Attachment: SMD.png
    (Size: 26.28KB, Downloaded 440 times)
Re: code error for "choice" in SMD [message #1729555 is a reply to message #1729542] Fri, 15 April 2016 12:54 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Hi Antonio,

In UML-RT, you would typically not use a choice point to select the action following a certain trigger. Instead, you would draw a transition for each triggering condition that has a different effect, like is the case in your model.

That being said, when using choice points, you need to set mutually exclusive guards on each outgoing transition, not triggers. Triggers are only used when exiting states, not pseudostates. This would then only allow one of these transitions to be taken. Did you set these guards?

Please note that Final States are not part of the UML-RT language. Historically, UML-RT has been used to implement software in continuously running embedded systems. However, this has no impact on your current problem

One more question: did you validate the model before running the code generator? If so, were any errors indicated? If you did, could you please file a bug about this in Bugzilla (http://bugs.eclipse.org/bugs/enter_bug.cgi?product=Papyrus-rt), referring to this conversation.

Thanks and I hope this helps.


/Charles Rivet
icon14.gif  Re: code error for "choice" in SMD [message #1729558 is a reply to message #1729555] Fri, 15 April 2016 13:20 Go to previous message
Antonio Giovannini is currently offline Antonio GiovanniniFriend
Messages: 3
Registered: April 2016
Junior Member
Hi Charles,
thanks for the rapid answer!

Quote:
In UML-RT, you would typically not use a choice point to select the action following a certain trigger. Instead, you would draw a transition for each triggering condition that has a different effect, like is the case in your model.

ok, actually I'm more used to look at activity diagrams, so it was more..familiar. Very Happy

Quote:
That being said, when using choice points, you need to set mutually exclusive guards on each outgoing transition, not triggers. Triggers are only used when exiting states, not pseudostates. This would then only allow one of these transitions to be taken. Did you set these guards?

no. how should I have set the guards in my case?

Quote:
Please note that Final States are not part of the UML-RT language. Historically, UML-RT has been used to implement software in continuously running embedded systems. However, this has no impact on your current problem

thanks for the tip. Cool

Quote:
One more question: did you validate the model before running the code generator? If so, were any errors indicated? If you did, could you please file a bug about this in Bugzilla (http://bugs.eclipse.org/bugs/enter_bug.cgi?product=Papyrus-rt), referring to this conversation.

I had this error
Error The required feature 'notation::Edge::target' of 'Diagram::Connector' must be set Connector true SYSImplementRules EMF Problem
do you think it important to be reported?

------
Antonio
Previous Topic:Papyrus-RT presentation at EclipseCon NA
Next Topic:Unable to connect two ports inside top capsule
Goto Forum:
  


Current Time: Wed Apr 24 22:53:26 GMT 2024

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

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

Back to the top