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

profiling of modelica real time models
SMART_READER_LITE
LIVE PREVIEW

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 |


slide-1
SLIDE 1

GI

Profiling of Modelica Real-Time Models

Christian Schulze1 Michaela Huhn1 Martin Schüler2

1Technische Universität Clausthal, Institut für Informatik, Julius-Albert-Str. 4,

38678 Clausthal-Zellerfeld, Deutschland {Christian.Schulze | Michaela.Huhn}@tu-clausthal.de

2TLK-Thermo GmbH, Hans-Sommer-Str. 5, 38106 Braunschweig, Deutschland

M.Schueler@tlk-thermo.de

slide-2
SLIDE 2

Christian Schulze Institut für Informatik

2

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Overview

  • 1. Introduction
  • 2. Profiling of Modelica Models
  • 3. Implementation
  • 4. Case Study
  • 5. Conclusion
slide-3
SLIDE 3

Christian Schulze Institut für Informatik

3

EOOLT 2010- Profiling of Modelica Real-time Models

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
slide-4
SLIDE 4

Christian Schulze Institut für Informatik

4

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Overview

  • 1. Introduction
  • 2. Profiling of Modelica Models
  • 3. Implementation
  • 4. Case Study
  • 5. Conclusion
slide-5
SLIDE 5

Christian Schulze Institut für Informatik

5

EOOLT 2010- Profiling of Modelica Real-time Models

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

slide-6
SLIDE 6

Christian Schulze Institut für Informatik

6

EOOLT 2010- Profiling of Modelica Real-time Models

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

  • r point in time
  • One can draw this information from

the general structure of those models

slide-7
SLIDE 7

Christian Schulze Institut für Informatik

7

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Source code of Modelica models

  • Separated into Initialization and Simulation
  • Solver step:
  • nI integration steps
  • eI external function calls
  • cI additional calculations
  • aI (non-)linear blocks
  • eaI external function calls
  • caI additional calculations
  • 1 output of variables
  • eO external function calls
  • aO additional calculations
  • flat profiling for each section
  • profiling is done separately for each solver step
slide-8
SLIDE 8

Christian Schulze Institut für Informatik

8

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Overview

  • 1. Introduction
  • 2. Profiling of Modelica Models
  • 3. Implementation
  • 4. Case Study
  • 5. Conclusion
slide-9
SLIDE 9

Christian Schulze Institut für Informatik

9

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Export of models

C source files of the model application Solver User source code Target I/O-methods Compiler Application Model converted to C source files Export Model created in Simulator

slide-10
SLIDE 10

Christian Schulze Institut für Informatik

10

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Modified Export of models

C source files of the model application Solver User source code Target I/O-methods Compiler Application Modified model source files Export Model created in Simulator Profiling I/O-methods

slide-11
SLIDE 11

Christian Schulze Institut für Informatik

11

EOOLT 2010- Profiling of Modelica Real-time Models

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%
slide-12
SLIDE 12

Christian Schulze Institut für Informatik

12

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Implementation

  • Communication between user task and model task

Real-Time Linux Kernel Space (RTAI-API) User Space

Source code Model (Kernel module) Real-Time Task User Space Application data exchange Buffer HDD data storage FIFO

slide-13
SLIDE 13

Christian Schulze Institut für Informatik

13

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Overview

  • 1. Introduction
  • 2. Profiling of Modelica Models
  • 3. Implementation
  • 4. Case Study
  • 5. Conclusion
slide-14
SLIDE 14

Christian Schulze Institut für Informatik

14

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Case Study

  • Steady State Continuity Equation
slide-15
SLIDE 15

Christian Schulze Institut für Informatik

15

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Model runtime over simulated time

47 µs 147 µs 247 µs 347 µs 447 µs 547 µs 647 µs

  • 0,2s

0,0s 0,2s 0,4s 0,6s 0,8s model runtime simulated time

slide-16
SLIDE 16

Christian Schulze Institut für Informatik

16

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Results of Profiling

  • Global solver step separated into integration steps and output of results
  • verhead by

global solver; 7,76µs

  • utput of

results; 5,34µs integration steps; 47,61µs integration steps; 47,61µs integration steps; 47,61µs integration steps; 47,61µs

slide-17
SLIDE 17

Christian Schulze Institut für Informatik

17

EOOLT 2010- Profiling of Modelica Real-time Models

GI

  • verhead by

global solver; 7,76µs

  • utput of

results; 5,34µs integration steps; 47,61µs integration steps; 47,61µs integration steps; 47,61µs integration steps; 47,61µs

Results of Profiling

  • Integration steps separated into external fluid property calculations, non-

linear equations and overhead

  • verhead;

3,240 fluid properties; 8,052 non-linear equations; 36,290

slide-18
SLIDE 18

Christian Schulze Institut für Informatik

18

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Algebraic loops

  • Closer look on integration steps
  • verhead;

3,240 fluid properties; 8,052 non-linear equations; 36,290

slide-19
SLIDE 19

Christian Schulze Institut für Informatik

19

EOOLT 2010- Profiling of Modelica Real-time Models

GI

  • verhead;

3,240 fluid properties; 8,052 non-linear equations; 36,290

Algebraic loops

  • Non-linear equations assinged to submodels

pump2ndOrder1.v_flow; 0,68 sink1.port.h; 0,722 tube1.wallCell.portS.T_0; 0,508 tube1.wallCell.T_1; 0,506 pump2ndOrder1.P_shaft; 0,566 _der_pump2ndOrder1.T; 1,408 _der_tube1.Cell.T_0; 1,3 _der_tube1.Cell.T_1; 1,282 tube.Cell.heatPort.Q_flow_0; 0,53 tube.Cell.heatPort.T_1; 0,518 _der_tube.Cell.T_1 pump2ndOrder.P_shaft _der_pump2ndOrder.T _der_tube.Cell.T_0 pump2ndOrder.v_flow ; 28,27

Steady State continuity equation Dynamic State continuity equation

slide-20
SLIDE 20

Christian Schulze Institut für Informatik

20

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Mass flow of inlet and outlet

0,3138 0,314 0,3142 0,3144 0,3146 0,3148 0,315 0,3152 0,3154 0,3156 0,3158 2 2,5 3 3,5 4 mass flow rate [kg/s] time [s] dynamicSC_source dynamicSC_sink steadySC_sink&source

  • Error due to thermal expansion of liquid
slide-21
SLIDE 21

Christian Schulze Institut für Informatik

21

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Overview

  • 1. Introduction
  • 2. Profiling of Modelica Models
  • 3. Implementation
  • 4. Case Study
  • 5. Conclusion
slide-22
SLIDE 22

Christian Schulze Institut für Informatik

22

EOOLT 2010- Profiling of Modelica Real-time Models

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
  • ptimizing the model
slide-23
SLIDE 23

Christian Schulze Institut für Informatik

23

EOOLT 2010- Profiling of Modelica Real-time Models

GI

Thank you for your attention!