Prototype of an AUTOSAR Parameter Definition Editor based on Xtext

A large part of developing an AUTOSAR ECU is the configuration of the Basic Software (BSW, i.e. the AUTOSAR “operating system”). All the parameters that can be configured are defined in the so-called “AUTOSAR parameter definition”. This includes hundreds, if not thousands of parameters for the configuration of the basic software modules.

There are a number of editors for the actual configuration of the values. Some of these work by reading the parameter definition and providing a user interface dynamically based on the defined parameters. So the ECU configurator does have graphical tools for his work.

The parameter definition itself, however, is often written with XML editors. AUTOSAR XML however is very verbose and often not really suited for human editing and inspection. Creating a textual editor with Xtext is often a good solution to provide comfortable editing. So we did a prototype for the schema definition editor based on Xtext and ARTOP.

Here is a small example of a definition for non-volatile RAM:

NVRam Parameter Definition

NVRam Parameter Definition

Using Xtext and Artop we have a number of benefits:

  • We work directly on the AUTOSAR model. We do not need a custom temporary model that we map to AUTOSAR
  • With a few lines of code, we save the parameter definition in the Xtext notation above as well as in correct AUTOSAR .arxml
  • We see the full parameter definition structure directly in Artop

2013-05-10_11h04_46The Xtext representation is more concise than the corresponding AUTOSAR XML:

What are the use cases? Obviously, this could be used by teams that provide the parameter definitions for the basic software. In addition, projects might want to define their own parameter definitions that hold additional data for the development process and should be stored in an AUTOSAR-compliant way – e.g. for being editable by the generic editors mentioned above.

 

 

 

 

Assessing architecture quality: Metrics for AUTOSAR software architecture and EAST-ADL functional architectures

Both in AUTOSAR and EAST-ADL we are defining architectures – be it on the software level or on the function level. But when is an architecture a good architecture? How to find flaws? One approach to assess the quality are architecture metrics. In the research project IMES we have implemented a set of metrics both for the EAST-ADL and AUTOSAR models. The metrics calculation is based on the Eclipse projects ARTOP and EATOP.

One of the often-mentioned metrics in literature are “Provided Service Utilization” (PSU) and its counter-part, the “Required Service Utilization” (RSU). PSU measures the degree of utilization of a “service provider” by dividing the number of actually used  service by the total number of offered services:

PSU(s)=PS_used(s)/PS_total(s)

A metric of 1.0 indicates that all offered services are being used, a metric of 0.0 indicates that none of the services is being used. Values below 1.0 are indicators for potential architectural issues.

To apply the PSU concepts to AUTOSAR or EAST-ADL, the elements “service provider” and “service” have to be identitfied in the meta-models. In AUTOSAR, obvious candidates for providers are the SwComponentTypes and SwComponentPrototpyes. Candidates for services are the ports  (it is also possible to work with the data elements of a port, resulting in a finer granularity of the metric). Picking SwComponentTypes or SwComponentPrototpyes for “provider” results in subtle differences:

2013-04-04_13h24_08

In the above model, the metrics for the prototypes are PSU(p1)=1.0 (Port op is connected) and PSU(p2) = 0.0 (not connected). For the component types, PSU(ACI1O1_A)=1.0, since it is only relevant if the port is connected at all.

Connected ports

Deciding if a port is actually connected is more complex than in the simple example above. Delegation connectors just “forward” the ports without functionality – that has to be taken into account. A port being connected through a delegation does not count as a connected port for the metrics calculation. Starting from a port, all transitive connections have to be followed to see if the port is finally connected to a software component that actually consumes data (i.e., not a SwCompositionType), or if it is delegated to the highest level or not delegated at all.

Since we also want to calculate metrics for partial architectures, we define a delegation to the root level as “connected”, but there are other approaches that define such a delegation as “unconnected”.

Side Effect for Usability

The algorithm for finding connected ports has a nice side effect: It can be offered to the user as an extra functionality. In complex models, it is often difficult to track the actual destination of data elements through a port. The algorithm makes that easy.

