code error for "choice" in SMD [message #1729542] |
Fri, 15 April 2016 09:15  |
Eclipse User |
|
|
|
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 460 times)
|
|
|
Re: code error for "choice" in SMD [message #1729555 is a reply to message #1729542] |
Fri, 15 April 2016 12:54   |
Eclipse User |
|
|
|
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.
|
|
|
Re: code error for "choice" in SMD [message #1729558 is a reply to message #1729555] |
Fri, 15 April 2016 13:20  |
Eclipse User |
|
|
|
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.
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.
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
|
|
|
Powered by
FUDForum. Page generated in 0.03244 seconds