BLOG about IBM Rhapsody. Contains technical information as well as more private travel stories.

Category: Rhapsody (Page 5 of 14)

Back in Motown, continue the adapter

Introduction

The next part of the trip was to Detroit, aka Motown. There were some customer visits planned and some internal training for a new collegue.

57817841614__6087F444-1266-44A6-810C-5F4A53BF0CB7
The flight was OK and everything went smooth. I picked up my rental car and then after typing in stuff for a long time the lady from Hertz told me that she could not find my car in the system…. I said, well that’s cool, I just take it and then I don’t have to take it back…
Nice try but she wasn’t going to do that. But she was nice, asked me politely to bring the car back and then pick another. Any other… So I ended up with a cool Infinity Q50. With 400 HP… cool…

IMG_0587

The rest of the trip was without incidents… except for some flooding. But I only saw that on the TV. Haven’t had any trouble with it.

IMG_0589

Back to work II

So from the MakeFileContent property there are some things you have to adapt.

What when it doesn’t work?

If you re-read the  model and you get an error message then…. you did something wrong 😉
Debugging is bnot so difficult. In Rhapsody go to the features of your model and open the “Makefilecontent” property. This will show you exectly to where it could be read…
When the make doesn’t work, try removing (or temporary) switch of the “echo off” with a rem before it. Also you can edit the makefile that is generated, copy the “cc” line and put an echo in it. Then you can see what happens.

 

Build the new Framework

Now the framework also needs to be built. This can be done from the Rhapsody Menu (“Code”, “Build the Framework”) This is only visible if you can rebuild the framework i.e. when the following property is set:

CPP_CG::QNXv7NeutrinoMomentics::buildFrameworkCommand
"$OMROOT/etc/Executer.exe" "\"\"$OMROOT\"\etc\qnxv7cwmake.bat 
qnxv7cwbuild.mak build \"CPU=$CPU\" \"CPU_SUFFIX=$CPU_SUFFIX\" \"

This should contain the call to the batchfile (and makefile) that builds the framework. The same paths and changes you’ve made to the makefile content should be applied to all the makefiles that you can find in the batchfile, they are in the OXF, OMCOM, TOM, AOM and WebComponents directories. You actuall only need the OXF but do the rest (that is only needed for animation) anyway.

TARGETS= oxflibs omcomlib tomlib aomlibs  webcomponentslib

CPU=aarch64
CPU_SUFFIX=le
MAKE=make CPU=$(CPU) CPU_SUFFIX=$(CPU_SUFFIX)  all 

all: $(TARGETS)

oxflibs:
$(MAKE)  -C oxf -f QNXv7CWoxf.mak CFG=oxf
$(MAKE)  -C oxf -f QNXv7CWoxf.mak CFG=oxfinst

omcomlib:
$(MAKE)  -C omcom -f QNXv7CWomcom.mak CFG=omcomappl

tomlib:
$(MAKE) -C tom -f QNXv7CWtom.mak CFG=tomtrace
$(MAKE) -C tom -f QNXv7CWtom.mak CFG=tomtraceRiC

aomlibs:
$(MAKE)  -C aom -f QNXv7CWaom.mak CFG=aomtrace
$(MAKE)  -C aom -f QNXv7CWaom.mak CFG=aomanim 

webcomponentslib:
$(MAKE)  -C WebComponents -f QNXv7CWWebComponents.mak CFG=WebComponents
This is the content of the batch file, all calls have already been edited to the new environment.
Then in all makefiles set the correct include paths and compiler calls: (This is my example, adapt to your own paths)
ADDED_CPP_FLAGS = $(CPU_FLAG) $(DEFAULT_CPP_FLAGS) 
 -I$(QNX_TARGET)/usr/include/c++/5.4.0 
 -I$(QNX_TARGET)/usr/include/c++/5.4.0/aarch64-unknown-nto-qnx7.0.0 
 -I$(QNX_TARGET)/usr/include -DOM_STL -I.. 
 -I../osconfig/QNX -D_MSL_NO_VECTOR_BOOL -DUSE_IOSTREAM 
  $(RHAP_FLAGS)
