20 likes | 204 Views
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
E N D
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 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: • A lookahead is calculated and intermediate values are stored (Fig. 2). This process is stopped either by an event or a given time(Fig.3a). • If an event happens and the actor is fired, its new state is calculated by the saved values(Fig. 3b and 3c). 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. Conclusions 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. References [1] W. Müller and E. Widl, “Linking FMI-based Components with Discrete Event Systems,” in Proceedings of the International IEEE SytemsConference (SysCon), 2013. [2] 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. [3] E. A. Lee, “Modeling concurrent real-time processes using discrete events.” Ann. Software Eng., vol. 7, pp. 25–45, 1999. [Online]. Used Software • Ptolemy II is used as simulation framework. • For interfacing FMUs and event handling the FMI++ library is used (openly available via http://sourceforge.net/projects/fmipp). • The FMUs are generated according to the FMI 1.0 specification (openly accessible via https://www.fmi-standard.org) • The homepage of the FMI standard lists software supporting the FMI. The FMUs used for the studies presented here were generated with OpenModelica (openly available via https://openmodelica.org) 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.