Using a State Machine for System Logic via Storyboard IO

Questions and information about Crank Software's Storyboard Engine

Moderator: jamiev

Using a State Machine for System Logic via Storyboard IO

Postby thomas » Fri Jun 17, 2016 8:33 am

Storyboard is a fantastic way to rapidly create and evolve user interfaces (UI/HMI) for your product. At Crank we are frequently asked about the best method to integrate the system logic with the rich interactive UI that you create with Storyboard.

The answer to this question is generally: Don't integrate system logic 'within' the UI, maintain your system logic in an external process (or task or thread) and use a Storyboard IO communication channel to send and receive events so that the UI implementation remains independent of the system model. This concept is described well in this post and set of videos and through our Storyboard IO documentation: ... yboard-io/

Using this approach, the response to "does Crank provide a system modeling tool" becomes clear. When you a UI framework forces you to either integrate the system logic into the UI or requires you to use a particular modeling ideology, then you are fully locked in to that technology stack and change is difficult. Storyboard does not promote a single modeling tool to be used for your application, it promotes any modeling tool to be used for your application. This may even mean using different methodologies for different parts of the system you are constructing. Storyboard IO communication allows all of these parts to work together in a decoupled manner with an API contract between components consisting of event definitions and their data payloads.

To demonstrate this flexibility, we've done a simple application integration using the Quantum-Leaps QM State Machine Modeling Tool ( This product is popular, well documented and (currently) has both GPL and commercial licensing terms and is frequently referenced in embedded systems.

This example creates a simple traffic stoplight application that maintains all of it's system logic in a state machine model running as an external process. State changes are relayed as Storyboard IO events to Storyboard application providing the UI presentation. Additionally, the Storyboard UI communicates the desire to change the behaviour to the model which validates the change and in turn generates the new behaviour.

Keep in mind that the Quantum-Leaps product does require licensing for commercial use, but it demonstrates well how easily it is to integrate a complex state machine driven system model to a UI using Storyboard IO events as a decoupled inter-component API.


--- From the archive README.txt ---

This is a Stoplight example of a Storyboard UI driven by a state machine created by the Quantum Leaps modelling tool QM and integrated with their QPC model execution framework:

The example directories are:

* This is a local copy of the qpc framework source to save from having to download it from the Quantum Leaps website. To build this source, select the appropriate platform from the 'ports' directory and build accordingly.

* This directory contains a simple Storyboard Designer UI for the Stoplight. This model should be simulated with the Storyboard IO communication channel set to 'stoplight_ui'. A default launch configuration is included with the project that contains this option set.

* This directory contains the QM model of the Stoplight (stoplight.qm) as well as the generated source code for the state machine (stoplight.c).

* The directory also includes a simple Storyboard IO cover library to facilitate event communication to and from a Storyboard application using the Storyboard IO API (sbio.c|h)

* A sample Makefile for building the model is included. The paths in this Makefile may need to be adjusted to correspond to your Storyboard installation path and runtime as well as the version of the QPC library that you build. These options are configured at the top of the provided Makefile.
QM State Machine Example Project(s)
(6.56 MiB) Downloaded 348 times
Posts: 135
Joined: Mon Nov 02, 2009 4:32 pm
Location: Ottawa

Return to Storyboard Engine

Who is online

Users browsing this forum: No registered users and 3 guests