The Blog for Rhapsody (Power) Users.

Month: October 2017

State-chart

USA

Screen Shot 2017-10-22 at 13.35.47

Table of states visited

My first visit to the US was in november 1999. I had to be in Salt Lake City for work and took the opportunity to visit my friend Arno, who lived in Philadelphia back then. He worked in DC and I flew there to drive with him to Philly.
From there I went to Utah but  on the way back l took a small stop in New York to complete a real cool trip with a visit to already a number of states.

Cancelled flight

From that moment on I flew to the US almost once a year on average. And kept on visiting states. In 2004 I was on the way to Las Vegas together with Andreas Willert for the I-Logix Kick-Off Event. We booked the flight from Amsterdam via Minneapolis. We travelled a few days before the conference and wanted to drive around Las Vegas to see some of the Parks there. I already booked a hotel for the first night in Vegas and we planned on driving around and find ourselves places to stay on the go.
Unfortunately, KLM/North-West were not able to produce a working plane on the day we were supposed to fly so we had a forced night out in Amsterdam.
I phoned the hotel in LV to shift our stay for one day, just to find out that the next night was “Superbowl night” and the hotel price would not be $49,- but $249,-…
So I told the to shove their room somewhere dark and let KLM deal with it. It was their fault. (But my problem……as I found out later)
Luckily a have a friend who lives in “020”(As we from Rotterdam call our Capital, it’s the telephone area code) guided us through the city and after some beers (and some more) the next day we stood, slighty hangovered, before the KLM desk to get a room in LV for the next night.
They could not help us, this would have to be sorted out in Minneapolis they said.
So we first flew to Minnesota and went to the KLM desk over there to find out how they planned to get us in LV. It turned out to be a quite late flight that would arrive in LV on 00:30. They also told us to sort the hotel thing out when we arrived in Las Vegas.
This is where I intervened and said: no way I fly to LV without a hotel room.
So after some negotiations KLM booked us a room in Minneapolis and we rented a car to drive to LV because: What’s the difference? We wanted to drive around in LV and now we were driving around in the USA. No difference?

A small difference…

As it turned out, there was a small difference. We landed in Minneapolis, we noticed that it was snowing there. What we first noticed after we rented a car and went to five (5!) sliding doors to pick up our rental car. After each door the temperature dropped for more than 10ºC….
It was cold there. And I mean really cold. On the way to the hotel we were overtaken by a snowmobile. That was the first time I saw a sno-bolie in my entire life….
In the hotel we watched television just to find out that the USA was in something they called “The Blizzard of the Century”….
So the driving thing turned out to be a co-called “Bad Idea”
( “Bad Idea” is a trademark of  Microsoft Corporation )
So we decided to drive south as soon as possible to find better weather and to avoid going through the Rocky Mountains where this would certainly be worse.
So we did 3500 kilometers USA with at least 95% of that through the snow. Even on the Grand Canyon there was 50cm of snow. We have seen more crashed trucks and cars than in the rest of my life.
But we arrived in LV where is was nice and warm. And we passed about 12 states on the go.

State Count

As you can see in the state-chart, my current state count is 33, I hope that the next trip will bring me at least 2 more.

State-machines

OK, now a little about UML and Rhapsody. State-charts or state-machines are an important part of UML but certainly of Rhapsody. This, of course, stems from the fact that Mr. State-machine, David Harel, is the founder of I-Logix, and one of the fathers of Rhapsody and Statemate, it’s predecessor.
Although it is said that David Harel invented state-machines, this is not true, he merely described them thoroughly for the first time. His definition was take into the UML.
There are many more implementations and definitions of state-machines.

State-machines are excellent when you implement behavior that has discrete logic. For Control loops, it may look tempting to use a state-chart but that is a mistake. There are far better mechanisms to model continuous behavior.

Example

