Task Force Rhapsody

Introduction

This week (and last week) I am in what the Germans call: “Ruhrpott” (or “Revier”, “Kohlenpott” or just “Pott”.
“Ruhr” is the river that flows through this area, “Pott” is pot, like for cooking.
The area is know for its industry, for all the Coal mines and its really, really dense population. (More than 5 million people live there but when you add the other cities that are very close, like Düsseldorf and Köln, the population is way over 10 million in a very small area.

The are has a reputation of being very polluted but this is actually far from the truth. It was cleaned up decades ago and the green area’s that they had were nurtured and cultivated. The hotel is in the middle of a green area and nice and for all, quiet!
See the pictures and you’ll understand.

Tasks

This week a question came in how to setup tasks in Rhapsody. As usual the answer is: “it depends”…
First you have to consider your Framework. I cannot speak for all but when you use OO-RTX (A single thread RXF) you have no choice: everything runs in the main task. Scheduling between your objects is done based on “Cooperation”. When you have completed your State-machine actions you basically give back control.
Using a “while(1)” in a state-machine is the same as blocking all other objects.
So you need a full-fledged Framework using an RTOS underneath.
Then you can set a Class to “active” in the features of that Class (“General” Tab) This means that ALL Objects of this class will run in their own task (Thread would be a better expression see: Threads )
So if you instantiate that Class 10 times, you end up with 10 tasks. That might not be what you want.

Structured Class

If you make a Clas active and then give this class a structure diagram you can guide the way they are assigned to a task. All classes instantiated inside an active structured class run in the same task.

That is nice but if you want to control where all statecharts run (and even change it on the fly) you just have to create your Objects “by Hand”. You just call the Class_Create function from the Object in which task you want it to run, the Create function has a Task parameter, call that with class->ric_reactive->myTask. 
Your Statemachine then runs in the correct task. Don’t forget the Class_startBehavior() function….

Here is a small Rhapsody Model with the different methods in it.

That’s it, happy modeling with Rhapsody

Walter van der Heiden ( wvdheiden@willert.de )

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.