PSU  and CPSU

Now the PSU of SwComponentTypes and SwComponentPrototypes can easily be calculated.2013-04-04_13h36_42

In the model above, PSU(In0Out3)==0.666. The same algorithms can be used to calculate the CPSU that indicates the ratio of (connected ports/total ports) of all ports of all SwComponentPrototypes of a subsytem. A metric < 1.0 indicates that the system has unconnected ports. In the above model, CPSU = 0.5. It is important to identify prototypes that are only composition types, since they are only structural and should not be used for metrics calculation by counting ports more than once.

RSU, EAST-ADL and variants

The calculation of RSU is analogous to the PSU calculation. And the metrcis calculation is not restricted to software architectures. Metrics for  EAST-ADL analysis functions and design functions can be calculated in the same way. In fact, our implementation is working on an abstract component / service model that maps to Artop and EATOP implementations, so that we can actually use the same code for both meta-models.

In addition, it can be combined with the variant / featuremodels, so that metrics for entire product lines can be calculated and “loose ends” can be found.

 

Eclipse Day Embedded Stuttgart as part of Open Forum

As a kind of a tradition, the “Stuttgart Region Economic Development Corporation” has been supporting the “Open Forum” conference in Stuttgart each year. It consists of two main tracks: The “Apps to Automotive” (A2A), which is mainly organized by Gigatronik, and the “Open Change – Bridges Not Barrier“, organized by Kugler-Maag and itemis, focusing on changes in the development process (coopetition, collaboration, networked company, open source, agility).

Eclipse is a major factor in these new trends, especially in automotive. As such, we will be featuring a number of  directly and indirectly related talks:

  • Klaus Birken will introduce Franca, an open source project orginating in GENIVI, that provides a pivotal interface definition language (of course, implemented in Eclipse / Xtext). Franca is being used in a growing number of projects (including non-automotive) for architecture and interface definition
  • Ignacio Garro from Continental AG will talk about the Eclipse Automotive Industry Working Group – an initiative that brings OEMs, Tier-1s and other companies together to synchronize and coordinate the activities around Eclipse, share ideas and efforts.
  • Christoph Hammel, Robert Bosch GmbH, will talk about future scenarios in the collaboration of OEM and Tier-1s, including a platform for engineering artefact exchange. Since Bosch is a supporter of Eclipse, this is also Eclipse-related.
  • Matthias Recknagel, Daimler, will talk about the experiences in definition of the ReqIF standard. One of the first implementations of the standard is ReqIF-based.

The talks will focus on organizational / collaborational aspects of the Eclipse eco-system. They will not be targeted at an audience that has to address organizational challenges and incorporate new methodologies and approaches. The other talks are a perfect match if you want to learn how to approach these (and by this understand Eclipse and other cooperation models):

  • One of the keynote speakers is Dave Gray, whose excellent book “The connected company” describes the challenges of companies in a complex environment and whose arguments can be directly be used as arguments for an Eclipse-based strategy (or other open source strategies)
  • In automotive, Bonifaz Maag will talk about the “agility without borders”, discussing the “orchestrated product development process”.

And there is a number of further interesting talks. The Open Change conference is set up as a very interactive conference – we do favor direct discussion and exchange among participants.

Further information and registration is available at the Kugler-Maag Website.

ReqIF/RMF and BIRT: Creating “physical” requirements specifications

Printed documents still play a major role in requirements specifications, since a printed and signed document could be required for legal reasons. A lot of companies have written their own document generators for existing requirement tools to fit their specific needs. However, such reporting tools are very often tied to specific tools APIs and difficult to maintain and evolve.

With ReqIF becoming the requirements exchange standard, the idea of generating a document out of the ReqIF and being independent of specific tools is obvious. There are various technologies that could be used. Obviously, Eclipse RMF provides a full ReqIF reader out-of-the-box. Various technologies could be used to generate reports. We have used, e.g. Apache POI.