That should be it.
The menu recommendation for today is the poutine… (In HopCat in Royal Oak in Detroit they have a “Wladimir Poutine” on the menu. It is not healty (and looks awful) but tastes very very good.
57859282305__6C1A0295-6104-4B96-941A-E3F784C4F2EE
OK, Happy modeling with Rhapsody
Walter van der Heiden (wvdheiden@willert.de)

 

USA and Adding support for compilers

Introduction

I receive a lot of questions from people who want to generate and compile code from Rhapsody using another compiler then the ones that are in the standard installation.
Since IBM is delivering some pre-adapted frameworks but does not officially supports them it is the users responsibility to do some adaptation work.
My usual answer is: switch to the RXF. Is smaller, faster and more comfortable since we took the command-line out of the workflow.
But sometimes this is not the answer. Adapting an OXF to a new RTOS is a bit difficult but using another compiler is not that hard.
Unfortunately the documentation to do this is very scarce and not really clear. So here is a (hopefully) better guideline to do that.

USA

Last weeks I was quite busy (and in another time-zone…) Yes back in the US! Again, Florida and Michigan.
In Florida I, of course, visited my friend in Fort Myers and then went to Orlando for the IBM IoT Exchange. I had a presentation there together with Ed Grinberg from Depuy, Boston. I made the movie using my iPhone so the quality is a bit less than professional…

I was also interviewed together with Tom Capelle by the great guys of Quick Bytes, Graeme & Ryan. We spoke about the Sodius-Willert Merger.

Back to Work….

OK.. How do you create an adapter for another compiler. We assume you use C++ and want to adapt the QNX adapter to a newer version.

  1. Never change the original files of the framework. Always make copies and create your own adapter.
  2. When you have changed property files: re-read the model to update the properties in your model.
  3. Use a decent editor to edit files. I recommend notepad++, is free and awesome.
  4. The instructions are for C++, just replace C++ with C and that will work as well.
  5. Either install all tools in the same directory on ALL workstations of everybody in the project or use environment variables to align all differences. (First solution is preferred)
  6. A property file (Only the factory, factory<lang>, site and site<lang> files, not your own!) must have an extra “end” on a newline. Also escape al quotes (“) and backslashes (\)

How does it work?

If you generate code in Rhapsody, a makefile is also generated. When you press build, Rhapsody will call your makefile using an available make for that environment. How does Rhapsody knows what to call? It’s all in the properties, mate!
So assume you’ve selected

The Share Directory

This directory contains all the secrets to Frameworks. The following subdirectories are interesting:

  • etc
    contains files that must be added to the build process and the makefiles for the frameworks itself. Also contains the batch files that Rhapsody calls when building applications.
  • Lang<Language> (C, Cpp, Java, Ada)
    This contains the source-code from the framework
  • MakeTmpl
    Contains files added to the make process.
  • Profiles
    The profiles that can be loaded (The RXF is completely adapted using profiles)
  • Properties
    Contains all property files. This is where Site,prp and Site<language>.prp are located. Also the Factory.prp and the Factory<language>.prp are here. NEVER NEVER NEVER edit these!!!!

There are more directories but these are the interesting ones when making an Adapter.

Step 1, edit the sitec++.prp

So in Share\properties you’ll find siteC++.prp that is usually empty unless you have already added something. We have to add only one (1) property that we can copy from the factoryC++.prp file (Open that factoryC++.prp.  search for environment and copy the line. Add that to your siteC++.prp file)

Subject CPP_CG
  Metaclass Configuration
    Property Environment Enum      
        "MSVC,MSVCDLL,MSVCStandardLibrary,VxWorks,
         VxWorks6diab,VxWorks6gnu,VxWorks6diab_RTP,
         VxWorks6gnu_RTP,Solaris2,Cygwin,MicrosoftWinCE600,
         OseSfk,Linux,Solaris2GNU,QNXNeutrinoGCC, 
         QNXNeutrinoMomentics,NucleusPLUS-PPC,
         WorkbenchManaged,WorkbenchManaged653,
         WorkbenchManaged_RTP" "MSVC"
  end
end

end

This is the “standard”. Now I recommend deleting all the environments that you will never use to make stuff more readable. Then add your own environment, in our case we will call it QNXv7Momentics. We want all changes for our environment in a separate file, that makes it easier to exchange the new adapter with others. This file can be included in the siteC++.prp file with the “Include” statement. The content of the siteC++.prp is something as follows:

Include "QNXv7Momentics.prp"
Subject CPP_CG
  Metaclass Configuration
    Property Environment Enum      
 "MSVC,MSVCDLL,Cygwin, QNXv7Momentics, QNXNeutrinoMomentics," "MSVC"
  end
end

end

Now copy the donor environment (QNXNeutrinoMomentics) to a new file QNXv7Momentics.prp in the Properties directory. (Same procedure, open factoryC++.prp and search for “QNXNeutrinoMomentics”). You have to add the Subject, that is CPP_CG. (Properties always have a Subject and a Metaclass but you can group them in a prp file) Don’t forget the “end” statements!

Edit the properties

Now it is time to edit. You probably have to edit more but that goes beyond the scope of this BLOG. I will describe the most important ones (here you can see the escaping of the backslash and the quotes, don’t forget that!!):

Property InvokeMake String "\"$OMROOT/etc/Executer.exe\" 
\"\\\"\\\"$OMROOT\\\"\\etc\\qnxv7cwmake.bat 
$makefile $maketarget \\\" \""

Here you fill in the name of your batchfile that compiles the Rhapsody generated code. You have to create that file later (In the “Share\etc” directory)
This file contains the commands to call the make command in your environment. Now it is time to figure out how the make command of your environment works.

@echo off
if "%2"=="" set target=all
if "%2"=="build" set target=all
if "%2"=="rebuild" set target=clean all
if "%2"=="clean" set target=clean

set QNXROOT=<The root of your QNX Install>
set MAKEFLAGS=-I%QNXROOT%/target/qnx7/usr/include 
          -I%QNXROOT%/target/qnx7/usr/include/c++/5.4.0
set QNX_TARGET=%QNXROOT%/target/qnx7
set QNX_HOST=%QNXROOT%/host/win64/x86_64
set QCC_CONF_PATH=%QNX_HOST%/etc/qcc
set LD_LIBRARY_PATH=%QNXROOT%/target/qnx7/lib
set PATH=%QNXROOT%/host/win64/x86_64/usr/bin;%PATH%

make -s %target% -f %1 %3 %4 %5 %6 %7 %8 %9

This is the example for my installation, fill in the correct paths for your environment.

More Properties

The following properties determine what you give the compiler. OmFileCPPCompileSwitches is what you fill in the “Settings” Tab of your Rhapsody component.

Property CPPCompileCommand MultiLine 
" @echo Compiling $OMFileImpPath
$(CREATE_OBJ_DIR)
@$(CC) $OMFileCPPCompileSwitches -o $OMFileObjPath $OMFileImpPath
"

Property CompileSwitches MultiLine "-lang-c++ -I. 
  -I$OMDefaultSpecificationDirectory -I$(OMROOT) -I$(OMROOT)/LangCpp 
  -I$(OMROOT)/LangCpp/oxf $(INST_FLAGS) $(INCLUDE_PATH) 
  $(INST_INCLUDES) -DUSE_IOSTREAM -DOM_USE_NOTHROW_GEN 
  $OMCPPCompileCommandSet -c "
Property CCCompileCommandString ""
Property CPPCompileDebug String "-g"
Property CPPCompileRelease String "-O"
Property LinkSwitches String "-Bstatic"
Property LinkDebug String "-g"
Property LinkRelease String "-O"

The next step is to create the makefile. This is generated from Rhapsody. There is a template for the makefile with “magic” macros that expand to the information inside the Rhapsody model.

Property MakefileContent MultiLine "
**** Lots of Stuff ****
"

If your environment is close to the donor environment then you do not have to change much here. Otherwise it is possible that you have to go to all the lines and decide if that is still correct.

So… the rest will be in the next episode

Happy Modeling with Rhapsody

Walter van der Heiden (wvdheiden@willert.de)

Transylvania

Je komt nog eens ergens

That is Dutch and means something like: “You go places”. Yes I certainly do. This time I had to be in Rumania to do a training for a customer that has a development center there.
Because everything was organized in a hurry I did not really prepare well for this trip. That is, I did the necessary things but no more than that. So I was not be able to visit the HardRock Cafe in Bucharest since that is a 5 hour drive away from Sibiu where I was located. My flights would stop in Buicharest but not long enough unfortunately.
My original plan to fly to Bucharest and take a car was not a good one, Romania does not have a concept of highways like we do. So the average speed will be under 50km/h which effectively rules out using a rental car. Also the rentals were really expensive, no idea why, cars are not really expensive in Rumania.
I also did not look up anything about the place I was about to visit..

Rumania is not _really_ Europe

They are part of the European Union, without the Euro though, they use their own currency, but that was not really noticeable. KLM did not offer flights to Sibiu on their website although I managed to find flights from AMS via OPT to SBZ (OPT = Bucharest, SBZ is Sibiu) via another website. I decided to phone with the Platinum Hotline (Hey! You have to use what you’ve got!) and they advised men to use the Air France Website and…. bingo. That was possible. The wonders of Air Travel.. KLM-Air France say they are one organization but as far as I know they are far from that.
Also going in and out I had to show my ID. Schengen??? “Never heard of”…

Looking Good, or?

Coincidentally I looked on my phone in the Air France app and I noticed that there was a message. I looked on it and it said: Your flight is cancelled, please contact the ticketing Buro.
Cool. What if I had not looked??? So phone again with the hotline. This was all done during my previous trip in a car driving from Germany to France via Switzerland… They said the last part of the trip was cancelled. This was the Tarom (Rumanian Air Company) flight from OTP-SBZ. First they told me I had to fly on another day. After i (still politely) explained them that that was a real bad idea because people would be waiting for me… They completely rebooked me to a Lufthansa flight AMS-VIE-MUC-SBZ (Yes… Vienna, Munich in that order…) Hopping through Europe like a crazy kangaroo… Also I would arrive at 1:10 am on the next day.

Later at home I phoned again and now they had a better alternative, AMS-MUC-SBZ, arriving 18:00 on the correct day. “Geht doch”…

Without Status…

I had already arranged that my XP would still be booked (important, I do not want to loose my fresh status on KLM) but I noticed that contrary to KLM (Where they really treat you well as a status passenger) Lufthansa did not know me at all…. And did not let me in their lounge nor would they give me a nice chair. They promised me a window seat on the flight from Munich. I had a seat next to the place where normally the windows are. Unfortunately not on that row….
But I arrived. And on time. The hotel was also close to the airport and the company where I had to be. Going by foot was not advised so i still used taxis but they are very cheap in Rumania. (Even when the taxi driver screws you…)

Dracula

Yes… I have to mention it… The part of Rumania where I was is Transylvania. Home of the famous Count Dracula. And Vampires and so. Luckily I do not believe in that.
Sibiu is a very nice city, definitively worth another visit!!!
My friend Jan Scholten (who has been in Rumania before) told me that Sibiu has a German speaking minority and that the town was also known as “Hermannstadt“. Since it has been the cultural capitol of Europe (in 2007) a lot of Restauration took place and it looks really beautiful!

Training

This was again an example of the necessity of having a training when you start to use Rhapsody. There are so many things that you can learn very fast from an experienced person but can hardly read in a book because you cannot find the connection between all that is written.
The Rhapsody manual is 600 pages, it does not nearly cover all topics and still you find nothing unless you really know what you are looking for.
Yes, partly that is due to the fact that the Rhapsody GUI is not always as easy as it could be. But I know that people are working very, very hard to improve that. Rhapsody 8.4 will be a great step in that direction. But even if the GUI would have been perfect, it is still a lot of stuff you have to learn.

Shortcuts

Three times in a row I met people that were quite experienced in Rhapsody but still did not know the keyboard shortcuts that make life so much easier….

  • Pressing “Alt” during resizing elements on diagrams will only resize the “outer” element and leave the content of the resized element as it is. (You can do that via the normal menu as well…)
  • Pressing “Shift” when dragging up or down in a sequence diagram will shift everything under the cursor up or down. (That way you can create or fill space on a Sequence diagram)
  • You can “multi” select using Shift and/or CTRL. You can then delete multiple items but also change “common” features or Display Options.
  • In the (OK…not so really cool) Editor you can select Rhapsody Model elements with CTRL-Space. (Intellivisor) The one in Eclipse (Or VS) is better but it’s not bad at all! Saves typing!
    Have you already tried the “Mouse menu” feature? Right clicking in a diagram gives you all possible model elements for that position. You don’t have to move the mouse to the menu and back!

That’s it! Have fun modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

Transylvania

Je komt nog eens ergens

That is Dutch and means something like: “You go places”. Yes I certainly do. This time I had to be in Rumania to do a training for a customer that has a development center there.
Because everything was organized in a hurry I did not really prepare well for this trip. That is, I did the necessary things but no more than that. So I was not be able to visit the HardRock Cafe in Bucharest since that is a 5 hour drive away from Sibiu where I was located. My flights would stop in Buicharest but not long enough unfortunately.
My original plan to fly to Bucharest and take a car was not a good one, Romania does not have a concept of highways like we do. So the average speed will be under 50km/h which effectively rules out using a rental car. Also the rentals were really expensive, no idea why, cars are not really expensive in Rumania.
I also did not look up anything about the place I was about to visit..

Rumania is not _really_ Europe

They are part of the European Union, without the Euro though, they use their own currency, but that was not really noticeable. KLM did not offer flights to Sibiu on their website although I managed to find flights from AMS via OPT to SBZ (OPT = Bucharest, SBZ is Sibiu) via another website. I decided to phone with the Platinum Hotline (Hey! You have to use what you’ve got!) and they advised men to use the Air France Website and…. bingo. That was possible. The wonders of Air Travel.. KLM-Air France say they are one organization but as far as I know they are far from that.
Also going in and out I had to show my ID. Schengen??? “Never heard of”…

Looking Good, or?

Coincidentally I looked on my phone in the Air France app and I noticed that there was a message. I looked on it and it said: Your flight is cancelled, please contact the ticketing Buro.
Cool. What if I had not looked??? So phone again with the hotline. This was all done during my previous trip in a car driving from Germany to France via Switzerland… They said the last part of the trip was cancelled. This was the Tarom (Rumanian Air Company) flight from OTP-SBZ. First they told me I had to fly on another day. After i (still politely) explained them that that was a real bad idea because people would be waiting for me… They completely rebooked me to a Lufthansa flight AMS-VIE-MUC-SBZ (Yes… Vienna, Munich in that order…) Hopping through Europe like a crazy kangaroo… Also I would arrive at 1:10 am on the next day.

Later at home I phoned again and now they had a better alternative, AMS-MUC-SBZ, arriving 18:00 on the correct day. “Geht doch”…

Without Status…

I had already arranged that my XP would still be booked (important, I do not want to loose my fresh status on KLM) but I noticed that contrary to KLM (Where they really treat you well as a status passenger) Lufthansa did not know me at all…. And did not let me in their lounge nor would they give me a nice chair. They promised me a window seat on the flight from Munich. I had a seat next to the place where normally the windows are. Unfortunately not on that row….
But I arrived. And on time. The hotel was also close to the airport and the company where I had to be. Going by foot was not advised so i still used taxis but they are very cheap in Rumania. (Even when the taxi driver screws you…)

Dracula

Yes… I have to mention it… The part of Rumania where I was is Transylvania. Home of the famous Count Dracula. And Vampires and so. Luckily I do not believe in that.
Sibiu is a very nice city, definitively worth another visit!!!
My friend Jan Scholten (who has been in Rumania before) told me that Sibiu has a German speaking minority and that the town was also known as “Hermannstadt“. Since it has been the cultural capitol of Europe (in 2007) a lot of Restauration took place and it looks really beautiful!

Training

This was again an example of the necessity of having a training when you start to use Rhapsody. There are so many things that you can learn very fast from an experienced person but can hardly read in a book because you cannot find the connection between all that is written.
The Rhapsody manual is 600 pages, it does not nearly cover all topics and still you find nothing unless you really know what you are looking for.
Yes, partly that is due to the fact that the Rhapsody GUI is not always as easy as it could be. But I know that people are working very, very hard to improve that. Rhapsody 8.4 will be a great step in that direction. But even if the GUI would have been perfect, it is still a lot of stuff you have to learn.

Shortcuts

Three times in a row I met people that were quite experienced in Rhapsody but still did not know the keyboard shortcuts that make life so much easier….

  • Pressing “Alt” during resizing elements on diagrams will only resize the “outer” element and leave the content of the resized element as it is. (You can do that via the normal menu as well…)
  • Pressing “Shift” when dragging up or down in a sequence diagram will shift everything under the cursor up or down. (That way you can create or fill space on a Sequence diagram)
  • You can “multi” select using Shift and/or CTRL. You can then delete multiple items but also change “common” features or Display Options.
  • In the (OK…not so really cool) Editor you can select Rhapsody Model elements with CTRL-Space. (Intellivisor) The one in Eclipse (Or VS) is better but it’s not bad at all! Saves typing!
    Have you already tried the “Mouse menu” feature? Right clicking in a diagram gives you all possible model elements for that position. You don’t have to move the mouse to the menu and back!

That’s it! Have fun modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

Travel, travel, travel and… my EW 2019 Presentation

Back in the air

The travel continues but hey… I’m the traveling modeler…. Last week I had an appointment in France but close to Switzerland so I took the plane to Geneva again.
As usual the moment of booking is mostly right before the mail or call with the question if you could also show up somewhere else.
Flexible as I am, I always try to arrange that. This was not so easy… I had to be in the south of Germany (Rietheim) and I was is France (Cluses). On the map that was 225km. Via the road it turned out to be almost 500…. The Swiss have these “Mountains” that really take in a lot of space…
But I organize all of it and so I took the train to Schiphol (My second home) and then the plane to Geneva. Unfortunately (also as usual) flights were cancelled and I was rebooked to another flight via Paris. Via CdG, not really my favorite airport (I try to be polite)
CdG lived up to its reputation… although I was only a few meters away from the gate of my connections flight I had to take a detour to go through the pass control… ( What happened to Schengen?) But I made it in time to the connecting flight (I could even drink coffee in the lounge.)

Platinum

Yes. The lounge… since recently KLM has handed me my platinum card. I crossed 300XP within one year. (Yes KLM no longer has miles… you earn XP when you fly, like in Pokémon Go)
This makes the traveling life much more easy and comfortable. And a comfortable place to write BLOg entries…

Snow!

Yep… Snow. And a lot. After flying the second leg of the trip to Genève, I picked up my rental car and drove out of the parking lot and asked myself: What is this white stuff falling from the sky??
It was snowing. I did not expect that. Luckily Hertz was so friendly to rent me a BMW 120d xDrive. (4-wheel Drive ) with decent wintertyres. That helped. But is was quite a drive. So finally I arrived at the hotel that luckily had parking places. And (what I first noticed in the morning, a Skipass machine… I was in a ski area….

Switzerland

the next day, after a good day at the customer I drove to Rietheim in south-Germany. That was a seriously long drive. Through a lot of snow.. And again arriving in the hotel at 10pm… After the customer visit the next day I had to drive almost the same distance back. Not as far because I had a hotel room close to the airport. The next day I returned the car and flew back without trouble.

Embedded World 2019

I have written about that already: EW 2019, we had a booth there but I also had a presentation! Not entirely about Rhapsody but about SECollab, also interesting enough! Here is the link to it: video, it is in English.

That was it! Happy modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

Roger Waters Factory Pattern

Us + Them

That is the name of the Roger Waters tour. I managed to buy tickets for the concert in the ZiggoDome on June 22 and I went there with my cousin and my son. It was a bit stressful… I just arrived from Switzerland, went home by train and back to 020 by car. But I managed and… I have seen a lot of concerts, ranging from mwoah OK to fabulous but this was one of the best (if not the best) I ever saw. And I have seen Pink Floyd (Rotterdam 1993), Genesis, U2, the Stones and Peter Gabriel (multiple times)


Sound quality was absolutely awesome, before the break the show was fantastic, after the break it became breath-taking. Not bad for a 75-year-old guy…
I think the Pink Floyd guys always had fantastic sound quality but the technology now really offers them what they wanted to have 30 years ago.

The Factory you see is (of course) Battersea Power Station, as seen on the Animals Album. It was projected as were many other things. I am listening to the Animals Album while I am typing this….

Battersea Power Station from the river.jpg
By Alberto PascualOwn work, CC BY-SA 3.0, Link

 

OK… back to work. speaking about Factory…

That reminds me of the factory pattern. A nice pattern that helps you creating objects where you don’t know at compile time what class you want to use.
I always look for design patterns in one of my favourite books: Head First Design Patterns. Do yourself a favour: buy it (And in English please…, the German translation sucks.)

I use the Factory pattern in a model where I have 3 different platforms to generate code for, Linux, Windows and Keil CMSIS, and there is a possibility that it needs to be adapted to QNX as well.
I want to have a common debug output but also some interprocess communication that works different on all platforms.
This sounds easy, just define interfaces and inherit from them. (Or to be correct: create realizations)
Now that sounds cool but when you need to instantiate the objects (semi-)dynamically you cannot use that. You have to call something that is not the same on all platforms.
This is where the factory comes in. You create a global Class/Object (with a fixed name i.e. AbstractFactory) that has a static function “getInstance” (Yes correct… that is a singleton!) that checks if a static variable is already filled with a value. If NULL it will create an object and store it in the class variable otherwise it just returns the variable.

You then have a certified entry point. The Abstract Factory class should then have functions that create concrete factories for the environment. In this case I needed a LinuxFactory, a QNX Factory and a Windows Factory.

In the concrete factories you will make create_xxx functions that create objects for the classes you need. This can be multiple objects but also a singleton.

In a random class you can then call:

MyDebug = AbstractFactory::getInstance()->createDebugOutput()

This will give you a pointer to a class that handles the debug output. This is also a singleton. For the IPC it was just a “new” that created an IPC Channel.

Design Patterns rule!

Some useful reminders:

  • Separate what varies from what stays the same
  • Composition is better than Inheritance
  • Program to an Interface rather than to an implementation.

That was it, happy modeling with Rhapsody

Walter van der Heiden (wvdheiden@willert.de)

Pi-Day, STL & Memory

Introduction

Today is March 14. For Europeans this is nothing special but in the US, where they reverse month and day, this day is written as 3.14. Which is the first 3 numbers of Pi.

STL

For a customer I do some modeling to help them create a super reusable application. This project is done in C++. The more I use C++. the more I like it, it is so much easier to do stuff than in C where you have to write everything out.

But here are also caveats. I sued the string class without really thinking. To find out later that this triggers the compiler to use the Standard Template Library. A very fine piece of C++ art that cost you memory. Lots of memory…

I compiled the application with the Keil/ARM compiler where I could read the map file afterwards to see where the memory had gone. The application was 12k, the STL took 180k…..

So… now I understood why Rhapsody has the OMString Class included….

OMString

The problem with OMString is that IBM did not include much documentation on the use of the Class. “Read the OMString.h file”….

Functions

  • GetAt(Nr)
    Gets the character at position <Nr>
  • SetAt(Nr, Char)
    Sets string position <Nr> to <Char>
  • Empty()
    Clears an OMString set the size to 0
  • GetBuffer()
    Converts the OMString to a char *
  • IsEmpty()
    Checks if the OMString is empty
  • getSize()
  • setSize()
  • resetSize()
    get or set the size of the OMString
  • getStr()
    returns the OMString
  • getDefaultBlock
  • GetBuffer
  • ReleaseBuffer
  • GetLength
    returns the length of the OMString

Operators

  • compare functions
    • <, <=, >, >=, ==, !=
      Compare two OMStrings or a string and a character array,
    • =
      Assignment, assigns a character, a char array or an OMString to another OMString
    • []
      access the OMString as an array
    • +, +=
      Add a char, char array os an OMString to another OMString

 

Constructors

You can construct an OMString with:

  • another OMString
  • An old fashioned character array
  • a character
  • a void.

 

So you can create and use an OMString very easy:

OMString    MyString (“Moin moin”);
MyString+=” Auch Moin”);

It uses way less memory than the STL and gives you a lot of freedom with Strings.

Yo! Happy PiDay! And keep on modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

Pi-Day, STL & Memory

Introduction

Today is March 14. For Europeans this is nothing special but in the US, where they reverse month and day, this day is written as 3.14. Which is the first 3 numbers of Pi.

STL

For a customer I do some modeling to help them create a super reusable application. This project is done in C++. The more I use C++. the more I like it, it is so much easier to do stuff than in C where you have to write everything out.

But here are also caveats. I sued the string class without really thinking. To find out later that this triggers the compiler to use the Standard Template Library. A very fine piece of C++ art that cost you memory. Lots of memory…

I compiled the application with the Keil/ARM compiler where I could read the map file afterwards to see where the memory had gone. The application was 12k, the STL took 180k…..

So… now I understood why Rhapsody has the OMString Class included….

OMString

The problem with OMString is that IBM did not include much documentation on the use of the Class. “Read the OMString.h file”….

Functions

  • GetAt(Nr)
    Gets the character at position <Nr>
  • SetAt(Nr, Char)
    Sets string position <Nr> to <Char>
  • Empty()
    Clears an OMString set the size to 0
  • GetBuffer()
    Converts the OMString to a char *
  • IsEmpty()
    Checks if the OMString is empty
  • getSize()
  • setSize()
  • resetSize()
    get or set the size of the OMString
  • getStr()
    returns the OMString
  • getDefaultBlock
  • GetBuffer
  • ReleaseBuffer
  • GetLength
    returns the length of the OMString

Operators

  • compare functions
    • <, <=, >, >=, ==, !=
      Compare two OMStrings or a string and a character array,
    • =
      Assignment, assigns a character, a char array or an OMString to another OMString
    • []
      access the OMString as an array
    • +, +=
      Add a char, char array os an OMString to another OMString

 

Constructors

You can construct an OMString with:

  • another OMString
  • An old fashioned character array
  • a character
  • a void.

 

So you can create and use an OMString very easy:

OMString    MyString (“Moin moin”);
MyString+=” Auch Moin”);

