experiences with the new fmi standard selected ... · experiences with the new fmi standard...

9
Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schubert a Thomas Neidhold b Günter Kunze a a Dresden University of Technology, Chair of Construction Machines and Conveying Technology Münchner Platz 3, 01187 Dresden, Germany b ITI GmbH, Webergasse 1, 01067 Dresden, Germany January 31, 2011 Abstract This paper describes how the new FMI stan- dard is used at Dresden University to provide a universal model exchange. By employing the new standard exchange format a single simula- tion model can be used for different purposes in different software tools. Specific applica- tions and their advantages will be presented as well as the development effort for their reali- sation. Special attention is paid to how FMI enables SimulationX models to be run in an in- teractive simulation on a motion platform. Fi- nally, the benefits and drawbacks of the FMI interface are discussed from a user’s perspec- tive. Keywords: FMI, Modelisar, Virtual Reality, SimulationX, Motion Platform, SARTURIS 1 Introduction Simulation has become an indispensable tool in the field of machine construction and design. It is especially beneficial for Heavy Mobile Machinery since their low quantities and high production costs render real prototypes uneco- nomical. During the design process, there are many tasks which can be supported by simula- tion such as comparing the effect of different parameter combinations and model variations. In order to achieve maximum efficiency, ver- ified models should be reused as often as pos- sible. However, this can only be possible if there exists a common standardised interface for model exchange between different software tools for different applications. Modelica has already proven to be a valu- able contribution towards the simulation of Mobile Machinery [1, 2]. On the one hand it features an inherent support of multidomain models, on the other hand it features a seam- less transition between a mathematical and a graphical model definition allowing for com- plex but structured models at the same time. Although Modelica is tool independent and can thus be used to exchange models between cer- tain simulation environments, it cannot be used as a general model interface. The reason is, that every tool used for import would have to parse, flatten and optimise the Modelica code for which no general purpose library is avail- able. The new Functional Mockup Interface (FMI), a result of the MODELISAR project [3], overcomes the aforementioned problem. The next chapter features a brief descrip- tion of the FMI standard. It is followed by an

Upload: others

Post on 08-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

Experiences with the new FMI StandardSelected Applications at Dresden University

Christian Schuberta Thomas Neidholdb Günter Kunzea

aDresden University of Technology, Chair of Construction Machines and Conveying TechnologyMünchner Platz 3, 01187 Dresden, Germany

bITI GmbH, Webergasse 1, 01067 Dresden, Germany

January 31, 2011

Abstract

This paper describes how the new FMI stan-dard is used at Dresden University to provide auniversal model exchange. By employing thenew standard exchange format a single simula-tion model can be used for different purposesin different software tools. Specific applica-tions and their advantages will be presented aswell as the development effort for their reali-sation. Special attention is paid to how FMIenables SimulationX models to be run in an in-teractive simulation on a motion platform. Fi-nally, the benefits and drawbacks of the FMIinterface are discussed from a user’s perspec-tive.

Keywords: FMI, Modelisar, Virtual Reality,SimulationX, Motion Platform, SARTURIS

1 Introduction

Simulation has become an indispensable toolin the field of machine construction and design.It is especially beneficial for Heavy MobileMachinery since their low quantities and highproduction costs render real prototypes uneco-nomical. During the design process, there aremany tasks which can be supported by simula-

tion such as comparing the effect of differentparameter combinations and model variations.

In order to achieve maximum efficiency, ver-ified models should be reused as often as pos-sible. However, this can only be possible ifthere exists a common standardised interfacefor model exchange between different softwaretools for different applications.

Modelica has already proven to be a valu-able contribution towards the simulation ofMobile Machinery [1, 2]. On the one handit features an inherent support of multidomainmodels, on the other hand it features a seam-less transition between a mathematical and agraphical model definition allowing for com-plex but structured models at the same time.Although Modelica is tool independent and canthus be used to exchange models between cer-tain simulation environments, it cannot be usedas a general model interface. The reason is,that every tool used for import would have toparse, flatten and optimise the Modelica codefor which no general purpose library is avail-able. The new Functional Mockup Interface(FMI), a result of the MODELISAR project[3], overcomes the aforementioned problem.