However, we also have implemented an ReqIF/RMF data source for the BIRT reporting engine, which gives you a visual designer. Assume that we have a simple ReqIF:

 

A requirements document in RMF

A requirements document in RMF

Suppose we want to create some reports. With our connector, BIRT is able to analyze the ReqIF definition and provide exactly the attributes that you defined in your ReqIF in the WYSIWYG editor. The elements in brackets are field specifications. The values are taken from the ReqIF document.

Visual BIRT Editor

Visual BIRT Editor

In the Preview Pane, we can immediately see what the report will look like, without having to generate first:

BIRT Preview Pane

BIRT Preview Pane

We can then export to a number of formats:

Report Export

Report Export

And generate pdf. Of course, you can really do fancy layouts with BIRT, not just the plain thing shown here:

ReqIF generated PDF

ReqIF generated PDF

The ReqIF BIRT connector allows for easy reporting of requirements documents. Contact itemis if you are interested.

Testing Eclipse Applications – the Q7 tools

During development of Eclipse based-applications, I prefer that the project has as many stand-alone tests as possible. Since they are faster to execute than running plugin tests they are invoked more often and cost less turn-around. For the large an complex textual DSLs for a customer, we wrote a lot of tests that checked if our content assist would calculate the right values and relied that Xtext will actually present the values correctly – so no GUI tests for content assist, hovers, outlines. Tests are executed very fast and yield good result.

However, GUI-based tests do have their place in our testing process. We uses to use SWT-Bot for tests, however, with Eclipse e4 and Graphiti, the SWT-Bot tests broke and it would have been quite some effort to get them running for a new project. At that time, Jonas Helming from Eclipse Source, demoed xored’s Q7 test tool at Eclipse Demo Camp at Munich. We gave it a try and got a positive impression. (Everything below applies to running Q7 in the user interface as well as in a Tycho build).

According to the technical description, Q7 actually injects code into the application under test (AUT) and by this method, can react bettet to changes in the interface. On a user side, I like the features that Q7 provides for initializing my test cases: To set up a test workspace in my AUT, I do not have to write any code. Q7 provides so called contexts, that allow the user, amongst other things, to

  • import projects into the AUT workspace
  • open specific views / perspective (nice content assist here, no need to know the names / ids for your views – Q7 knows from the AUT)
  • open specific editors on files, etc.

In addition, the tests are specified in a script language, which can be recorded from you interaction with the AUT and then replayed, either interactively or from a Tycho build.

Q7 Testcase for Autosar

Q7 Testcase for Autosar

For our current purposes, this seems to work well with Graphiti editors (should work for GEF-editors). xored offer a special version for open source projects. Otherwise you will need the Q7 runner to execute the tests. Test can be recorded with the Q7 tool, but as soon as you want to modify the test scripts, you need the commercially license, otherwise, you would have to re-record the script.

To me, Q7 is definitely an interesting player in the field of testing Eclipse applications.

 

Software Tool Chain for Automotive – the IMES research project

At itemis, we are currently participating in a public funded research project (IMES) that deals with the software development tool chain for automotive software, especially in early phases. We do have two main focus points in the project:

  • An integrated tool chain for logical functions and software architecture, including traceability to requirements and variant management.
  • A prototype for a trans-company model repository that avoids the current gaps in the tool chain.

The project is a good example how you can leverag existing Eclipse technologies and combine them:

IMES Architecture

