Functional Mockup Interface for Tool and Model Interoperability Willi Braun, Bernhard Bachmann Acknowledgements: FMI Development Project is developing FMI. Most slides in this presentation by Martin Otter, Torsten Blochwitz, et al.
FMI Motivation 1 Problems / Needs Reuse of supplier models by OEM: DLL (model import) and/or Tool coupling (co-simulation) Protection of model IP of supplier Added Value supplier2 supplier3 supplier4 supplier5 Component development by supplier Integration by OEM Many different simulation tools Solution supplier1 Early validation of design Increased process efficiency and quality slide from Nick Suyam, Daimler (adapted) OEM? supplier1 supplier2 supplier3 supplier4 supplier5 tool 1 tool 2 tool 3 tool 4 tool 5 OEM FMI supplier1! OEM supplier2 supplier3
FMI Motivation 2 No standards available for: Model interface based on C or binaries Co-simulation between simulation tools Lots of proprietary interfaces: Simulink: S-function Modelica: external function, external object interface QTronic Silver: Silver-Module API SimulationX: External Model Interface NI LabVIEW: External Model Interface, Simulation Interface Toolkit Simpack: uforce routines ADAMS: user routines Solution: Functional Mockup Interface (FMI) standard www.fmi-standard.org
Functional Mock-up Interface (FMI) Overview etc. Engine with ECU Gearbox with ECU Thermal systems Automated Chassis components, cargo doorroadway, ECU (e.g. ESP) functional mockup interface for model exchange and tool coupling courtesy Daimler The FMI development is part of the ITEA2 MODELISAR project. (2008-2011; 29 Partner, Budget 30 Mill. ) FMI development is initiated, organized and headed by Daimler AG Improved Software/Model/Hardware-in-the-Loop Simulation, of physical models from different vendors Open Standard 14 automotive use cases for evaluation in MODELISAR
FMI Main Design Idea A component which implements the interface is called Functional Mockup Unit (FMU) Separation of Description of interface data (XML file) Functionality (C code or binary) A FMU is a zipped file (*.fmu) containing the XML description file and the implementation in source or binary form Additional data and functionality can be included
FMI Specifications and Information (www.fmi-standard.org) FMI for Model Exchange (Jan. 2010, Version 1.0) Tool FMU Solver Model FMI for Co-Simulation (Oct. 2010, Version 1.0) Tool FMU Model Solver FMI for Model Exchange and Co-Simulation (July 2014, Version 2.0)
FMI for Model Exchange Tool FMU Solver Model
FMI for Model Exchange: Export/Import/Simulation Export subsystem model as FMU-archive model description (xml-file) executable dll-file containing model equations optionally C source code Simulation Tool 1 User Interface Subsystem 1 Solver Tool 1 Import subsystem model by reading FMU-archive model information from xml-file connecting subsystem variables running system simulation Simulation Tool 2 User Interface Subsystem 2 Solver Tool 2 Subsystem 1.fmu Subsystem 1.fmu
Model Distribution as a zip-file (FMU-archive) XML model description file All model information that is not needed during integration of model, e.g., signal names and attributes. Advantage: Subsystem 2 No overhead for model execution..fmu Tools can read this information (= complicated data structure) with their prefered language (C++, C#, Java,...) Model equations defined by a small set of compiled C-functions: Binary code (DLL) and/or C source code for one or more platforms (Windows, Linux,...) Resources Documentation (html files) Model icon (bitmap file) Maps and tables (read by model during initialization)
FMU-Archive for Model Exchange c o n tro l s im u la t o r G UI re a d s XML schema (.xsd) defined by the FMI specification re fe re n c e s m o d e l.d ll ru n 1 o r m a n y s im u la t o r s o lv e r m o d e ld e s c r ip t io n.x m l.fm u
FMI - Interfaces to Simulation Tool Equation structure: robot from Dymola demo
FMI - Interfaces to Simulation Tool Piecewise continuous system Continuous and discrete states Event indicators
FMI - Interfaces to Simulation Tool
FMI - Interfaces to Simulation Tool Information not needed for execution is stored in one xml-file: Complex data structures give still simple interface. Reduced overhead in terms of memory. robot from Dymola demo
FMI - Interfaces to Simulation Tool Structure of xml-file: Model variables <ModelVariables> <ScalarVariable name="inertia1.j" valuereference="1073741824" description="moment of load inertia" simpletype="modelica.siunits.inertia" causality="parameter" variability="fixed"> <Real start="1"/> </ScalarVariable>
FMI - Interfaces to Simulation Tool Structure of xml-file: Unit definition unit checking possible mapped on 7 SI base units and derived unit rad <UnitDefinitions> <Unit name="rad"> <BaseUnit rad="1"/> <DisplayUnit name="deg" factor="57.2957795130823"/> </Unit> <Unit name="rad/s"> <BaseUnit s="-1" rad="1"/> </Unit> <Unit name="n.m"> <BaseUnit kg="1" m="2" s="-2"/> </Unit> </UnitDefinitions>
FMI for Co-Simulation Tool FMU Model Solver
FMI for Co-Simulation Definition: Coupling of several simulation tools Each tool treats one part of a modular coupled problem Data exchange is restricted to discrete communication points Subsystems are solved independently between communication points Motivation: Simulation of heterogeneous systems Partitioning and parallelization of large systems Multirate integration Hardware-in-the-loop simulation
FMI for Co-Simulation Master/slave architecture Considers different capabilities of simulation tools Support of simple and sophisticated coupling algorithms: Iterative and straight forward algorithms Constant and variable communication step size Allows (higher order) interpolation of continuous inputs Support of local and distributed co-simulation scenarios FMI for Co-Simulation does not define: Co-simulation algorithms Communication technology for distributed scenarios
FMI for Co-Simulation (tool coupling) Use Case Co-Simulation stand alone Co-simulation tool
FMI for Co-Simulation (tool coupling) Use Case Distributed co-simulation scenario Data exchange is handled by a communication layer which is implemented by a special FMI wrapper Master and slave utilize FMI for Co-Simulation only
FMI - Interfaces for Co-Simulation Equation structure: robot from Dymola demo
FMI - Interfaces to Simulation Tool
FMI 2.0 - Model Exchange and Co-Simulation Documents, schema and header files merged - Harmonization Classification of interface variables Variability, Causality, Tunable Improved interface for initialization and events mode Save complete FMU state (Restart of simulation possible) Jacobian matrix (linearization) can be provided as c-function Sparsity pattern of Jacobians can be defined in xml-file Directional derivatives are available (FMU in algebraic loop)...