Statemachine representations file formats
1 / 15

StateMachine representations (file formats) - PowerPoint PPT Presentation

  • Uploaded on

StateMachine representations (file formats). Maciej Czechowski. Introduction. Harel StateCharts have become a convenient way for describing applications and services. Currently there are a few major file formats designed for storing StateMachine information. UML – graphical solution.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'StateMachine representations (file formats)' - monifa

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Statemachine representations file formats

StateMachine representations(file formats)

Maciej Czechowski


Harel StateCharts have become a convenient way for describing applications and services.

Currently there are a few major file formats designed for storing StateMachine information.

Uml graphical solution
UML – graphical solution

UML has support for Harel-like statemachines with some Object-Oriented additions. This allows easy design, using one of many UML-tools available.

  • easy graphical design

  • statemachines are only part of UML, they have to be part of classes or collaborations and use their datamodel

  • different tools may use different file formats

Xmi xml metadata interchange
XMI –XML metadata interchange

  • interchange format for UML – allows different tools to work together

  • text format, based on XML

  • saves all UML features – results are very large

  • no direct, clearly specified way for describing statemachine variables (they may to be described in other elements, e.g. parent class, if needed), etc.

  • hardly human-readable, designed for machine analysis

Scxml statechart xml
SCXML – StateChart XML

  • XML based language developed by W3C (current status: working draft)

  • general-purpose event-based state machine language based on Harel statecharts

  • has well-defined datamodel

  • human readable

  • execution environment based on webservices exists (Apache SCXML)

Xmi vs scxml

  • XMI comes from UML-diagram,is larger and less readable

  • Most of UML design tools can produce XMI files, providing comfortable way to design statemachines; SCXML is still working draft with few tools available

  • SCXML files are smaller andcleaner as they represent only StateMachines with their datamodel, while XMI saves all UML metadata

  • Conversion between these formats should be possible, although it would not be 1:1 (e.g. SCXML does not support Choice states)

Other formats
Other formats

  • ebXML – language designed for business process specification; its statemachine language semantics are closely connected to e-commerce and therefore not applicable for general applications

  • XTND – notation for simple finite state machines; lacks Harel statecharts additions (parallel states,etc.)

  • other formats exits, but are rather unpopular and used mostly in proprietary solutions

Runtime representation 1 4
Runtime representation (1/4)

  • StateMachines can be used for direct execution by developing Virtual Machine.

  • VM designed for mobile environment would need compact data files, describing only logic required for correct StateMachine execution – let’s call such file format as runtime representation.

  • XML-based formats do not meet these requirements!

Runtime representation 2 4
Runtime representation (2/4)

  • Both XMI and SCXML save all design information (such as variable names). XMI saves also a lot of UML-specific information.

  • All expressions and commands (guards, effects) are saved as plain text (opaque expressions) without parsing, type checking, variable matching, etc.

  • Many parts of design information are not used in runtime!

Runtime representation 3 4
Runtime representation (3/4)

  • State and variable names are not needed in runtime, as they have unique identifiers.

  • We have to maintain Operation (used for triggers) and Effect names, as they come from and are parsed outside.

  • Effect and Guard expressions can be saved as corresponding Abstract Syntax Trees – syntax and type checking can be made after design; virtual machine can be simpler (no parser)!

Runtime representation 4 4
Runtime representation (4/4)

  • XML format uses a lot of space for tags – as runtime representation format is designed for machine analysis we can use more compact binary format.

  • Simple translator was designed, being able to convert XMI file to binary (maintaining UML StateChart structure).

Simple example
Simple Example

Consider the following simple StateMachine:


tempInFahrenheit : int

temperature : int


tempRead(tempInFahrenheit: out)

Example ast


for the opaque behaviour




reference to


AST tree is built…









reference to


and can be byte-saved as

5C5A 00006466745A0001686E0000 01117207

Example - AST

Example results
Example - results

(size in bytes)


  • Design-stage formats like XMI or SCXML provide easy way for describing StateMachines, however they save a lot of additional information not needed in runtime.

  • By removing unnecessary names, parsing expressions and saving result as byte stream a great size improvement can be achieved.

  • Binary format is mostly unusable for further editing, but can have great use for virtual machines as it fully maintains statemachine logic.