profiling of modelica real time models
play

Profiling of Modelica Real-Time Models Christian Schulze 1 Michaela - PowerPoint PPT Presentation

GI Profiling of Modelica Real-Time Models Christian Schulze 1 Michaela Huhn 1 Martin Schler 2 1 Technische Universitt Clausthal, Institut fr Informatik, Julius-Albert-Str. 4, 38678 Clausthal-Zellerfeld, Deutschland {Christian.Schulze |


  1. GI Profiling of Modelica Real-Time Models Christian Schulze 1 Michaela Huhn 1 Martin Schüler 2 1 Technische Universität Clausthal, Institut für Informatik, Julius-Albert-Str. 4, 38678 Clausthal-Zellerfeld, Deutschland {Christian.Schulze | Michaela.Huhn}@tu-clausthal.de 2 TLK-Thermo GmbH, Hans-Sommer-Str. 5, 38106 Braunschweig, Deutschland M.Schueler@tlk-thermo.de

  2. GI Overview 1. Introduction 2. Profiling of Modelica Models 3. Implementation 4. Case Study 5. Conclusion Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 2

  3. GI Introduction  Usages of RT simulation: - Rapid Control Prototyping (RCP) - Hardware-in-the-Loop (HiL) - Model Predictive Control (MPC)  Hard real-time (execution time per global solver step <= output step size)  Overruns due to events and algebraic loops  Model has to be improved manually  Profiling helps to trace back the cause of an overrun  There is no applicable profiling tool  We want to profile on the RT-Target: - Calls to external functions (libraries) - Algebraic loops  We want minimize the overhead caused by profiling Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 3

  4. GI Overview 1. Introduction 2. Profiling of Modelica Models 3. Implementation 4. Case Study 5. Conclusion Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 4

  5. GI Simulation on Real-Time Targets  To execute a model on a Real-Time target one has to: Convert to C-source (export) Compile the model application Transfer to the real-time target Execution Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 5

  6. GI Profiling  Tracing vs. Profiling - Call-Graph - Flat-Profile  Instrumentation must be added but causes additional work load  We are profiling by measurement (just like Tau) but are not logging the callee or point in time  One can draw this information from the general structure of those models Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 6

  7. GI Source code of Modelica models  Separated into Initialization and Simulation  Solver step: - n I integration steps - e I external function calls - c I additional calculations - a I (non-)linear blocks - e aI external function calls - c aI additional calculations - 1 output of variables - e O external function calls - a O additional calculations  flat profiling for each section  profiling is done separately for each solver step Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 7

  8. GI Overview 1. Introduction 2. Profiling of Modelica Models 3. Implementation 4. Case Study 5. Conclusion Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 8

  9. GI Export of models Model created in Simulator Export Solver Model converted to C source files Target I/O-methods User source code C source files of the model application Compiler Application Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 9

  10. GI Modified Export of models Model created in Simulator Export Solver Modified model source files Target I/O-methods User source code Profiling I/O-methods C source files of the model application Compiler Application Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 10

  11. GI Modified Source Code  Major impact on the overhead: - Saving profiling data (access to HDD)  Access to HDD is outsourced to secondary application  Model application is a Real-Time Kernel Task(SCALE-RT) - Prioritized execution  Model runtime increases at maximum by 4% Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 11

  12. GI Implementation  Communication between user task and model task Real-Time Linux Kernel Space (RTAI-API) User Space Model User Space (Kernel module) Buffer FIFO Application Real-Time Task data exchange data storage Source code HDD Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 12

  13. GI Overview 1. Introduction 2. Profiling of Modelica Models 3. Implementation 4. Case Study 5. Conclusion Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 13

  14. GI Case Study  Steady State Continuity Equation Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 14

  15. GI Model runtime over simulated time 647 µs 547 µs model runtime 447 µs 347 µs 247 µs 147 µs 47 µs -0,2s 0,0s 0,2s 0,4s 0,6s 0,8s simulated time Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 15

  16. GI Results of Profiling  Global solver step separated into integration steps and output of results integration integration steps; 47,61µs steps; 47,61µs integration integration steps; 47,61µs steps; 47,61µs output of results; 5,34µs overhead by global solver; 7,76µs Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 16

  17. GI Results of Profiling  Integration steps separated into external fluid property calculations, non- linear equations and overhead integration integration steps; 47,61µs steps; 47,61µs integration integration steps; 47,61µs overhead; steps; 47,61µs 3,240 fluid non-linear properties; output of equations; 8,052 results; 5,34µs 36,290 overhead by global solver; 7,76µs Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 17

  18. GI Algebraic loops  Closer look on integration steps non-linear fluid equations; properties; 36,290 8,052 overhead; 3,240 Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 18

  19. GI Algebraic loops  Non-linear equations assinged to submodels tube.Cell.heatPort.Q_flow_0; 0,53 tube.Cell.heatPort.T_1; 0,518 _der_tube1.Cell.T_1; 1,282 _der_tube.Cell.T_1 _der_tube1.Cell.T_0; 1,3 pump2ndOrder.P_shaft _der_pump2ndOrder1.T; 1,408 _der_pump2ndOrder.T pump2ndOrder1.P_shaft; 0,566 _der_tube.Cell.T_0 tube1.wallCell.T_1; 0,506 pump2ndOrder.v_flow tube1.wallCell.portS.T_0; 0,508 ; 28,27 sink1.port.h; 0,722 pump2ndOrder1.v_flow; 0,68 non-linear fluid equations; properties; 36,290 8,052 overhead; 3,240 Steady State continuity equation Dynamic State continuity equation Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 19

  20. GI Mass flow of inlet and outlet  Error due to thermal expansion of liquid dynamicSC_source dynamicSC_sink steadySC_sink&source 0,3158 mass flow rate [kg/s] 0,3156 0,3154 0,3152 0,315 0,3148 0,3146 0,3144 0,3142 0,314 0,3138 2 2,5 3 3,5 4 time [s] Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 20

  21. GI Overview 1. Introduction 2. Profiling of Modelica Models 3. Implementation 4. Case Study 5. Conclusion Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 21

  22. GI Conclusion  Saving results to HDD should be outsourced to a secondary non-Real-Time application  Flat profiling by measurement for each step gives more than enough information  Profiling helps identifying the work load contributions and aids the user optimizing the model Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 22

  23. GI Thank you for your attention! Christian Schulze Institut für Informatik EOOLT 2010- Profiling of Modelica Real-time Models 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend