Free library for interfacing hardware drivers to Modelica models. There is support for joysticks, keyboards, UDP, TCP/IP, LCM, MQTT, shared memory, AD/DA converters, serial port and other devices.
The Modelica_DeviceDrivers
(MDD) library is an open source Modelica package that interfaces hardware drivers to Modelica models. An overview of the library is provided in
Bernhard Thiele, Thomas Beutlich, Volker Waurich, Martin Sjölund, and Tobias Bellmann, Towards a Standard-Conform, Platform-Generic and Feature-Rich Modelica Device Drivers Library. In Jiří Kofránek and Francesco Casella, editors, 12th Int. Modelica Conference, Prague, Czech Republic, May 2017. Download
The library unifies previous developments concerning device driver support in Modelica, see Interactive Simulations and advanced Visualization with Modelica and Modelica for Embedded Systems (Modelica'2009 conference). The functionality covered by this library has been used internally at DLR for several years, such as for Driver-in-the-Loop simulation and for the DLR Robot Motion Simulator. The previously fragmented functionality was streamlined, improved, and extended to a coherent cross-platform library.
Main features:
All device drivers are made available via external Modelica functions. Furthermore, high level interfaces on these functions are provided via Modelica blocks. The first interface uses Modelica 3.2 functionality only (when-clauses and sample-operator). The second interface uses the synchronous language elements introduced in Modelica 3.3 and is based on clocks.
Download Modelica_DeviceDrivers latest release
Please note that the library is known to work with
userBufferSize
all non-clocked communication blocks are working in SimulationX, but autoBufferSize
only works for external solvers CVode and Fixed Step solver and fails for BDF and MEBDF solvers, see #54 (comment)),If you tested the library successfully with another Modelica tool, please contact Bernhard Thiele or send a pull request that updates this README.md.
Bug fix releases may not have release notes, so please use the download link from above to get the latest release including bug fixes.
useRecvThread
also for clocked UDPReceive
variant (#342).RealtimeSynchronize
block "clock_nanosleep" error on Linux (#357).MDD_TCPIPServer_Send(...)
return value, so that it works as described in the documentation: "On success, return the number of bytes sent, 0 if operation would block, -1 on non-fatal error" (#323).-fPIC
flag, which fixes a related FMU generation problem (#306).For information about previous releases, see Release Notes of Previous Versions.
Use the following BibTeX lines to cite the Modelica_DeviceDrivers library
@InProceedings{modelica2017mdd,
Title = {Towards a Standard-Conform, Platform-Generic and Feature-Rich Modelica Device Drivers Library},
Author = {Thiele, Bernhard and Beutlich, Thomas and Waurich, Volker and Sjölund, Martin and Bellmann, Tobias},
Booktitle = {Proceedings of the 12th International Modelica Conference},
Year = {2017},
Address = {Prague, Czech Republic},
Editor = {Kofránek, Jiří and Casella, Francesco},
Month = may,
Pages = {713--723},
Doi = {10.3384/ecp17132713},
}
This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the BSD-3-Clause License.
The master branch of the Modelica_DeviceDrivers library should work out-of-the-box when loading the library into a supporting Modelica tool. The branch contains the necessary external C libraries as pre-build binaries below folder Modelica_DeviceDrivers/Resources/Library.
If you need to build the external C libraries from the sources, clone the repository with
git clone --recursive https://github.com/modelica-3rdparty/Modelica_DeviceDrivers.git
git submodule update --init --recursive
and see Modelica_DeviceDrivers/Resources/README.md.
Main developers:
You may report any issues with using the Issues button.
Contributions in shape of Pull Requests are always welcome.
The following people have directly contributed to the implementation of the library (many more have contributed by providing feedback and suggestions):
EmbeddedTargets.AVR
support.EmbeddedTargets.STM32F4
(experimental) support.