The next chapter features a brief descrip-tion of the FMI standard. It is followed by an

Page 2: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

overview of the work and the employed soft-ware tools at the Chair of Construction Ma-chines and Conveying Technology at DresdenUniversity before FMI has been introduced.Chapter four presents the benefits which havebeen achieved by implenting and applying FMIto this software environment. Special attentionis paid to what has been changed and what hadto be implemented. One major achievement ofintegrating the FMI standard is the option torun SimulationX models on the motion plat-form at Dresden University and is described inchapter five. It allows the evaluation of differ-ent machine configurations and their parame-ters within an interactive simulation. The paperconcludes with a discussion of the advantages,drawbacks and possible solutions when usingFMI from a user’s perspective.

2 The FMI Standard

FMI, short for Functional Mockup Interface,is a new standard for model exchange [4] aswell as co-simulation defined within the MOD-ELISAR project. It describes a set of functionsand their parameters which shall be part of abinary .dll (Dynamic Link Libary) file or .so(Shared Object) file under Windows or Linuxrespectively. The binary file is complementedby an XML file which includes a descriptionof the model and all its variables. The sepa-ration of model and description data leads tovery efficient code, which may even be runon embedded systems, while maintaining us-ability for more powerful systems by offeringthe complementary XML documentation. Us-ing a simple binary format has the advantagethat it can be included at minimal effort in al-most any application that allows incorporatinguser code. Thus, the FMI standard fills the gapbetween abstract Modelica models and vendordependent co-simulation.

3 Initial Situation at DresdenUniversity

One research topic of the Chair of Construc-tion Machines and Conveying Technology atDresden University is concerned with studyingand optimising Heavy Mobile Machinery andits components by using interactive simulationmethods. Therefore a modular software frame-work called SARTURIS has been developed[2]. It allows real time simulation of technicalsystems in a virtual reality (VR) environmentand features easy and flexible hardware inte-gration in addition to a powerful visualisation.SARTURIS is based on C++, uses freely avail-able libraries and is platform independent. Thesoftware framework provides a diversity of ap-plications for models of technical systems. Itis suited for both the analysis of machine be-haviour on a PC or laptop as well as an inter-active simulation on a motion platform (Figure1).

Figure 1: Motion Platform at Dresden Univer-sity

Page 3: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

In order to create simulation models, to runtask-specific simulations or to evaluate simula-tion results different custom-designed softwaretools are used. Thereby the interaction of twoor more tools can be useful and an exchange ofdata between them is necessary.

Figure 2 depicts the initial situation. Fivebasic proprietary exchange algorithms alreadyexisted or have been implemented for specifictools or tool combinations, providing the basisfor different tasks:

1. Simulation tools based on Modelica forinstance, are able to exchange models ingeneral.

2. Many commercial tools like Simula-tionX, Simpack and Dymola support co-simulation with MATLAB/Simulink.

3. Other tools offer a wide range of outputformats like PyMbs [2], a software for therealtime simulation of multibody systems.

4. Pynacolada, a software that supports re-curring analysing tasks, features a broadrange of input formats like MATLAB,SARTURIS and general HDF5 [5] datasets.

5. Specialised auxiliary tools or wrappershad to be developed to accomplish theexchange of required model data fromOpenModelica and Simpack for an inter-active simulation with SARTURIS.

Such tool couplings are important since expe-rience has shown that general simulation en-vironments are not always the best option forspecialised engineering tasks. Next to classicalsimulations, models of technical systems canbe used to solve other problems like inversekinematics or finding optimal constructive ge-ometries. Software designed for such tasks canonly produce reliable results if the technical

