Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » How to use thread in papyrus-rt application and are there more samples projects?(about how to use threads in papyrus-rt application and sample projects)
How to use thread in papyrus-rt application and are there more samples projects? [message #1737923] Thu, 14 July 2016 08:10 Go to next message
xiaoyu qu is currently offline xiaoyu quFriend
Messages: 5
Registered: July 2016
Junior Member
I've tried the project in "Combining Papyrus RT with normal Code", seems the thread configruation in Top.Controller does not work in C++ code generation.

My question is how to apply these threads to the cooresponding Capsules?
And is theare a conception of logical thread and physical thread, just like RSARTE.

Are there any sample paypus-rt applicaitons for guide purpose? one PingPong project is not enough for me to understand how to use the paypus-rt in developing applications.

BR/Xiaoyu
Re: How to use thread in papyrus-rt application and are there more samples projects? [message #1737997 is a reply to message #1737923] Thu, 14 July 2016 19:30 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Note that the Top.Controller file is a temporary measure until we implement threading support within the Papyrus-RT. It is provided for experimentation only and it will be replaced once with implement a better thread mapping capability.

The Top.Controller file is used to map a capsule role to an OS thread.
The syntax within that file is "[capsule|capsulePart] = OSThreadName". Each assignment needs to be on its own line.
For example:
Top = TopController => The runtime creates the "TopController" OS thread and assigns the Top capsule it.
Top.pinger = =PingerController => The runtime creates the "PingerController" OS thread and assigns the "pinger" capsule part from the Top capsule to it.

The "LEDEmbedded" model was meant to illustrate a design pattern to interface to hardware and was not meant to be executable.

We have not yet decided how we will approach the concept of "logical threads" and handle its migration to Papyrus-RT. This will be implemented as part of the "thread mapping" capability mentioned above.

There are more sample models available in the Papyrus-RT git repository under models/samples folder (org.eclipse.papyrus-rt/models/samples). Note that not all these models are complete. The largest runnable model in that folder is "ComputerSystem". That, along with PingPong, is the model I typically use for demos. Note that none of these models have been updated to the current Neon stream. As such, these models come with no guarantees. Current plan is to have them available from within Papyrus-RT when the project leaves incubation (i.e. at v1.0).

I hope this helps.


/Charles Rivet
Re: How to use thread in papyrus-rt application and are there more samples projects? [message #1738008 is a reply to message #1737997] Fri, 15 July 2016 00:15 Go to previous messageGo to next message
xiaoyu qu is currently offline xiaoyu quFriend
Messages: 5
Registered: July 2016
Junior Member
Hi, charles,

Thanks for your answer.

Sorry for send same question twice, that because I did not notice the warning the question need passed review first before it's shown.

I've update the Top.Controllers file as you said, but seems the C++ Code generator does not use it at all. The output TopControllers.cc only has a DefaultControllers. Maybe I miss to do something?

BR/Xiaoyu
Re: How to use thread in papyrus-rt application and are there more samples projects? [message #1738009 is a reply to message #1738008] Fri, 15 July 2016 03:21 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

For the time being, and until we get the thread mapping capability in the tool, the generated code should not change. Since it is mainly a way for us to test threads and cross-thread communications, the Top.controller file is used directly by the runtime if it exists, which is why it is expected to be in the same location as the executable to be run, i.e., by default where the code is generated. There is actually a command line debug API that lets a user specify alternative thread assignment files at startup (as well as dumps of interesting information.

I thought this information had been placed in the wiki, but I can't find it. I'll get it up there as soon as possible.


/Charles Rivet
Re: How to use thread in papyrus-rt application and are there more samples projects? [message #1738020 is a reply to message #1738009] Fri, 15 July 2016 06:56 Go to previous messageGo to next message
xiaoyu qu is currently offline xiaoyu quFriend
Messages: 5
Registered: July 2016
Junior Member
I tried the CLI input of PingPong application,

>cat Top.Controllers
Top = TopController
Top.pinger = PingerController
Top.ponger = PongerController

Run the PingPong app,
~/workspace-papyrus/PingPong_CDTProject/src > ./TopMain -c./Top.Controllers

However, still only one busy thread can be seen in output of "top -p + H"command.
I do not know what is the problem.

By the way, I used Papyrus-RT 0.7.2.
I've clone 1.0.1 source code, there are many examples there. And seem my Top.Controllers is right, Maybe the 0.7.2 version TopMain does not support the -c option?

BR/Xiaoyu


[Updated on: Fri, 15 July 2016 07:23]

Report message to a moderator

Re: How to use thread in papyrus-rt application and are there more samples projects? [message #1738105 is a reply to message #1738020] Fri, 15 July 2016 17:55 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Hi Xiaoyu,

It may depend on the updates you applied to your installation. There is a point where the way that functionality worked was modified.

Do you have a copy of Top.controllers in the same folder as your model? If not, I would suggest placing one there.

You may also be interested in trying the new Mars.1/Neon Stream of Papyrus-RT. Check out the tester installation from the Papyrus-RT wiki if you are interested.


/Charles Rivet
Re: How to use thread in papyrus-rt application and are there more samples projects? [message #1738203 is a reply to message #1738105] Mon, 18 July 2016 06:39 Go to previous message
xiaoyu qu is currently offline xiaoyu quFriend
Messages: 5
Registered: July 2016
Junior Member
Hi, Charles,
After I put Top.controllers under the model root directory, the C++ generated code had all the configured thread controllers.
The running result also proved the capsule has been assigned to a new thread.

I am working on some pilot testings on Papyrus-RT formal release, not it is 0.7.2. Seems it can satisfy our expectation.
Later, I will continue to try the example in tester installation, and recommend Papyrus-RT to our team, later may contruct applications on top of it.

As an C++ programer, I feel model driven tools are very attractive, and open source will give them a brilliant future.

Thanks again for your help.
BR/Xiaoyu
Previous Topic:How to use thread in papyrus-rt application and are there more samples projects?
Next Topic:Import RSA profile from cli/CI?
Goto Forum:
  


Current Time: Thu Mar 28 08:24:18 GMT 2024

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

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

Back to the top