Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » 6 ports, 1 protocol. Send to 3 only issue
6 ports, 1 protocol. Send to 3 only issue [message #1798400] Fri, 16 November 2018 20:23 Go to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
I have to do an assigment for a hexapod machine.
I've created 6 ports to 6 legs which all have the same protocol.
When I send a message to for ex ports 2, 4, 6, I get an error from port 3:

Unexpected message to capsule instance Top.hexaPodController role hexaPodController on port legProtocol3 protocol LegProtocol signal ready


I do not send a message to port 3 at that moment.

How can I fix this?
  • Attachment: Hexapod.zip
    (Size: 27.25KB, Downloaded 106 times)

[Updated on: Fri, 16 November 2018 20:30]

Report message to a moderator

Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798401 is a reply to message #1798400] Fri, 16 November 2018 20:37 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Hi. It's impossible to know what's the cause without seeing the model. That error message occurs only when the state machine of the capsule receiving the message is in a state where none of the outgoing transitions have a trigger with a port p and/or message m that has just arrived on port p with message m. So if you are seeing that error, that message is arriving on that port when the capsule instance is in a state where it doesn't expect it. So there must be something wrong with the model. Can you post the model?

Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798402 is a reply to message #1798401] Fri, 16 November 2018 21:59 Go to previous messageGo to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
The papyrus model is attached with my original post.
It's a zip file Hexapod.zip

Can you download it?
Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798403 is a reply to message #1798402] Fri, 16 November 2018 22:45 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Sorry. I missed it.

Well, there is a transition in Leg's state machine that does send 'ready' to the controller. In the "Active" state you have a timeout transition. In the controller, in the "Moving" state you have a choice point with two alternatives, one with guard "counter < 3" and the other with "counter > 2". Counter is initialized to 0 in Moving's initial transition. Then the condition counter < 3 is true, and so it goes into the "Group1Moving" state, which sends the 'move' message to legs 1, 3 and 5. These legs will have previously entered state "Active.Standing" (because the controller, on entering its "Moving" state, sends the "stiffen" message to all legs". So since they are in "Active.Standing" and they receive "move", they transition to state "Active.Moving" where you set a random timer. When the timer fires, the timeout transition back to "Active.Standing" is taken, and this transition's action sends the "ready" message to the controller, which is still in "Moving.Group1Moving". On receiving this message, it takes a transition, incrementing the counter, back to the choice point. So in theory, after receiving 3 'ready' messages, it should go to "Group2Moving". But note that each time you enter Group1Moving, you are sending the "move" message again. Is this what you intend? Looks like you are sending three "moves" for each "ready" that you expect. I think you need to refactor your "GroupNMoving" states and the choice point into states that send all the moves and expect the 'ready' messages. For example, you could send all the 'move' messages in the "<3" transition (removing them from the Group1Moving" entry action), and add a new choice point used to count, changing the target of the "TriggerGrp1" transition to the new choice point. Similarly for the other Group2Moving state.

By the way, I noticed a few other odd things in your model, like the fact that you are sending the 'stiffen' message both in "Moving"'s entry actiion as well as its initial transition. So you are sending two 'stiffens' each time. I don't know if that's what you intended.

By the way, since there is a lot of replication, namely the legs, you could use replicated parts and ports, which could simplify the model and action code. Instead of explicitly defining six separate 'leg' parts, you can define just one with replication 6, and the controllwe has one 'legProtocol' port with replication 6 instead of six separate ports. Then you can refer to each of them with an index in action code, e.g. "logProtocol[0].move().send()" And, iin the controller's state machine, transitions can listen to that replicated port, and inside the corresponding action you can use the "msg->sapIndex0()" or "msg->sapIndex()" method to determine which index of the port received the message.


Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798431 is a reply to message #1798403] Sun, 18 November 2018 17:31 Go to previous messageGo to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
Great. Thanks for helping me out and I will check your findings.

The models and generated code are hard to troubleshoot. Are there opties or tips about how to speedup troubleshooting and learning all the options?
I haven't found a a lot of documentation about how to create great models in Papyrus
Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798432 is a reply to message #1798401] Sun, 18 November 2018 21:42 Go to previous messageGo to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
I've ran into a new strange issue.
Because I had doubts my changes where reflected into the generated code (I've noticed a changed log was showing the old value), I deleted all the generated code and re-generated it.

Each time I do this, I get a strange error. See attached screenshot.
Is this a known issue?


Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798469 is a reply to message #1798431] Mon, 19 November 2018 15:33 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
I'm not sure what you mean by "opties", but the problem was a problem with your model, i.e. a problem of design, not a tool problem. In the same way that if you write a program in, say Java or C++, which is incorrect, in the sense that the algorithm doesn't correctly compute what it's supposed to compute, then the Java or C++ compiler won't be able to tell you. A compiler can only give you warnings or errors regarding syntax, types, etc. but not about whether your program is correct. The same is true for modelling tools. If you want a tool that helps you find problems of design, then you have alternatives such as debugging, simulation, testing, or formal verification. Unfortunately Papyrus-RT doesn't include features for these.

It's true that there is a lack of documentation, but you can learn about designing (good) UML-RT models from the "ROOM" book [1,2], and google "Real-Time Object-Oriented Modeling". UML-RT is essentially the same as the ROOM language.

BTW: Papyrus-RT is not Papyrus.

[1] https://en.wikipedia.org/wiki/Real-Time_Object-Oriented_Modeling
[2] https://www.amazon.ca/Real-Time-Object-Oriented-Modeling-Bran-Selic/dp/0471599174
Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798471 is a reply to message #1798432] Mon, 19 November 2018 15:40 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
I can't tell you what could be the problem without seeing the Error Log. Try to reproduce the problem in a fresh, new session of Papyrus-RT.

First, in a new session, open the Error Log view ( "Window > Show View... > Error Log"). Then click the red X button to Delete the existing log (so that you get only errors which are produced in this session). Then reproduce the problem. When the error occurs, go to the Error Log view again, if it is not open. In the Error Log view there is a small button on the top (the first one), which says "Export Log". Click this button, save the log in a file and attach it here.

Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798524 is a reply to message #1798401] Tue, 20 November 2018 07:47 Go to previous messageGo to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
Yesterday in the course we managed to got the model to work. We changed the timers to set them in the Entry block and cancel them in the exit block of the states. This improved the stability.

But there was a strange issue with port legprotocol5 to leg5.
In the model, there is a trigger for legProtocols in the statemachine in the Moving state. We've noticed that we never received a reply from legProtocol5 when the move() command was send to the leg.

The only thing we did was to remove the connection between the port and it's leg and recreated it. That solved the hanging problem and the application worked as planned. Now it got clear the application hang in the choice part of Group1Moving because the reply of legprotocol5 never came and the counter never got high enough to change to Group2Moving.

Maybe the error I've uploaded sunday "papyrus_error001.JPG" was a sign to it and there was something wrong in the model.

If you want to investigate it, I am pretty sure, the issue should also occure in the model I've attached.

Thanks for your links. I shall distribute them to the teacher and my fellow students.

I shall try to reproduce the problem with the model I've uploaded and send the logfiles.

Again thanks for your great help!

Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798684 is a reply to message #1798524] Thu, 22 November 2018 16:53 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
No problem. Out of curiosity, may I ask which course is this for and which university?

Its always interesting t o know who is using the tool.
Re: 6 ports, 1 protocol. Send to 3 only issue [message #1798812 is a reply to message #1798684] Mon, 26 November 2018 07:44 Go to previous message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
I'm a part-time bachelor student. I'm following the ICT & Technology variant of this course:

https://fontys.edu/Bachelors-masters/Bachelors/Information-Communication-Technology-Eindhoven/Programme.htm

The current semester is Model Driven Development.
The hexapod is one of the assignments we have to create in Papyrus RT.

It's a steep learning curve because there is not much learning material available.
But the MDD idea is fun and I think it has great potential for the future. In my current company they also use MDD at some costumers for machine software
Previous Topic:Papyrus-rt and conformance/compatibility to UML version and UML profile
Next Topic:Can we aggregate 2 Papyrus-RT models in a model
Goto Forum:
  


Current Time: Sat Apr 20 00:20:59 GMT 2024

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

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

Back to the top