IMES Architecture

  • The development process starts with requirements. We use the Eclipse RMF project to import ReqIF and display/edit requirements. This is also the basis for traceability. Eclipse RMF is an open source project contributed by itemis and the university of Düsseldorf / Formal Mind
  • The specification of feature models and model variants is done with tooling based on the Eclipse Feature Model project. The basis of the feature model project had been contributed by pure systems and recently, itemis has released the textual editors for the features / variants as open source and will put them under the Eclipse umbrellas. The editors are based on Xtext, another open source project.
  • Functional modeling (logical architecture) is based on the just recently published EAST-ADL meta-model / its implementation that is published under the name “EATOP”. The meta-model has been contributed by Continental AG as part of a public funded research project. The editors are implemented by itemis and rely heavily on the Eclipse Graphiti framework.
  • In early phases, logical architecture is often done in combination with functional prototypes. These are provided in terms of state machines or, more often, data flow / block diagrams. While the OEM will still use commercial modeling tools for this purpose, we use Eclipse DAMOS to show the integration.
  • Logical Functions are mapped to software architecture. The software architecture editor is developed in the scope of IMES and is based on Artop – an AUTOSAR meta-model implementation by the Artop user group.
  • The same applies for the deployment to real ECUs. Both editors again are based on the Graphiti framework.
  • All of the artifacts can be traced on model element level. This is done by using Yakindu CReMa, which has been developed within the VERDE research project.
  • Again, on model element level, change management tickets can be assigned on a fine level to any tickets. Eclipse Mylyn provides all the infrastructure and the connection to the editors is developed on the IMES side.

On the repository side, we are bringing together two of Eclipse’s interesting projects:

  • Sphinx provides a lot of functionality for workspace management and helps several editing tools from different sources to work together on the same models.
  • CDO is a persistency framework with branching / versioning support (think “Git” for models). It will allow for a number of different collaboration scenarios between OEM and 1st tier, including working together on the same server, working on offline repositories with sync etc.

The Eclipse eco-system is truly marvelous.

Managing functional networks and behavior models with EAST-ADL

Functional networks are an important artefact in early system design. They specifiy system behavior without any decision about the realization (HW/SW) of the specific function. Logic Functions are often prototyped with behavior models, like data flow diagrams. In the IMES research project we implement an editor for EAST-ADL function models, that together with Yakindu traceability, can be used to manage logic functions and behavior models.

Avoiding manual merge when generating plugin.xml with Xtext/Xtend

In our project we do generate graphical editors for Graphiti based on DSL-models specifiying these editors. That works all fine when generating the source code (.java and .xtend). However, for Graphiti and the editor to work, there also have to be some additions / modifications to the plugin.xml of the editor’s defining plugin.

While there is no issue in generating any text file (and such some .xml) with Xtend, the default mechanism has two characteristics that require a manual merge:

  • Artefacts are generated into src-gen/, plugin.xml is one level higher
  • No merging support of existing files with generated files out-of-the-box

While it is probably possible to modify the code generator infrastructure that Xtext provides out-of-the box, we chose a simpler way: Why not generate the extensions that we use in separate in the src-gen directory and then use another mechanism to merge in with plugin.xml?

Eclipse allows you to add custom builders to your project through the project properties. There are basically two that you can configure: An external program or an ANT Build. An external program was not feasible, since we would like the same configuration to work on different platforms (WIN,Mac,Linux) and you would require absolute pathes to binaries.

But the same can be done with an ant. So in our projects we do have a new ANT script2013-01-11_09h40_56that recognizes the merged sections and upon build, throws them out and replaces them with the contents of one or more “fragment” files that end with “copymetoplugin.xml” from src-gen:

 

Update:

Hier is the pom fragment to update the XML from Tycho:

 

 

Why you should consider Sphinx for your modeling projects.

The Sphinx project is one of the most interesting new projects on eclipse.org and provides important infrastructure for modeling projects. However, it might not be immediately visible from the project description what it does. Here is an example on how it can help you when writing graphical editors (in our case with Graphiti).

We face two questions:

  • How to deal with models, that consist not only of one model file, but is actually split up between several models
  • How to synchronize different views etc in Eclipse.

The first question immediately comes up for models that can be split per definition (as in AUTOSAR, where a model can be defined in several .arxml files). But even if you think that your domain model is only stored in one single file – by introducing one or more Graphiti diagrams (which are stored as EMF models), you have to combine these with the domain model.

Multiple copies of the domain model

The second question might not be immediately obvious, but you will notice it soon. The different views in Eclipse are not guaranteed to use the same in-memory representation of a model file, making synchronization difficult:

