Multi-Core Simulation of Internal Combustion Engines Us
Transcription
Multi-Core Simulation of Internal Combustion Engines Us
CO2 maîtrisé | Carburants diversifiés | Véhicules économes | Raffinage propre | Réserves prolongées Multi-core Simulation of Internal Combustion Engines using Modelica, FMI and xMOD © 2012 IFP Energies nouvelles Abir Ben Khaled, IFPEN Mongi Ben Gaid, IFPEN Daniel Simon, INRIA Rhône Alpes Nicolas Pernet, IFPEN © 2012 IFP Energies nouvelles Outline 2 Introduction, context and motivations Engine modeling using Modelica and models interoperability using FMI Integration and multi-core execution using xMOD Test cases and demos Conclusions Context From off-line simulation to real-time simulation Off-line multi-core cosimulation platform Control algorithms development (Simulink,...) Real-time multicore co-simulation platform Controllers or actuators validations © 2012 IFP Energies nouvelles Real-time multicore co-simulation platform 3 Physical components models development (OpenModelica, Dymola, AMESim...) virtual Virtual integration et experimentation laboratory Integration of heterogeneous models Validation of physical components on test beds semi-virtual semi-real Motivations Processors evolution © 2012 IFP Energies nouvelles Computational power improvement in today processors is mainly driven by the augmentation of the number of cores per processor Concurrent execution of threads to exploit Thread Level Parallelism (TLP) Efficient exploitation of resources depends of 4 Splitting applications into tasks Distributed scheduling of tasks Core 0 Core 1 Core 2 Core 3 Motivations © 2012 IFP Energies nouvelles Combining real and virtual 5 Motivations Enabling new concepts industrialization © 2012 IFP Energies nouvelles Developing new engine concepts that reduce pollutants and consumption requires the ability to simulate, in real-time, the incylinder behaviour (cylinders pressure) 6 Core 0 Core 1 Core 2 Core 3 © 2012 IFP Energies nouvelles ModEngine library 7 Functional Mock-up interface (FMI) • FMI is a set of specifications including – © 2012 IFP Energies nouvelles – 8 FMI for model exchange : describes the software interface of a hybrid ODE (inputs, outputs, parameters, variables, API functions that a solver and an environment needs to call ...) FMI for co-simulation : provides a software interface for coupling two or more simulation tools or components, in a master/slave scheme. A slave may be a component integrating both the model and its solver xMOD Concept A platform dedicated to models exploitation To improve : © 2012 IFP Energies nouvelles 9 Heterogeneous model integration environment Standalone and optimal model exploitation Virtual experimentation laboratory Model exchange : Having the same tools is no longer necessary to share models improve the collaboration internally and externally © 2012 IFP Energies nouvelles xMOD contributions 10 Proficiency : proficiency in simulation design tools is no longer the "entry ticket" for exploiting simulation Help models exploitation by non expert fields Tools choice : Modeling language choice has less impact on users Congregates the benefits of each tool for each specific application, without having to leave its own tools CPU time : xMOD allows a parallel and optimized execution reduce the computation time License cost : model exploitation in xMOD does not require any license of the original authoring tools if appropriate export features are used reduce license cost xMOD functionalities © 2012 IFP Energies nouvelles C 11 C++ A.c B.cpp A.xmodel B.xmodel A.dll B.dll C. mdl D. ame E.mo F.gtm G.fmu C.xmodel D.xmodel E.xmodel F.xmodel G.fmu C.dll D.dll E.dll F.dll xMOD Platform xMOD functionalities © 2012 IFP Energies nouvelles 12 Specific interfaces creation Better simulation workspace customized for each engineering field Easy interactivity with the model in real-time Easy to use exchange vector of models Protect models know how xMOD functionalities • Compatibility to new Functional Mock-up Interface (FMI) standard standard from MODELISAR project – FMI-for-model exchange 1.0 • Available solvers in xMOD : Euler, Runge-Kutta, DASSL, DASKR, CVODE, LSODAR xMOD © 2012 IFP Energies nouvelles Solver 13 – FMI-for-cosimulation 1.0 xMOD FMU Model FMU Model Solver Multi-core co-simulation : approach B A D C F E A D B A © 2012 IFP Energies nouvelles C 14 E F D B C E F E F D B A C E F E F E F Multi-core co-simulation : workflow © 2012 IFP Energies nouvelles 15 Decompose the global system into subsystems (preferably with weak coupling) Export each subsystem to an FMU Assemble generated FMUs in xMOD Each FMU is executed into a separate thread – with a dedicated solver (fixed step or variable step) – with a dedicated integration step-size – with a dedicated communication step-size A global master ensures proper data transfer during communication points according to a well defined model of computation Engine model splitting Partitioning engine model from a physical point of view © 2012 IFP Energies nouvelles 16 16 Minimize the number of discontinuities per subsystem Minimize integration interrupts Minimize interaction dynamics Engine Simulator AirPath Combustion chamber 1 ECU Combustion chamber 2 Combustion chamber 3 Combustion chamber 4 Data exchange overview V a ria ble integ ra tion s tep OR E ng ine s im ula to r C o m m unic a tio n s tep E ng ine s im ula to r Fix ed integ ra tion s tep C om m unic a tio n s tep © 2012 IFP Energies nouvelles I nitia liza tio n 17 17 17 E x c ha ng e 1 E x c ha ng e 2 E C U C o ntro ller C o m m unic a tio n s tep F4RT Wiebe test case Test case description © 2012 IFP Energies nouvelles 18 Gasoline engine Modeled in Modelica/Dymola using IFPEN library ModEngine Split into 5 subsystems : AirPath + 4 cylinders Combustion chambers models are based on a Wiebe combustion model 500 µs communication step LSODAR used for integrating all split sub-models, except controls LSODAR tolerance = 10-4 Global simulator has 87 state variables and 420 event indicators F4RT Wiebe test case Benefits of model splitting and co-simulation Events only here © 2012 IFP Energies nouvelles Almost no events: Forward integration could performed 19 19 On single core, X2 speed-up F4RT Wiebe test case Benefits of model splitting and co-simulation © 2012 IFP Energies nouvelles step size = max 20 20 Complete Diesel Hybrid vehicle demonstrator Test case description © 2012 IFP Energies nouvelles 21 Diesel engine 12 gas model Modeled in AMESim using IFP-Engine library Combustion chambers models are based on Barba phenomenological combustion model Vehicle dynamics modeled in AMESim Complete controls Around 300 state variables Complete Diesel Hybrid vehicle demonstrator © 2012 IFP Energies nouvelles Comparative results : Simulink & xMOD 22 Using Simulink Requires applying a unique solver and step-size Euler solver with step-size of 25 µs applied to the global system Uses only one core of the machine Using xMOD Engine model was split into 5 parts : air path + 4 cylinders Air path is integrated using Euler solver with 100 µs Cylinders are integrated using Euler solver with 25 µs Vehicle model is integrated with RK4 solver with 500 µs Remaining models and controls are run with appropriate solvers and step-sizes (from 500 µs to 100 ms) Results A speedup of X25 was observed on a 6-core machine using xMOD wrt Simulink Simulation in xMOD is 20% faster than real-time Conclusion © 2012 IFP Energies nouvelles 23 Approach for complex systems simulation Similar speed-up results observed with other engine models This approach was successfully to production models from automotive OEM OpenProd remaining objectives – Integrating OpenModelica to this toolchain – Linux & Xenomaï compatibility