Modelica
The New Standard for Modeling Engineering Systems

Abstract:

Modelica® is the emerging standard for describing system-level models. Already pervasive in many parts of Europe, we are now seeing increasing penetration in other parts of the world, notably Japan and North America. A strong ecosystem is developing around the Modelica standard.

In this whitepaper, you will discover why engineering organizations around the world are adopting a system-level modeling approach, and why Modelica is the emerging standard for describing system-level models

Soaring product complexities across many industries, including automotive (electric and hybrid vehicles), aerospace (UAVs) and energy (smart grids, green power), are putting a tremendous strain on the engineering toolchain. As a result, system-level modeling stands out as an increasingly important approach to engineering design. With system-level modeling, all the system components are simulated together in one environment. Complex and often competing requirements (engine performance vs. emissions, thermal battery requirements vs. energy used by the cooling system) and constraints (manufacturing cost, government regulations) need to be reconciled. The system-level modeling approach makes it possible to optimize the overall design from the very early stages of product development. This way, requirements are met, development timelines and costs are reduced, and products can be brought to market quickly in a very competitive environment.

Modelica is the emerging standard for describing system-level models. Already pervasive in many parts of Europe, we are now seeing increasing penetration in other parts of the world, notably Japan and North America. A strong ecosystem is developing around the Modelica standard. Multiple tool vendors are providing software to aid in the construction of Modelica models. Library vendors are offering both free and commercial component libraries, extending the reach of the set of components that are part of the standard library. Similarly, consulting and training is readily available. In short, the supporting network around the Modelica standard has reached a level of maturity where adoption into advanced development and production processes has become a real option for many companies. Engineering organizations have easy access to large sets of high quality component models that can be easily combined into sophisticated system-level models at the required level of fidelity.

At its base, Modelica is a modeling language, supported by a standard library of components that cover many engineering domains like electrical, mechanical, thermal and fluids. Both the language and the standard library are developed and maintained under the auspices of the Modelica Association (www.modelica.org), similar to the IEEE's guardianship of the older VHDL-AMS standard, which shares many of the same goals as Modelica.

Using Modelica for system-level modeling and simulation

Let's have a closer look at what it means to use Modelica for system-level modeling and simulation. The most common way of interacting with Modelica is to use a tool to graphically build a model by selecting, connecting and configuring individual components taken from a library. Figure 1 shows a diagram for a double spring-mass-damper system, such as you would find in a suspension model.

From left to right, we see a step input signal, connected to a force driver, followed by two sets of sliding masses connected to spring-damper components. Finally, the last spring-damper is connected to a fixed reference frame.

The system-level modeling approach makes it possible to optimize the overall design from the very early stages of product development | Contact us to learn more

Each individual component contains the dynamic equations that describe its behavior. For example, Figure 2 shows the governing equations that are encoded into the sliding mass component.

The variables s(t), v(t) and a(t) represent displacement, velocity and acceleration of the component and m denotes its mass. The variables f_a(t) and f_b(t) are the forces acting to the left and right of the mass, respectively. It is important to note that the equations, and thus the component, make no assumptions on how it will be connected to surrounding components. In particular, there is no assumption on what directions the forces on either end of the mass will take on. This is at the core of why Modelica is referred to as an acausal modeling language, as opposed to causal systems like Simulink® where the direction of flow has to be modeled explicitly. The advantage of acausal modeling is huge: subsystems can be more easily reused in different contexts, and model diagrams are typically much less complex than a corresponding causal model. It requires fewer components and are easier to understand and modify because they more closely resemble the physical system being modeled. Figure 3 shows the corresponding causal model for the same spring mass damper system. At the same time, this model (having also been constructed using Modelica) illustrates the Modelica language's capability to model using both causal and acausal paradigms and indeed mix the two in the same system model.

Looking back to Figure 2, tools like MapleSim, an advanced system-level modeling tool from Maplesoft, allow you to extract such equations from any component or an entire subsystem, enabling advanced symbolic analysis that is not possible with just black box component models. However, the graphical diagram fully abstracts all of the underlying mathematics and diving into the equation level is completely optional if you are just looking for simulation results. In that case, the tool will automatically generate the entire set of equations for the system diagram (in general, these will be systems of hybrid differential algebraic equations) by combining the equations from each component together with equations derived from the connections between the components. For example, a mechanical connection between one end of the sliding mass and a spring damper implies that the displacement of the connected extremities is identical and that the forces applied cancel each other out. The entire system of equations is then simplified symbolically and C code is generated that will be compiled and executed within a differential equation solver in order to provide simulation results. The symbolic simplification step is a crucial part of this process. Not only does this involve transforming the set of equations into a solvable set, it also reduces the size of the equations and uses optimization techniques to yield very efficient simulation code, without loss of model fidelity. This code can be executed within the Modelica tool environment or exported to other parts of the toolchain, for example as a Simulink S-Function or as an FMU/FMI (which is a standard for model exchange, also developed under the umbrella of the Modelica Association). Simulation results are available as data tables, plots or three-dimensional visualizations (Figure 5).

The system-level modeling approach makes it possible to optimize the overall design from the very early stages of product development | Contact us to learn more

As easy as it is to interact with Modelica models at the graphical diagram level to get simulation results and perform analysis, drilling down to the language level provides access to the entire power of the Modelica modeling paradigm. Figure 4 shows the Modelica code that underlies the system diagram from
Figure 1.

Within this code, declarations like Modelica.Blocks.Sources.Step refer to components within the Modelica Standard Library. The 'connect' statements within the equation section describe how these components are to be interconnected. Typically, the Modelica code also includes annotations that specify the graphical presentation of the model diagram, including location and size of the components as well as routing of the connections, but we have omitted these annotations for space reasons.

The engineer now has the option of building a system model either using the graphical diagram view or by writing Modelica source code directly. Library components themselves, in turn, are also described using Modelica code. New components can be written in Modelica and code for existing ones can be easily inspected. Since both language and base library are standardized, Modelica models and component libraries are portable between different tools, preventing lock-in to a particular vendor.

That brings us to the real promise of the Modelica standard for engineering companies around the globe: to be part of a growing ecosystem of vendors and consultants, where engineering models can be easily shared and are never tied to a particular tool or vendor, and to leverage an increasing body of knowledge in the form of component libraries and engineering expertise to bring better products to market faster.

Ready for the next step?

Maplesoft™, a subsidiary of Cybernet Systems Co. Ltd. in Japan, is the leading provider of high-performance software tools for engineering, science, and mathematics. Its product suite reflects the philosophy that given great tools, people can do great things.