Picture: You have a new job at the software department of “El Cheapo” a manufacturer of computer LCD monitors, know for it’s really good value for money displays.
Your new boss gives you the assignment to make the software for a new monitor that El Cheapo will release soon. The monitor is aimed at the lower end of the market so it has only 4 buttons: one for on/off, one for switching between brightness and contrast and 2 to control whatever you have selected (plus and minus)
You remember from your last job that you had a UML Training with Rhapsody (from some Dutch guy…) and decide to use that for your new job.
After 2 hours of thinking you have your first version ready:

Monitor Statechart

Not bad for a new guy, you think and you are on your way to your boss to tell him about your success.

Your boss is impressed until he starts asking you about the “evMode”, “evDown” and “evUp”. “Where are these events coming from?” he asks.
“Easy”, you say, “The hardware guys have to send these events from the button interrupts when they program the hardware drivers”.
Your new boss starts rolling his eyes and drops backwards back in his chair. “INTERRUPTS???” he shouts! “No interrupts allowed over here!”. “Do you have any idea how dangerous interrupts are??”.
You ask: “But how do you detect that buttons are pressed then?”. “The safe way”, your boss replies, “by polling all inputs every 100 milliseconds”. “Sigh”, you think.
But no matter how you try to explain that this is so wrong, you are eventually forced to curb your enthusiasm and go back to the drawing board.

But… you never give up without a fight and you come back with another plan. You have learned in your Rhapsody Training (from that vague Dutch guy…) that you can tweak the generated code from Rhapsody using properties (see Properties. Stairway to heaven, highway to hell….) and you start tweaking the state-chart. You ignore the Framework (see Real-Time Framework, the robust base for your embedded applications. ) and you come up with this solution:

Monitor Statechart 2

All events are replaced by guards. The state-chart code is now tweaked so that the generated function (rootstate_dispatchevent() ) can be called by the 100mS loop.
Some quick tests prove that this also works and now without interrupts.

Really???

Is the second state-chart really a functional copy of the first?

NO!!! it is not. In this example nobody would notice because 100mS is fast enough to fool humans. But suppose you press both the “mode” and the “up” button within the 100mS time frame. Which one is pressed first?
You can never know since you were not looking. The first state-chart knows while that uses interrupts and the framework. Events are stored in the queue and processed according to the FIFO principle.

You have to choose which of the variables “mode”, “up”, and “down” has the highest priority. And react too that. So the state-machine should actually look like this:
That is the big difference between these methods.

You have to take the priority into account and then create the state-chart like this:

Monitor Statechart 3

If I show this state-chart during training, people tell me: “Walter… you always told us to use state-charts because they make it easier to understand your application.”, “This is not understandable”.
And they are right… this is not what I call a good and understandable state-chart. It’s a chaos. I checked it multiple times but I’m still not convinced that it is really 100% OK…

An easier way!

What!!?!! there is an easier way? Yes, there is… This is actually the state-chart that does the exact same as the one above here.

Monitor Statechart 4

Does that state-chart remind you of something? Another diagram maybe?

It should… It is an activity diagram. Or flow chart (As the activity diagram of an operation is called in Rhapsody). Check it out here:

activityDiagram

An activity diagram…. does the exact same that the state-chart does. And.. If you compare the LOC (Lines Of Code) you will see that the real state-chart (the first example with the events) uses more code then the activity diagram but it is more correct. The other examples (And certainly the incomprehensible one) use way more code and are much slower!

Conclusion

Use state-charts when you have discrete logic. For continuous logic or polling solutions: use activity diagrams or flow charts. Or use Matlab Simulink for control loops.

That’s it for today, happy modeling with Rhapsody

Walter van der Heiden (wvdheiden@willert.de)

 

USA II – The Falls.

And…. back…

Well not completely. Just sitting at the Delta Terminal in Detroit and waiting for the flight back to Schiphol Airport.
It has been a busy week with many customer visits, conf-calls and our Engineering@Scale event at the GM Heritage center.
Thanks for everyone that was there, it was cool. I think I have sent my presentation to everybody, if not… it is here: Pres – UML Modeling vs Coding E@S TD Detroit
The Willert Software Tools Movie that explains the use of tools in an Automotive field is here: Seamless Model-Based Development Process for Embedded Software Engineering

