Digital Twin with Python (VTR UGE 21), day 2 of 5

Simulation Foundations in Python

Prof. Dr. Utku Kose, Süleyman Demirel University

Simulation lab

Part A integrates the thermal model of the pack with three methods and collects every run in a diagram of error against cost. Part B computes a stability limit and an order by hand. Part C chooses the kind of simulation for six systems.

Part A: The integrator workbench

Choose an integration method, a step size and a fan duty, from 0 for off to 1 for full power, and integrate the thermal model of the pack over two hours. The reference is the classical Runge-Kutta method of order 4, abbreviated RK4, with a step of one second. Every run is added to the scoreboard, where the plot of error against the number of derivative evaluations, the work-precision diagram of the lecture, shows which method buys accuracy most cheaply.

Scoreboard

RunMethodStepFan dutyEvaluations Final error

Open in ColabContinue in Colab, section 2: measure the orders of the three methods.

Part B: Accuracy and stability by hand

The pack has a heat capacity of 9000 J/K, a passive cooling conductance of 2.2 W/K and an extra 12 W/K at full fan. The stability limit of explicit Euler is twice the heat capacity divided by the total conductance.

Open in ColabContinue in Colab, section 3: watch Euler fail beyond its stability limit.

Part C: Which kind of simulation?

Choose the family that fits each system best.

Open in ColabContinue in Colab, section 5: the charging depot as a discrete-event simulation.