system regarding the problem is described ac-curatly enough. Those specialised tools how-ever are rarely convinient modelling environ-ments. If one can establish a comfortable andefficient data and model exchange, both soft-ware strategies could be combined with theiradvantages. Thus an expanded range of appli-cations could be achieved.

Individiual solutions for coupling tools (seeoption 5) have the great disadvantage that theyare very specific and need constant attention.Extending the coupling to another tool usuallycalls for a different specialised data exchangestrategy. This leads to the circumstance thatnot all possible exchange paths have been re-alised although many other tool interactionswould be benefitial. The new FMI standardis a promising approach to provide a com-mon foundation for universal model exchangeand thus increasing flexibility while reducingmaintenance efforts.

4 Integration of FMI

The introduction of FMI as the common inter-face between all tools led to a great simpli-fication, see Figure 3. Now every tool sim-ply exports FMI, imports it or supports both.Thus one single model can be made availableto other tools very easily. There is no need forspecialized utilities or wrappers anymore to es-tablish data or model exchange between twotools. As soon as a tool features an FMI importor export it can be incorporated in every toolchain without any extra effort. Current ver-sions of Modelica tools, such as SimulationX,JModelica and Dymola already feature FMIexports as well as FMI imports. For the OpenSource alternative OpenModelica, the FMI ex-port is currently being developed in a coop-eration between Linköping and Dresden Uni-versity and will be available in future releases.Outside the Modelica community FMI gains in

Page 4: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

Figure 2: Tool Chains Before FMI

Figure 3: Tool Chains After FMI

Page 5: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

importance as well. SIMPACK as a partner inthe MODELISAR project for instance is de-veloping an FMI import enabling SIMPACKusers to include Hydraulics into their multi-body models using specialised software.

