Embedded Engineer and Python with Enterprise Architect

See our first shot at Python script generation with the Embedded Engineer and Enterprise Architect from Sparx Systems



For our example we used a Raspberry Pi B+ with the Adafruit LCD Pi plate.

Since the Embedded Engineer has the abillity to be extended with your own “CodeBuilder” we created an implementation for Python.

This first implementation is targeted on simply showing the Raspberries IP, a crude file navigation and functions to exit the programm as well as rebooting and shutting down the raspberry.

Besides a small python script for starting the programm every line of code was generated with the LieberLieber Embedded Engineer.


Here some examples of the CodeBuilder, the generated code and the model used to generate the code.


1.) The CodeBuilder:

Here you see a simple piece of code to generate a if/then/else statement.

2.) The domain model:

All used classes are modeled here
Domain Objects


3.) The state machine:

This is the main state machine which controls the LCD and its buttons.
The LCD is used to show text and the buttons are used to scroll inside the “root menu” and navigate the “output” (in this case the IP or a file listing)



4.) Example activity:

This “RunDirCommand” activity sends commands to the shell and writes the output to the “self.cmdOutput” list.
With a simple “ls –a –p” we get a list that can be used for navigation across directories.

If the selected output entry ends with a “/” we know it’s a folder and therefore change the workingdirectory and refresh the filelist.
If the selected output entry endw with “.py” we know it’s a python script and can be executed with a “sudo python [output entry]”
Everything else will leads to no action.


5.) Generated code:

generated python code


6.) The starting script

This simple script is all you need to start the generated state machine.

from LCDMenu import *
lcd = LCDMenu()


At last,… the generated code in action:

About Richard Deininger

Experimental Developer, Technical Consultant, EA Addin Bastler

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>