Linking FMI-based Components with Ptolemy II’s Discrete Event Domain. Wolfgang Müller, Edmund Widl , Atiyah Elsheikh, Peter Palensky Austrian Institute of Technology. Introduction
Wolfgang Müller, Edmund Widl, Atiyah Elsheikh, Peter Palensky
Austrian Institute of Technology
In the simulation of cyber-physical systems, event driven models with continuous subparts are often the obvious choice. An approach for handling this situation is presented, using Ptolemy II's Discrete Event (DE) domain and continuous submodels generated by other tools.
The variety of tools in modeling and simulation has led to the Functional Mock-up Interface (FMI) specification. It provides the facilities for exporting models as Functional Mock-up Units (FMUs). For the event handling of the FMUs a library has been developed, which provides a higher level abstraction of the FMI. A Ptolemy II actor can use this library to directly integrate continuous FMUs in the DE domain.
Method & Results
For embedding continuous FMUs as actors in Ptolemy II's DE domain, the following prediction process is used:
This process is implemented in the FMI++ library.
Fig. 2. UML activity diagram of the prediction process.
Fig. 4. Single FMU actor connected to a random timer and a plotter.
FMI-based components in Ptolemy II enable the use of models designed by other tools. Another benefit is shorter runtime and better scalability. The use of the FMI++ library enables the easier use of FMUs and provides the capabilities needed for the necessary lookahead.
Ptolemy II and its abstract semantics provide a framework that can be used for co-simulation needed e.g. for cyber-physical systems.
(a) Calculated lookahead.
(b) Event during the lookahead.
(c) Result at event time accepted..
Fig. 3. Illustration of the lookahead process.
As simple example an FMU was fired by a Poisson clock (Fig. 4). Later a greater number of actors (representing a simple thermal system each) were generated and the FMU variant was compared with an implementation in pure Ptolemy II (Fig. 5).
Fig. 1. Ptolemy II and FMI access.
 W. Müller and E. Widl, “Linking FMI-based Components with Discrete Event Systems,” in Proceedings of the International IEEE SytemsConference (SysCon), 2013.
 E. Widl, W. Müller, A. Elsheikh, M. Hörtenhuber, and P. Palensky, “The FMI++ Library: A High-level Utility Package for FMI for Model Exchange,” in Proceedings of the IEEE Workshop on Modeling and Simulation of Cyber-Physical Energy Systems, 2013.
 E. A. Lee, “Modeling concurrent real-time processes using discrete events.” Ann. Software Eng., vol. 7, pp. 25–45, 1999. [Online].
Fig. 6. Runtimes for different lookahead lengths.
The dependency of the execution time on the chosen lookahead length is shown in Fig. 6. Using the same example as above, the optimal choice for the lookaheadlength turns out to be the expected value of the timespan between two consecutive events. (which is in this case the parameter of the Poisson clock).
Fig. 5. Runtimes of Ptolemy II.