Unfortunately, no FMI implementation forMATLAB is known to the authors yet.Hence the authors started developing animport wrapper for both MATLAB andSimulink as well as an export for MAT-LAB Simulink models based on the C-Codegenerated by the Real-Time-Workshop (seehttp://code.google.com/p/fmi2matlab/).

Equipping self developed tools with FMI ca-pabilities, proved to be a reasonable amountof effort. Due to the comprehensive docu-mentation [4] as well as the FMU SoftwareDevelopment Kit provided by QTronic [6] aneasy to understand reference implementation isavailable. Thus PyMbs, Pynacolada and SAR-TURIS do now support FMI.

5 SimulationX Models in Inter-active Simulation via FMI

A particular interesting application of the newFMI based tool chain is the investigation of vir-tual prototypes using interactive simulation viathe motion platform at Dresden University, seeFigure 1. Whereas motion platforms are tra-ditionally used to evaluate the influence of themachine and its complexity on the human oper-ator, the aim of the Chair of Construction Ma-chines and Conveying Technologies is the op-posite. The motion platform is intended as atool for studying the influence of the humanoperator on the machine. Thus it is possibleto obtain joint forces and pressure distributionsdependent on the behaviour of the operator andgenerally gain a deeper understanding of themachine and the ways to optimise it while it isin operation.

In order for the results to be significant a de-tailed model comprising mechanis, hydraulics,drivetrain and control systems has to be simu-lated. A way of developing such models hasbeen presented by the authors in [2]. Due tothe newly implemented FMI functionalities ofSARTURIS one can now use SimulationX aswell to set up models for the motion platform.Thus the full range of the SimulationX modellibraries can be used which can considerablyshorten the modeling effort.

To test the FMI based tool chain a model ofa wheel loader, see Figure 4, has been devel-oped together with ITI GmbH. In addition tothe multibody system it consists of hydrauliccylinders and valves, a reduced drivetrain andPaceijka tire models. Furthermore it consid-ers contact between the bucket and the under-ground. The model has been developed andthoroughly tested within SimulationX and it iscapable of running in realtime.

As the new SimulationX offers FMI Export,the model can now be easily transferred toSARTURIS which in turn controls the motionplatform. Within SimulationX all inputs whichshould be provided by the operator are definedas well as all outputs needed for visualisationand the evaluation of the model. The wheel-loader modelled with SimulationX is now run-ning within an interactive simulation on themotion platform and can be driven through avirtual environment.

Along with the described benefits, there areproblems that had to be overcome and shall bediscussed in the following.

6 Visualisation

Although importing the model via FMI is easyto accomplish, the visualisation of the techni-cal system has to be set up twice. Once in themodeling software for assembling the multi-body system and a second time in the simu-

Page 6: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

Figure 4: Model of a Wheel Loader in SimulationX

Page 7: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

lation software for visualising the results. FMIdoes not incorporate any additional data con-cerning the graphics. According to the FMIphilosophy, where the binary file is supposedto only contain the vital model information sothat it can be run on embedded platforms, theseadditional information should not be stored inthe code but either within the accompanyingmodel description or within an extra file. Pos-sible approaches might involve usage of thestandards X3D [7] or COLLADA [8].

7 External Functions

7.1 Problem

It is often required to use the same vehiclemodel for different simulation tasks on differ-ent test tracks. Every vehicle model is there-fore stored in a separate FMU. When per-forming contact detection, as needed for de-termining the tire contact point or general col-lisions, an extensive communication betweenthe model and the track is needed.

Using FMI this can either be achieved by us-ing inputs and outputs or linking user definedcode statically. Statically linked user definedcode is unsuitable since it would be difficultto communicate with the simulation environ-ment. Even if it could be accomplished, the re-sulting FMU can only be used in combinationwith that particular environment. Using inputsand outputs are not suitable as well since theirnumber may grow very large the more often aspecific function is used. Also iterative meth-ods would be hard to implement.

7.2 Possible Solution

What is needed is a coupling of the FMU andthe simulation environment at runtime prefer-ably via callbacks. Unfortunately, the currentFMI interface does not support such a feature.

That is why for our models we extended theFMI interface by the following functionf m i S t a t u s f m i S e t E x t e r n a l F u n c t i o n (

fmiComponent c ,v a l u e R e f e r e n c e ∗vr ,void ∗ f u n c t i o n P o i n t e r ) ;

passing a void function pointer to an fmiCom-ponent. Therefore the accompanying modelde-scription XML has been extended by all exter-nal functions, that can be set at runtime withtheir valueReference as well as their input andoutput parameters. Thus almost no additionalcode has to be included into the model itself.

7.3 Compatibility

Such an FMU may still be compatible to gen-eral purpose simulation tools. When instan-tiating an FMI component, all external func-tions and their signature are known from themodeldescription XML file. Thus, a user maychoose an external function from all functionsthat are known to the tool and have the samesignature.

7.4 Modelica

In order to create such an FMU from a Mod-elica tool, these functions have to be marked.This can either be done by introducing a newannotation or by extending the Modelica lan-guage. In fact, the Modelica standard 3.2 al-ready offers Functional Input Arguments ToFunctions ([9], section 12.4.2 ). If this featurewas to be carried over from functions to gen-eral models a clear description had been found.

7.5 Example

In order to illustrate this idea, a simple exam-ple shall be given. Consider the bouncing ballexample:model B o u n c i n g B a l l

c o n s t a n t Rea l g = 9 . 8 1 ;p a r a m e t e r Rea l c = 0 . 9 ;

Page 8: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

p a r a m e t e r Rea l r a d i u s = 0 . 1 ;Rea l h e i g h t ( s t a r t = 1 ) ;Rea l v e l o c i t y ( s t a r t = 0 ) ;i n p u t H e i g h t F u n c t i o n h e i g h t F u n ;

e q u a t i o nd e r ( h e i g h t ) = v e l o c i t y ;d e r ( v e l o c i t y ) = −g ;when h e i g h t <= ( r a d i u s + h e i g h t F u n ( t ime )

) t h e nr e i n i t ( v e l o c i t y , −c∗ p r e ( v e l o c i t y ) ) ;

end when ;end B o u n c i n g B a l l ;

The type HeightFunction may be defined asp a r t i a l f u n c t i o n H e i g h t F u n c t i o n

i n p u t Rea l t ;o u t p u t Rea l h e i g h t ;

end H e i g h t F u n c t i o n ;

returning the height of the underground at agiven time t.

A complete test model might look likef u n c t i o n S i n u s H e i g h t

e x t e n d s H e i g h t F u n c t i o n ;a l g o r i t h m

h e i g h t := s i n ( t ) ;end S i n u s H e i g h t ;

model SinBounceB o u n c i n g B a l l b a l l ;

e q u a t i o nb a l l . h e i g h t F u n = S i n u s H e i g h t ;

end SinBounce ;

If the model BouncingBall were translatedinto an FMU the function pointer heightFuncould be treated like any other componentmapping it to void* and including it into themodeldescription.xml. In addition the xml de-scription should include the signature of thefunction (inputs and outputs) as well as itscomment which should be used as a short de-scription what this function does.

8 Model Exchange AcrossCompany Borders

One major advantage of FMI is that the modelexchange described in this paper does not needto be limited to one institution or companyonly. Using FMI might also be a valuable

tool for cooperation between OEMs and theirsuppliers. Since it is virtually impossible todeduct information from models in binary for-mat, suppliers can safely provide models toOEMs without revealing too much of theirknowledge. However, in order to exchange amodel in binary format only, all target plat-forms have to be known in advance. True plat-form independence is achieved by exchang-ing source code allowing more insight into themodel.

9 Conclusion

It has been shown that powerful modeling toolsare not always the best option for specialisedsimulation tasks. However, software designedfor special tasks can only be as good as theirunderlying models of the technical system.Thus it is beneficial to exchange models be-tween such tools.

Before FMI it has always been a very spe-cialised solution which was hard to maintain.Using FMI at Dresden University has helpedto unify the modeling and simulation softwareenvironment. It reduced the need for aux-iliary tools establishing the model exchangeand the time spent on developing and main-taining them. A major benefit is the optionto run multidomain models created in Simula-tionX within an interactive simulation on themotion platform at Dresden University whichcan be used to study the influence of the oper-ator on the machine and its components. Openproblems like visualisation and calling externalfunctions have been adressed as well as politi-cal advantages when using FMI.

References

[1] Beater, P.; Otter, M.: Multi-Domain Sim-ulation: Mechanics and Hydraulics of an

Page 9: Experiences with the new FMI Standard Selected ... · Experiences with the new FMI Standard Selected Applications at Dresden University Christian Schuberta Thomas Neidholdb Günter

Excavator, Proceedings of the 3rd Inter-national Modelica Conference, November2003, pp. 331-340

[2] Frenkel, J.; Schubert, C.; Guenther, K.:Using Modelica for Interactive Simula-tions of Technical Systems in a VirtualReality Environment, Proceedings of the7th International Modelica Conference,Como, September 2009

[3] MODELISAR consortium:MODELISAR Project Profile,http://www.itea2.org/public/project_leaflets/MODELISAR_profile_oct-08.pdf

[4] MODELISAR consortium: FunctionalMock-up Interface for Model Exchange,http://modelisar.org/specifications/FMI_for_ModelExchange_v1.0.pdf

[5] The HDF Group: HDF5,http://www.hdfgroup.org/HDF5/

[6] QTronic GmbH: FMU SDK 1.0.1,http://www.qtronic.de/en/fmusdk.html

[7] web3D Consortium: X3D Specification,http://www.web3d.org/x3d/specifications/

[8] Khronos Group: COLLADA - Digital As-set Exchange Schema for Interactive 3D,http://www.khronos.org/collada/

[9] Modelica Association: Modelica - A Uni-fied Object-Oriented Language for Physi-cal Systems Modeling - Language Specifi-cation Version 3.2, March 2010