AUTOSAR

I had a cool demo with me, we (or actually Clemens….) managed to bring a first prototype of the RXF ArcCore RTE Connection. Still some “WorkToDo” but we have already a good working example where we can base the rest on. We are working in parallel on reading ARXML and extracting the relevant UML elements like ports, interfaces, variables, defines, types, runnable names, software components, so we can automate the process of using UML for the embedded automotive engineers. We are working to implement at least 2 use cases for the use of Rhapsody in Automotive environments:

UseCase 1 – Architecture

If you want to do your architectural work with Rhapsody, we want to offer a way to export stereotyped UML/SysML elements to an ARXML file. We’re currently not completely sure what we want to export, if you have ideas: SEND THEM!!

UseCase 2 – Behavior

You already have an architecture, you have defined SWC’s (or Runnables) and you want to implement (some of) them in Rhapsody. This is the UseCase that we are pursuing first (Because it is easier, we more or less know what to do, we have done it already for an older version of Rhapsody and an older version of AUTOSAR)

Niagara Falls

So. A brief overview of what we are working on. In 3 weeks I am back in the USA for more visits, AUTOSAR Conference and the IBM ICE Meeting.
This weekend we did a “round Lake Erie”. That takes you through Canada, Niagara Falls, Buffalo, Cleveland and back to Detroit. That was pretty cool, here are some pictures.

That’s it! Happy modeling with Rhapsody!
Walter van der Heiden (wvdheiden@willert.de)

 

USA

Travel fun

This week I’m in the US, Detroit to be precise. Flew in last week on Friday. First to Fort Myers of course, my good friend Arno lives there and I always visit him when I’m in the US.

I always say: Florida is Paradise. Nothing better than drive around in a convertible in South-West Florida. Weather is always good (Well… if there is no hurricane….) and the life is generally good there.

But on sunday afternoon, we (Me and my son Robbert) had to leave paradise to go to Motown.

That was easier said then done, Delta had an airplane ready but apparently some important piece was missing and it was not allowed to fly without it. (They refered to the part as “cover” which sounded pretty innocent to me…) So they had to get a new part, it turned out they had one in Fort Lauderdale. Close enough (100 miles, 160km through the air) but somehow they could not really get an airplane ready to fly it over. They’d also sent a car and that finally arrived 4 hours after the original time of start….

Fixing the plane took 2 minutes and then we could board. We had planned to arrive in Detroit at 19h but it became 23:30. Not cool. The hotel was also almost 50km from the airport so after checking in and unpacking it was 1 o’clock. The alarm was set to 6… short night.

What are we going to do in Motown? Well… as usual I cannot give any names but I’m visiting a couple of automotive companies (Now that is a tough guess….) and on Thursday we have our engineering@scale Tech Day. In the GM Heritage center, that’s going to be fun.

Rhapsody Q&A

We had a Rhapsody Q&A Session on monday. In German. There were some interesting questions, I’ll try and copy some of the questions and answers.

Rhapsody Tips ‘n Tricks

Roundtrip?

Rhapsody has some default settings that are chosen, lets say, “unluckily”…. One of them is the setting for showing so-called SourceArtifacts. That is default set to “Hide” which leads to very confusing situations with people who just started using Rhapsody. The best way is to, when you start a new model, immediately select “View”, “Browser Display Options”, “Show Source Artifacts”. This will make your life easier. If you see Source Artifacts in your Browser and you didn’t change anything: Loose them! (Right click, delete from model)

Another good one is to set the “C_Roundtrip::General::RoundtripScheme” Property to “Basic” or “Advanced”. This will prevent Rhapsody to try to include your typing errors in a model. You can still edit the body of your operations and the Enter/Exit code of state-charts/actions. With Advanced you can even add operations and attributes in an editor.

Rhapsody performance