The Navigator in the Explorer View and the Diagram Editor might both load the domain model with standard EMF mechanism. But that results in each of the view having their own specific copy of the model independent of the other view. That means that an object “Wiper” is available in memory for the navigator and a different object “Wiper” at another memory location for the graphical editor.

2013-01-09_10h44_24

That has several consequences:

  • Changes in one editor are not reflected in the other editor immediately, since these are obviously different objects in different resources
  • Synchronizing is done on resource save – the other editor detects that the resource has changed. This is annoying, because for the explorer this will result in the contents of the model being collapsed and you have to open everything again. And in the Graphiti editor, you will be notified that the underlying resource has changed and asked if you would like to discard your changes – even if your diagram does not have any of the affected domain model elements in it.
  • Drag and Drop needs extra effort. If you drag one object from one view to another, you cannot just rely on the “==” operator, because even if it is the same domain model object, it will just be another copy. So you have to work with URIs or other approaches to find the domain model object you are being passed in your resource.

Sphinx to the rescue

Sphinx helps you with that. Sphinx provides extension points and an API to define which model files should be considered together as one model and then you just ask Sphinx for the model – everything else is taken care of.

2013-01-09_10h44_58

Code details

There is an example integration of Graphiti editor in the Sphinx experimental directories – but we had to add additional things, since we derive from the plain Graphiti way at several places. The standard experimental Graphiti / Sphinx integration works on the Graphiti EMF namespace. However, since we derived from that, we need to tell Sphinx which models should be loaded to Autosar:

2013-01-09_10h36_45

2013-01-09_10h28_30By providing the TargetMetaModelDescriptorProvider we tell Sphinx that our models should be loaded into the models defined by a target meta model descriptor. The default Sphinx/Graphiti integration is quite elaborate, but for us, we always want to be loaded into AUTOSAR model. So the implementation of the class is quite simple – by returning the Autosar40 model descriptor:

The target meta model is related to the model that should be added through the contentType attribute of targetDescriptorProvider(see screenshot above). Obviously, we need a Descriptor for our own GraphitiAutosar Metamodel (which is derived from Graphiti Diagram ecore):

2013-01-09_10h31_42

 

Finally, we define a content-type for our diagram extensions:

2013-01-09_10h38_452013-01-09_10h39_10In addition, we register a specific editor through org.eclipse.ui.editors:

2013-01-09_10h40_47Note the line “class” is

which is a modification done to actually invoke Graphiti editors with Guice.

After this implementation, changes done in the diagram are immediately reflected in the Graphiti editor (and vice-versa) and the drag-and drop code can be much simplified by checking with the “==” operator.

 

 

 

 

 

Showing ECU communication in AUTOSAR models

When working with AUTOSAR specifications, it is easy to see from the models on a high level which software components are communicating with each other. However, it is often interesting to see how that maps to the communication between ECUs. To do that, you have to take the software mapping into account that specifies, which SWC are mapped to which ECU. That adds quite some new levels of indirection and the information is not easily to be retrieved from the AUTOSAR model.

In the IMES project, we are easily showing that information in a diagram that shows the ECU mapping and then automatically calculates the necessary connections so that the architect can easily see the resulting data flow between ECUs.

Starting point is the ECU diagram, that can show buses (not shown in the screenshot, ECU instances and the mappings of software components to ECU instances). The left red square marks some mappings in the Artop explorer which are reflected by the marked rectangles in the diagrams (mappings are automatically added to the ECU instances in the diagram on user request). Now it would be interesting to see, if that mapping actually results in inter ECU-communication.AUTOSAR SWC to ECU MappingOn user request, the communication between mapped SWCs is added to the diagram and then the diagram is completely layouted. Of course, it is not only of interest, if two ECUs communicate, but also what data is transmitted. This can be seen by selecting a connection: The documentation view is updated with information on the involved ports, interfaces and data elements.

Inter-ECU communication

Inter-ECU communication