It uses way less memory than the STL and gives you a lot of freedom with Strings.

Yo! Happy PiDay! And keep on modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

EW 2019

Introduction

And… it is time for the yearly “High School Trip” for grown-ups: The Embedded World. We used to be there every year. Even since my Tasking days I have visited the EW (First time in 1998 if I’m not mistaken)
Since I am at Willert in 2001 we had a booth (together with Easycode, Microconsult, and in the beginning, Keil ( Before they were taken over by ARM)
We gave up in 2014 but we returned in a smaller way in 2016 and 2017 together with LieberLieber (& Sparx Europe) In 2018 we skipped again but we decided to give it a try again with a new concept together with our Merge Partner Sodius and with OOSE. 
So we have a booth again. Hall 4-150.

EW

The Embedded world is a 3-day fair all about embedded. Lots of exhibitors in Software and Hardware. Lots of people I know and sometimes haven’t met in years. After 3 days you are really really tired from standing and talking all day and part of the evening.
Also, of course, we are traveling to Nürnberg on Monday, for me that means travel to Bückeburg on Sunday evening… Then we built up the booth, most of it is done by a company that builds up the booth but we have to install some stuff ourselves.
We are always in the same hotel… it has changed ownership a couple of times but we are still there, not because of the great rooms (the are not great… the are OK.) but because it is quite near the fair and because of the great steaks they serve there. And… no… i will not tell you where it is 😉
The very nice thing is that the embedded scene is quite small so you know lots of people there. People change jobs so sometimes they work somewhere else (Like Emmanuel, he worked for us years ago, he has built the Target Debugger together with Alberic)

Stress

Then 3 days of stress. 3 presentations in the forum in Hall 2, and speaking with (potential) customers and giving demo’s. At night visit partners and then to the hotel, eat a steak and sleep.
After 3 days my feet hurt and then at 17h the gong sounds and we can pack the car and drive back to Bückeburg. Where we will arrive in the middle of the night… But it was all worth it. We’ll be back!

 

 

So that was it for today, I spoke with a lot of potential new Rhapsody customers!

Happy modeling with Rhapsody ( wvdheiden@willert.de )

 

And to India again!

Introduction

I love India. Friendliest people on earth, awesome food, great country! So I was happy to go there again. I was there to do some support/training in a large project with many people. All in Rhapsody and all in C++.

The Trip

The disadvantage was that I would be in India for a week, so that would cost me two weekends traveling. So on saturday morning I got up at 6 (am -> the wrong 6…) and before 7. I was sitting in the train to Zwolle that was surprisingly filled. Now, that part of the trip went very well, apart from the early hour of course.
Step-over in Zwolle to Schiphol and I arrived there on time.
I love Schiphol, great airport. It is really big but you hardly notice that, everything is being signed out very well. As long as you speak English or Dutch you will not have any problems finding stuff (Eat your heart out Munich and Paris…)
Checking in took longer than usual since I found out I was not checking in at the normal KLM booth (Hall 1 or 1A) but in 3 with Jet Airways.
I booked KLM, as usual, but it was a code sharing flight. I’ve been busy last weeks (Wauw: Tell us more new things….) so I did not really had studied the flight data.
It turned out I had quite a funny flight. All flights were Jet Airways, not a single segment was KLM, luckily also not Air France… On the outgoing trip I first flew to New Delhi, then to Mumbai and then to Hyderabad. Not really efficient… There are many direct flights from DEL to HYD. But OK. It is what it is. Rebooking was not possible, all flights were full.
So I checked in, left my good old Eagle Creek Roller at the desk and went to the KLM Lounge.

First Leg

It went faster than I though, I could hardly eat a small breakfast and then the screen said that the flight was already boarding. So I hurried to the plane, a Boeing 777 and quickly found my chair. A nice chair (Business class this time!!!) The flight left on time at 11:20 and it was good, Jet Airways is fine, nice staff and great food (Indian of course!!)
We arrived in Delhi on time and in the dark. Last time in Delhi I found out that there actually 2 airports in Delhi with the name “Indira Gandi Airport” Read “Incredible India”. This time I was OK (I thought…) because the connecting flight was in the same terminal. Even if your luggage is checked “through” (The label on the suitcase already contains all destinations) you still have to pick up your suitcase from the belt and bring it through customs and then check it in again.
With some trouble I managed to do that. I did not check the monitors on the airport so after going through security again ( Which was “Pedantic”… I had to completely unpack all my backpacks…) I started looking for the right gate. Just to find a monitor where my flight was indicated as “cancelled”. !@#$%^&*(
I started looking for help and at another gate with personnel from Jet Airways to ladies told me to wait, someone would come and sort it out.
Pff… But now I had time to organize an internet connection. That is not easy in India, there is “Free WiFi” but that works with a text message to your mobile phone. You first fill in your phone number, then you opt-in for some things and they will send you a Text Message with a code. Then you have to hack on your phone until the login screen comes again and give that code (with the phone number again, all very tiresome.
But that did not worked… I tried several times: no Text… Then I remembered that I am the new proud owner of an iPhone XS and that I have 2 SIM cards. The normal Willert Phone and my Dutch number.
So I tried it with the dutch number and: Bingo! a Text message and yes… I had internet. OK… only for 30 minutes… So I could FaceTime with home and then post on Facebook. Then I routinely checked my mail just to find 2 mails from KLM with a new Ticket and new Travel information… from hours before… So the cancellation was apparently nothing new.

Second Leg

Back to the ladies from the Jet Airways desk. Just when I did that the Manager appeared and started to speak with people who appeared from nowhere. With some pressure he looked at my stuff and organized some guy to escort me out of the secure area. He brought me back to departures where I tried to check in again.
It appeared my flight was now rebooked to Air India (?) at 7am (?) and directly to Hyderabad (!) OK. I would arrive an hour later than planned… that was doable.
Getting a ticket was not.. I went from booth to booth until I found a guy that was willing to help. He organized that my suitcase came back and that I could check in at the Air India Booth. he even brought me to the lounge (through security!) so that I could try to sleep a little bit. It was no 4:00 am and I still had 3 more hours…
No sleeping though… the lounge was noisy (Parents with small kids… really??) so after some coffee I went to the plane. This was again a 777, the business class was completely  empty. Shortly before take-off an Indian guy came in with lots of people around him. He was something important I think. the staff was crawling around him to bring stuff and wait for orders. Luckily they did not forget me (I was hungry…) and I was served breakfast. The Business Class was the widest I have ever seen. I had a huge place, the chair before me was really far away. A large screen was built-in but I could hardly see it. Not that I wanted, after breakfast I turned my chair into a bed and slept for the rest of the flight.
That went quite well. The Taxi from the hotel was not there (They had received my mail that my flight was cancelled) so after 25 hours I was in the hotel. Time for a nap..

Work!

I had the reast of the sunday to rest a litte bit. I did not sleep long. First a phone call from the check-in desk… then a knock on the door from somebody that wanted to fill the minibar. Grr.
So I already prepared for the busy week. I had to support a project where many people work on with very different levels of Rhapsody expirience. It is what it is… UML and certainly Rhapsody are not easy to learn. reading a book and do a 2 day training is not nearly enough to become expirienced. Not even beginner level can be reached. It requires a lot of effort and patience to become an expert there.
For all it is learning the process of MBSE. It is very different from just hacking source-code. These are the questions that you should ask yourself on different levels of the development process:

  • WHAT must be done
    • We take Use-Case diagrams for that. Add Sequence Diagrams and/or Activity Diagrams to explain the requirements. This is the base for the planning on what the system does.
  • WHO will do it
    • This is the domain of the archtectural Diagrams such as Class, Object, Package, Structure, Component and Deployement Diagram. They define the architecture of the system.
  • HOW must we do it.
    • Here we use Statecharts and activity diagrams, also flow-charts. Here we define the behavior of the system.

Of course this is not Waterfall anymore, we are agile! So we wil iteratively go through all these phases until we are done.
Thi smeans that just creating a class as placeholder for a statemachine and just adding a state to be able to respond to events is not the way to use MBSE.
Objects have states, the light is on or off. Objects also move between states and not only from inner to outer states.
The secret to finding out what states we have is to use many, many sequence diagrams. They will clear your mind and give you the information needed to define nice small statemachines that are understandable and re-usable!

So. That was it from India. I”ll be back!

Walter van der Heiden (wvdheiden@willert.de)

« Older posts Newer posts »

© 2025 Rhapsody TechBlog

Theme by Anders NorenUp ↑