
This paper presents ModelicaGym toolbox that was developed to employ Reinforcement Learning (RL) for solving optimization and control tasks in Modelica models. The developed tool allows connecting models using Functional Mock-up Interface (FMI) to OpenAI Gym toolkit in order to exploit Modelica equation-based modeling and co-simulation together with RL algorithms as a functionality of the tools correspondingly. Thus, ModelicaGym facilitates fast and convenient development of RL algorithms and their comparison when solving optimal control problem for Modelica dynamic models. Inheritance structure of ModelicaGym toolbox's classes and the implemented methods are discussed in details. The toolbox functionality validation is performed on Cart-Pole balancing problem. This includes physical system model description and its integration using the toolbox, experiments on selection and influence of the model parameters (i.e. force magnitude, Cart-pole mass ratio, reward ratio, and simulation time step) on the learning process of Q-learning algorithm supported with the discussion of the simulation results.
This Work-In-Progress paper introduces HiPerMod, a new Modelica benchmark suite for large-scale models. The main characteristic of this benchmark suite is that for each model the Modelica implementation is compared with hand-optimized C++ code. The purpose of HiPerMod is to both assess the current performance gap in existing Modelica translators, as well as to explore how to produce the most optimized code for such models, a task that will later be automated in next generation Modelica compilers. In this paper the design choices of HiPerMod are introduced, and preliminary results on a thermal model for integrated circuits are presented.
We are investigating ways of introducing just-in-time compilation in a standard-compliant Modelica compiler, the Open-Modelica compiler (OMC). The main motivations are enabling extensions to support dynamically varying model structure, faster compilation, and faster recompilation of models after changes. We are investigating two approaches. The first approach is to adapt the low-level OpenModelica intermediate representation (IR) before code generation to be compatible with LLVM. In that way we can avoid generating intermediate C-code and instead generate LLVM IR in memory for just-in-time compilation (JIT). The second approach is to translate OMC itself written in MetaModelica to Julia, and thereby gain access to the JIT capabilities of LLVM. Another benefit of the second approach is the access to the Julia ecosystem, including a rich set of libraries for numerical computing. We have done a preliminary investigation of both approaches, with measurements on a selected sample of algorithms, and discovered that compilation-time of generated Julia code is slower compared to generating LLVM IR directly. We conclude that providing a standard-compliant Modelica compiler which supports a dynamically varying model structure is feasible and possible, and we believe that such a compiler can be provided by using Julia or MetaModelica.
Vector Matrix Multiplication (VMM) is a fundamental operation in machine learning algorithms focused on artificial neural networks and also many simulation codes. Implementations based on crossbar arrays provide a promising approach to perform this operation with an analogue circuit. In comparison to purely digital solutions, significant improvements in processing speed and power consumption can be expected when applying this approach. However, securing the accuracy is more difficult than in the digital case. Primary reasons include nonlinearities of essential resistive elements and non-zero resistances of wiring lines. Many publications have dealt with this topic in the recent years analysing the different influences in different ways. We provide a unified approach based on the well-known indefinite admittance matrix concept for the description of the terminal behaviour of analogue multi-poles for the parametrization of crossbar arrays and for the estimation of computational error limits. This paper describes work in progress. It illustrates the procedures through a number of examples using modelling and simulation capabilities of VHDL-AMS. This behavioural modelling language seems particularly suitable for investigations on tailored implementations using VMM. It combines the support of analogue mixed modelling and simulation with the facility to generate scalable architectures. Aspects of solving this task with Modelica are also discussed. Furthermore, it is also shown how symbolic methods might be used to consider resistances of wiring lines in the parametrization of crossbar arrays.
The prototype Modia3D is used to test and evaluate ideas for modeling and simulating larger and more complex 3-dimensional systems than it is possible with a pure equation-based modeling system such as current Modelica. Collision handling in Modia3D is performed on convex geometries with elastic response calculation using an improved formulation of the contact forces and torques. The computed penetration depths and Euclidean distances are utilized in a novel way as zero-crossing functions. The resulting differential algebraic equations are solved with a variable-step solver.
Are differential-algebraic equations the right tool for the object-oriented modeling of physical systems? One may say yes, given all the empirical evidence. However, this paper offers a brief reasoning from a fundamental information-oriented perspective. The findings suggest that there are inherent flaws concerning the computational realization of DAEs in implicit form and that extensions are needed or alternatives should be investigated.
This paper introduces new algorithms for the efficient conversion of large sets of DAEs into ODEs based on the extension of maximum matching and Tarjan's strongly connected component algorithms using a novel concept of Set-Based Graph. These algorithms have the capability of solving the problems without expanding the arrays of unknowns and without unrolling the for-loop equations so that the complexity becomes independent on the size of the arrays. The implementation of the new algorithms in an experimental Modelica compiler is also described and two examples are presented.
Both equation-based and geometry-based simulation can be used to design magnetic circuits. Equation-based simulation allows direct coupling of the magnetic domain to a large number of other domains and is therefore ideal for system simulation. Geometry-based simulation allows straight-forward implementation of arbitrary spatial arrangements. Both findings make no statement about the actual quality of the results, only about the convenience of use. Both approaches can provide directly comparable results for suitable magnetic circuit geometries. In this study, equation-based calculations are performed using the OpenModelica Connection Editior (OMEdit [5]). Geometry-based calculations are performed using Finite Element Method Magnetics (FEMM [2]). Using these freely available tools, we would like to focus on the question of prediction accuracy for a given geometry well suited for both calculation methods, in this case a flat armature switching magnet. Models are created in both aforementioned simulation tools and a prototype is physically built and tested in the laboratory. This way, we are able to not only compare the results of these two simulation approaches, but also check with the reality tested in the laboratory.
The design and planning of sustainable buildings requires flexible simulation tools that can be used for the creation of building energy systems with a high overall energy efficiency, as well as supporting a differentiated assessment of the indoor climate. For this purpose, building energy simulation tools like EnergyPlus or IDA ICE are used in the building industry and from architects. On the one hand, these type of tools are easy to use in practice, because they come with professional 3D-user interfaces, databases for building materials, elements, technologies. Further, they support the post processing phase of an simulation experiment in different manner. On the other hand, these tools are limited to their implemented physics and the geometries and structures of the analyzed building models cannot be changed in real-time during the simulation experiments. This represents a significant limitation for the research and development of new simulation methods in the field of building simulation. Applying the equation-based and object-oriented modeling language Modelica and appropriate tools and software methods can largely overcome these limitations, which can better explore new scientific issues in the field of energetic building simulation. This talk gives an overview about latest Modelica-based modeling and simulation technologies for the energy analysis of individual spaces, whole building energy systems and also city districts. It will be illustrated that these three different model scales can be efficiently supported by a combination of the equation-based and object-oriented Modelica approach with other software approaches like virtual reality (VR) environments on the room scale, building information modeling (BIM) and also building automation systems (BAS) on the building scale, and geographical information systems (GIS) on the district scale.
Equation-based object-oriented modeling languages, such as Modelica, have gained significant popularity the past decades, and the fundamental technology is used in numerous software tools. In such languages, systems modeling are typically done visually, which is simple for small models, but can become difficult for more complex models. In this combined invited talk and live demo, we demonstrate our work-in-progress approach to what we call functional programmatic modeling, an alternative to traditional visual modeling. Specifically, we discuss the idea of programmatic modeling in the context of equation-based languages, and how it relates to existing approaches of modeling and simulation. During the live demo, we show how textual modeling using higher-order functions can be used to model simple mechatronic control systems. Moreover, we show how this modeling approach can be generalized to 3D multi-body modeling, simulation, and visualization.
The industry is currently seeing a rapid development of cyber-physical system products containing integrated software, hardware, and communication components. The increasing system complexity in the automotive and aerospace industries are some examples. The systems that are developed have increasing demands of dependability and usability. Moreover, lead time and cost efficiency continue to be essential for industry competitiveness. Extensive use of modeling and simulation - Model-Based Systems Engineering tools - throughout the value chain and system life-cycle is one of the most important ways to effectively target these challenges. Simultaneously there is an increased interest in open source tools that allow more control of tool features and support, and increased cooperation and shared access to knowledge and innovations between organizations. Modelica is a modern, strongly typed, declarative, equation-based, and object-oriented (EOO) language for model-based systems engineering including modeling and simulation of complex cyber-physical systems Major features are: ease of use, visual design of models with combination of lego-like predefined model building blocks, ability to define model libraries with reusable components, support for modeling and simulation of complex applications involving parts from several application domains, and many more useful facilities. The Modelica language is ideally suited for cyber-physical modeling tasks since it allows integrated modeling of discrete-time (embedded control software) and continuous-time (process dynamics, often for physical hardware). Modelica 3.3 extended the language with clocked synchronous constructs, which are especially well suited to model and integrate physical and digital hardware with model-based software. This talk gives an overview of the current status and directions of the OpenModelica environment - the most complete Modelica open-source tool for modeling, engineering, simulation, and development of systems applications (www.openmodelica.org). Special features are MetaModeling for efficient model transformations, debugging support for equation-based models, support (via OMSimulator) for the Functional Mockup Interface for general tool integration and model export/import between tools, model-based optimization, as well as generation of parallel code for multi-core architectures. Moreover, also mentioned is recent work to make an OpenModelica based tool chain for developing digital controller software for embedded systems, and in generating embedded controller code for very small target platforms like Arduino Boards with down to 2kbyte memory. This work is extended in the ongoing EMPHYSIS project where the FMI standard is extended into the eFMI standard for embedded systems. OpenModelica is one of the platforms participating in that project.
Much effort has been put into the modeling and simulation of variable-structure systems , and there is a consensus on the intuition of viewing a variable-structure model as a hybrid automaton that consists of several modes. Each mode corresponds to a classical static-structure model and events control the transitions between modes. Usually, the number of modes is considered to be finite and small in practice. This assumption conflicts with the composition of models, that easily generates a large number of potential modes. We argue that variable-structure modeling equals a form of explicit control over the process of elaboration and simulation and that this control should be exposed, carefully, to the modeler. This feature allows writing models with a practically unlimited number of modes. We provide a core calculus that defines the language primitives for this task and then integrate elements from that calculus into Modelica, enabling straightforward modeling of variable-structure systems in this established modeling language.
With the modeling, simulation and code generation of mixed continuous/discrete models in Modelica, a development approach becomes feasible which addresses one of the core challenges in cyber-physical systems. The aim is to achieve a simulation of the embedded system model in a physical environment model, before its deployment on real hardware. Based on the already existing support for Arduino boards, an effort has been started for supporting code-generation from Modelica models for STM32F4 boards. In this paper the concept will be explained. Basically Modelica's C-interface and the experimental low-footprint embedded code generation of OpenModelica is used for generating code for the main function. The support for the STM32F4 family is realized with the C-interface functions using the hardware abstraction layer (HAL) application programming interface (API) STM32F4CUBE from ST Microelectronics.
The growing complexity of modern engineering tasks necessitates improved tool support for modelling, in particular tools allowing early detection of modelling errors. Broadly, there are two classes of modelling errors: (i) errors related to abstract modelling, e.g. conceptual errors concerning the coherence of a model as a whole, and (ii) errors related to concrete modelling, e.g. questions of approximation quality and implementation. Concrete modelling errors are relatively well understood, but abstract modelling errors less so. If, however, abstract modelling errors could be detected early, before concrete implementation starts, this would be very beneficial. Unfortunately, existing engineering tools, like current modelling languages, do not support modelling in the abstract well, leaving a gap in the engineering tool chain. To overcome this problem, this paper presents a first step towards a language supporting abstract modelling in mathematical physics with the aim of ensuring coherence of coupled multiphysics models early in the design process. To that end, following the approach of Functional Hybrid Modelling, we discuss how a language supporting quite general modelling equations can be realised as an embedding in Haskell. The appeal of the approach is that only few core concepts are needed, simplifying the semantics, and that much of the language infrastructure comes for free thanks to embedding.
Seamless tracing of the requirements and associating them with the models and the simulation results is becoming increasingly important. This can be used to support several activities such as variant handling, impact analysis, component reuse, verification, and validation. This work in progress paper presents an approach for combining traceability with requirement verification in Modelica. Traceability is supported via the OSLC specification standard combined with Git version control system. All operations on artifacts of interest are traced. Currently, the traceability data is stored in a graph database which can be queried for generating various reports such as impact analysis, variant handling, etc.
This article displays how different processes in the hospital and healthcare sector can be modeled using Petri nets, focusing particularly on time modeling. For the duration of processes cannot be determined exactly in the field at the most, different options of modeling stochastic time concepts are featured. Also, the piece gives an overview on which new (stochastic) time concepts are by now featured within the Modelica library PNlib (see section 1.3), as well as their concrete utilization in the project FiliP (see section 4).
Equation-based modelling languages adopt a declarative modelling approach, focused on writing the model equations in a clear way and leaving the task of deriving efficient simulation code to the tool. One aspect of declarative modelling is that the use of dimensionally consistent SI units for the physical variables is preferrable; however, in many application areas this can lead to implicit nonlinear systems of equations which are badly scaled from a numerical point of view. This paper shows the negative impact of not dealing with this aspect on a benchmark test case, and then shows how the same performance of manually scaled models can be recovered by suitably exploiting information about the scaling of variables that can be declared by the modeller.
Equation-based 1 modelling of hybrid systems has to consider dynamical systems consisting of components with continuous and/or discrete behavior. The paper focuses on such systems under special consideration of systems with variable model structure. Some ideas are presented how a simulation of continuous and discrete phenomena can be handled correctly. The main process is a continuing alternation between continuous and discrete simulation phases, where in the discrete phase the changeover can be performed to a new model structure which is valid during the next continuous phase. The paper addresses the problem of finding a new valid model structure as a process within the discrete phase. This new valid model structure has to be found under consideration of the time history of the model's variables within the preceding continuous phase. To this end, the usage of the Linear Complementarity Problem (LCP) is proposed. After a definition of hybrid systems and the term model structure, different types of events - with and without influence on the model structure - are listed and properties of complementarity are presented. To find the correct switchover from continuous to discrete phase, so-called indicator functions are used. On the contrary, to find the correct switchover from discrete to continuous phase, the LCP is applied. Some simulation results for an electromechanical system are briefly presented.
The need for holistic simulation of complex systems becomes more and more apparent, arising from different fields of application and approached by different scientific methods. This paper addresses the differences in terminology arising from these various origins, the levels on which they meet as well as an attempt on the classification and structuring of current state-of-the-art methods.
For equation-based modelling languages, modelling experts have many degrees of freedom when building a model from scratch. One of the most basic choices the expert faces is the mode of representation. The same system can be represented for instance as a block-diagram, by writing down the physical equations, by writing an algorithm, or by graphically connecting ready-made subcomponents. To give some guidance in this aspect, an experiment was conducted to measure the effects of different representations on various tasks. Participants had to identify models and predict their transient response. Both the time to execute the task and the correctness of the answer were measured. Participants also had to rate their confidence regarding the models. Results showed that tasks were executed much faster for graphical representations than for block-digrams. Equation-based and algorithm-based models can be grouped in the middle. The same results hold for rated confidence. Interestingly, the amount of errors was similar for all representations. Apparently, modelling experts largely compensate for difficulty by taking their time.