OpenRTDynamics -- A framework for the implementation of real-time controllers
OpenRTDynamics (ORTD) is a framework to implement block/signal based control- or signal processing systems and aims to be an open-source alternative to Simulink Coder / LabView / Xcos code generation. This framework is suitable for implementing discrete-time signal processing algorithms, using the same principles like in Scicos/Xcos or Simulink. However, schematics are described by combining special Scilab functions provided by the framework (a typical Scilab-file describing an ORTD-schematic is e.g. ). A comparision to Xcos and Simulink is given in Comparison.pdf. The obtained programs are real-time capable.
The newly introducted features include:
Additionally to standard approaches, ORTD features the ability to implement state machines represented by multiple, switching subsystems (each subsystem corresponds to one state)  . Subsystems (sub-simulations) can also run in the context of separated threads (with or without synchronisation to another one), e.g. to divide high- and low frequency portions  or to run computationally intensive tasks in the background. Because of a remote control interface  and the ability to include Scilab-Code (similar to Matlab S-functions) that could execute e.g. calibration routines , ORTD is also ideally suited for laboratory automation. Hereby, the ability to online-replace sub-schematics (sub-simulations) with replacements   removes the effort of restarting the main real-time program when new algorithms are designed. An example for automating experiments using these conceps: . The reliability of ORTD has been proven in a number of large experimental set-ups in medical engineering.
Because the real-time interpreter is implemented in a shared library, ORTD can also be easily integrated into other simulation frameworks e.g. Scicos or used within other software. The LGPL-license also allows commercial usage.
Slides that give a short introduction are available: ortd_slides.pdf (updated 02.6.2014). For technical details please refer to the README. It also includes intructions on how to install ORTD on embedded ARM-systems, like the beaglebone. A tutorial and plenty of examples for each feature of ORTD are included in the package and finally, documentation for each individual block is available through the Scilab-Help.
Please Note: OpenRTDynamics does not depend on any part of Scicos/Xcos. ORTD uses algorithms for time-deterministic interpretation of simulations instead. Only the Scilab Scripting language is required for describing the schematics and only during development for compiling. During runtime, no more than standard C/C++ libraries are required, therefore ORTD is very uncomplicated to install and maintain, even on other platforms. Difficult and cryptic instructions for the installation of this framework were intentionally avoided.
Tags: Realtime control implementation, Laboratory automation, Linux RT-Preempt, Signal-based simulation, Scilab, Embeddable C-Code libray, No code generation required
Data Visualisation / User Control
A new open-source, plugin-based software PaPi for live-visualisation and user interaction in conjunction with real-time control systems is currently being developed at Technische Universität Berlin. It is the successor of the software qrtailab that could only be used in combination with RTAI. Up to now, there is initial support for ORTD and ready to run examples are found in ORTD-plugin folder of PaPi: .
As an alternative, it is made easy to implement web-based user interfaces.In this example, an ORTD simulation (real-time part) is communicating to a node.js script by UDP-packets. The node.js part provides a web-interface and streams the information from the real-time part to the web-interface. Additionally, parameter changes are forwarded from the web-interface to the real-time part. The source-code is available from .
In addition to the existing state machines, logic constructs like Select/Case (done; in svn)  , for-loops  (also done; in svn) , do-until-loops will be added. These apply to nested simulations that are e.g. conditionally executed or for multiple times in a loop. For visualisation and user control purposes, a strong collaboration with PaPi is ongoing to allow automatically generated user interfaces (with minimal effort for the user) that allow e.g. interaction with automated experiments.
Components / Modules
ORTD consists of multple parts. The main one is the libdyn simulator library. Additionally, there are modules i.e. for remote comunication or nesting simulations.
The latestest versions include highly advanced features like
- Online replacement of sub-controllers; Yes, can can exchange wires and blocks during the controller is running (modules/nested)
- State machines (modules/nested)
- Simulations running in threads (modules/nested)
- Mathematical formula parsing (modules/muparser)
- Vector handling blocks (modules/basic_ldblocks)
- Calling Scilab from the simulation (modules/scilab)
- Remote control interface (modules/rt_server)
- Starting external processes (modules/ext_process)
- Timer for simulations running in threads (pending) (modules/synchronisation)
- Scicos to ORTD block wrapper (modules/scicos_blocks) [A template for easily including Xcos-blocks]
- A framework for sending/receiving UDP-packets (modules/udp_communication)
Linux rt-preempt Benchmarks
A benchmark to evaluate the real-time capabilities is available: Cycletest
You could also consider this as an example on how to start multiple threads with different priorities and CPU assignments. Here are some test results, where the time durations between neighbouring samples is plotted for a thread that runns with real-time scheduling and for one that runns without any special priorities. The desired sample time is 0.002s which corresponds to a sampling frequency of 500Hz.
Test results for Ubuntu 12.04, Intel(R) Core(TM)2 Duo CPU, Linux 3.2 (no special patches) (PDF). Further results (including tests for Mac OS X) are given at .
Acknowledgement / References
OpenRTDynamics is actively developed and heavily used for implementing feedback controllers in biomedical engineering and research at Control Systems Group, www.control.tu-berlin.de, Technische-Universität Berlin Development is partially funded by the German Federal Ministry of Education and Research (BMBF) within the project BeMobil (FKZ 16SV7069K) and by European project RETRAINER (Horizon 2020, Research and Innovation Programme, grant agreement No 644721).
Huge portions have been funded by the European Commision (2010-2013) in the 7th framework Program within the project MUNDUS. During this project, ORTD has been used to develop a prototype for a next generation neuro-prosthetic system.
Scientific publications on experiments that were implemented using this framework
Christian Klauer, firstname.lastname@example.org, Control-Systems-Group TU-Berlin; framework design, implementation, coordination
Arne Passon, Control-Systems-Group TU-Berlin; API design, implementation
Stefan Ruppin, Control-Systems-Group TU-Berlin; PaPi integration
Markus Valtin, Control-Systems-Group TU-Berlin; contributions
Maximilian Irmer; contributions
If you need help in installing or development using ORTD, please don't hesitate to contact one of the authors. Let us know for what kind of project you are interested in to use ORTD; probably we may advise in design questions.
Motivation for another real-time framework
Since I'm working in the field of biomedical control engineering, my expectations on the reliability & flexibility of the software controlling something that is acting on the human body are very high.
When doing experiments in clinical environments, only limited time is available. Faults in the operation are critical up to some high extend and technical inadequacies like instable software that requires several attempts to fully run can simply not be accepted. It shall be possible to re-calibrate and make individual adaptations to the implementation in the shortest time possible. Therefore, instead of code generation, this framework uses an interpreter (the Scilab description is assembled faster than generating and compiling C-Code). Additionally, new sub-implementations can be designed and loaded on-line while e.g. the data acquisition devices stay up and running.
Also I don't like complicated installation procedures where one has to edit files, adapt directory paths and install numerous other libraries from their sources by hand. ORTD compiles and installs itself automatically from its source files on the individual target system. If there is a library installed that could enable additional functionality for ORTD, it is used. If not installed, ORTD doesn't complain.
If you find a bug in the software or things that you just do not find so nice, it would be very cool if give me a short notice/comment by Email. Even complaints like "I have to type so much commands when doing ..." are REALLY welcome. Every time the user of this framework is subjected to an higher programing effort than theoretically necessary, something could be improved! Thus let me know. ORTD is supposed be as smart and relaxed as possible.