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.
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.
Tags: Realtime control implementation, Laboratory automation, Linux RT-Preempt, Signal-based simulation, Scilab, Embeddable C-Code libray, No code generation required
OpenRTDynamics is heavily used for implementing feedback controllers in biomedical engineering and research within the project MUNDUS funded by the European Commision in the 7th framework Program. It is actively developed at "Control Systems Group" www.control.tu-berlin.de of Technische-Universität Berlin and practically applied for setting up computer-controlled laboratory experiments.
Scientific publications on experiments that were implemented using this framework
Integration into PaPI
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:
Online replacement of controllers using OpenRTDynamicsIn 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 .
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 .
The latest news and added features are always found in the README
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 framework for sending/receiving UDP-packets (modules/udp_communication)
• A noval and flexible way to describe schematics
• No effort is needed to compile schematics by a C-Compiler -- they are interpreted at runtime. Therefore, there is no need to have a running (cross-) compilation environment for the target system on the development system. It is needed only once to install ORTD on the target.
• For your own software written in C/C++, you can easily integrate ORTD and all its features
• Schematic development is done within Scilab, thus control design and implementation can be in one place
• Schematics may be effectively managed by subversion etc. as they are stored in plain text.
• Since it is only necessary to execute one Scilab-Script it is very efficient to change parameters, transfer functions and everything else.
Disadvantages / Shortcomings
• Only discrete time blocks (may be changed by introducing an ODE-solver)
• Less blocks than in Scicos or Simulink, however the basics are there as well as some advanced blocks.
Main author: Christian Klauer (Control-Systems-Group TU-Berlin)
Contributions thanks to: Arne Passon, Markus Valtin and Maximilian Irmer
If you need help in installing or development using ORTD, please don't hesitate to contact the main author. Let us know for what kind of project you are interessted to use ORTD.