Technologies for Creating Easily Maintainable Component Model Libraries of Complex Physical Systems. Fran ç ois E. Cellier Department of Computer Science ETH Zurich Switzerland. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
• The Modelica Standard Library (SL) is growing at an amazing pace. Whereas originally, the SL was meant as a small add-on created for the convenience of the end user, the library is now growing faster in terms of number of lines of code than the Modelica compilers themselves. Fairly soon, the SL will be larger in size than the compilers managing it.
• Maintaining such a large library has become a daunting task, especially since this is a highly distributed endeavor, i.e., there are many researchers contributing regularly to the SL.
• The developers of Modelica environments have long recognized this problem, and they are meanwhile offering quite sophisticated library management tools, such as version control, scripts for automated upgrading of libraries from one version of Modelica to the next, etc.
• Yet, tools for managing potentially bad models offer only a partial answer to the problem. More important are tools that minimize the complexity of the individual model codes and that support the modeler in making sure that his or her models are correctly reflecting the physics of the underlying physical system to be modeled.
• This presentation offers a discussion of such methodologies.
3. Model Wrapping• Library designers should make use of the best suited
graphical modeling methodology for representing their models to the end user.
• However, models can use more than one graphical layer.
• There is no need to implement the top graphical layer directly using equation models.
• Model wrapping enables the library designer to interpret one graphical modeling methodology in terms of another lower-level graphical modeling approach, such as a bond graph.
Crane Crab Simulation ResultsThe animation needs to be associated with the MBS layer, and not with the bond graph layer. Individual bonds cannot be animated. Consequently, the multi-bond graph is not suitable as a user interface.
Model Wrapping II• Wrapped models contain wrapper models that
convert the upper-layer connectors to the lower-layer connectors, and vice-versa.
• They use the protected keyword to hide the internal lower-layer variables from the simulation. In this way, the set of variables offered for display in the simulation window is identical in both libraries. This is called wrapping the model tight.
• The state select algorithm is used to ensure that the flattened Modelica model will employ the same state variables in both libraries.
The Sliding Mass Model II• The natural state variables of this
model are the internal variables I.f and sAbs.Integrator1.y. This is inconvenient.
• The user of the model would prefer to use the local variables v and s of the mass model as state variables.
• Modelica can be told to modify the equations such that, if possible, the desired variables are being used as state variables, i.e., show up in the simulation code with a der() operator.
The Sliding Mass Model IV• One question that remains is for
which variables we now have to specify the initial conditions.
• Do we do it for the new state variables s and v, or do we still do it for the natural state variables?
• It turns out that we can do either or, but not both.
• Modelica will use the specified values as start values of an iteration and iterate on the unknown initial values of the new state variables, until it finds a set of initial conditions that is consistent with the information that has been specified by the user.
Efficiency Considerations• The following table compares the efficiency of the
simulation code obtained using the multi-body library contained as part of the standard Modelica library with that obtained using the 3D mechanics sub-library of the multi-bond graph library.
• Beside from the standard 1D bond graph elements, BondLib offers additionally wrapped sub-libraries for electrical analog circuits; for mechanical 1D translational and rotational motions; a heat transfer sub-library; and a small hydraulics sub-library.
• The electrical sub-library contains in addition a full implementation of Spice.
MultiBondLib• Beside from the standard 2D and 3D mechanical multi-bond
graph elements, MultiBondLib offers additionally wrapped sub-libraries for planar mechanical motions and for 3D mechanical motions including fully automated animation.
• These wrapped sub-libraries are equivalent in power and efficiency to the multi-body system library contained as part of the Modelica standard library.
• In addition, MultiBondLib offers separate sub-libraries for planar mechanics; the possibility to model elastic and inelastic impacts between 3D bodies; as well as the possibility of modeling gravitational pools, such as needed for the simulation of planetary systems. These features are not currently available in the Modelica standard library.
4. Multiple Implementations• We can never be absolutely sure that our libraries don’t
contain errors, or that neither the model compiler nor the simulation engine contain bugs.
• To reduce the likelihood of such errors, it is useful to have multiple implementations available.
• By comparing the simulation results of the standard library with those of the three bond graph libraries, we can verify the correctness of the libraries.
• By comparing the simulation results of e.g. Dymola with those of OpenModelica, we can verify the correctness of the model compilers and simulation engines.
Conclusions• In this presentation, I have looked at a number of
features that can help create safer models:1. graphical modeling2. bond graph modeling3. model wrapping4. multiple implementations5. derived data types6. assertions
• Together they offer means for creating Modelica libraries that are safer to use and easier to maintain.