Rhapsody is slow when model are bigger. That was not a question but the actual finding of a user. How can I make Rhapsody faster, especially the loading of “larger” models?

  • You can do load on demand. If you call the “Open” dialog you seen on the far right a few fields that you can tick: “With/Without Subunits”, “restore Last Session” and “Load on Demand”. You can only load the base rpy file and load the rest when you need it (Right click, “Load…” or “Load with subunits”, speaks for itself) When you close the model, “Restore..” will open only the stuff you had already opened and “Load On Demand” should open only the stuff you are using, unfortunately it is not implemented 100% yet. But try it, it will save some time.
  • Using your model from an SSD drive will greatly improve user experience… Using your model on a network drive will drive you nuts.
  • Having many properties seem to slow down the loading also, apparently Rhapsody needs to build the property tree and that takes time when it has a lot of overrules.
  • If you can: divide your model into multiple sub-models that you load “by reference”

Larger Models

Divide your model into multiple models that you can include where needed. If you have a model that has a certain driver in there, you can copy that into another model (Open a new model, do “Add to Model”, locate the .rpy file, click on “As Unit” and “Copy Into Model”. Then select the package you want “Tick “Add Dependencies” as well) This way the model has new GUIDs and there will be no conflicts when you use the package.
Save and and then you can open the original model, ditch the package you just copied and do “Ad To Model” again, this time adding the packag from the new model “As Reference”.

You can no longer edit the package(But you shouldn’t either!!) You can, however, create a Workspace and load all the models you use into it. You can then switch projects without opening and closing Rhapsody. (“File”, “Insert Project”, “Existing Project”)

So. I hope we have enough time this week to explore Detroit (Motown) a ittle bit better. The Skyline at night looks good!

dreamstime_l_10513728

That’s it for now: Happy Modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

 

Engineering@Scale Tech Day

Join us for Engineering@Scale Tech Day. Learn how new solutions and technologies are helping to lead the innovation agenda while addressing the complexity challenge in the automotive industry.

This event will focus on engineering systems and software development.  We will feature sessions around industry best practices and the core processes of requirements management, architecture design, collaboration, change and configuration management, test and quality management, product line engineering and variant management. Improve your skills, network and collaborate with industry experts.

What to expect:

  •  Keynote session by the American Center for Mobility
  •  Technical sessions for novices to experts, with topics ranging from:
    •  Scaling Agile to the Automotive Enterprise
    •  Convergence of MBSE and the Product Innovation Platform in Automotive
    •  Connected Product initiatives with Digital Twin and Digital Thread
    •  Improving your processes with Automtoive SPICE
    •  Feature-based Product Line Engineering and Operations for the Automotive Enterprise
    •  Certifiable framework for AUTOSAR
    •  And more
  •  Networking Lunch (no charge)
  •  Plus, tour the spectacular automotive collection at the GM Heritage Center.

 Register today and share wtih a colleague!

General Motors Heritage Center
6400 Center Drive
Sterling Heights, MI 48312

Thursday, October 12, 2017 from 8:00 AM to 4:00 PM (EDT)

Ask the Master.

Or Rhapsody Q&A

A short BLOG entry this time. On Monday, October 9 13:00-14:30 CET, we organize an Ask the Master Webinar. Feel free to join and fire questions about Rhapsody to the Master. (That’ll be me…) Just a small info: It will be in German! (With Dutch accent…)

Ein kurze BLOG heute. Montag 9 Oktober von 13u- 14u30 organizieren wir ein Webinar “Ask the Master”. Meld dich an und werde all deine Fragen über Rhapsody los bei der Guru ( An dem Tag bin ich das…) Es wird in Deutsch sein (Mit Holländischen Akzent)

Ask the Master
Wir laden Sie ein:
Am Montag, den 09.10. /  13.00 – 14.30 zu unserer Websession:
Rhapsody – Questions & Answers
Herr van der Heiden wird Ihnen dieses Mal ganze 1,5 Std zur Verfügung stehen, um Ihre Fragen rund um das Thema Rhapsody zu beantworten und Ihnen Tipps und Tricks verraten.
Die Websession ist kostenlos. Sie müssen sich nur anmelden.
Anmeldung:

© 2025 Rhapsody Tech Blog

Theme by Anders NorenUp ↑