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

Intelligence Layer of the Twin

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

Intelligence lab

Part A matches the needs of an operator with the services of the twin. Part B repeats a prediction of a Gaussian process step by step, with sliders for its numbers. Part C computes a cumulative sum by hand. Parts D and E repeat two further services of the lecture step by step, also with sliders: a remaining useful life from a fitted line and one decision of the twin in the loop. Part F runs a control room in which four controllers set the fan of the pack and you set the weights of the objective that ranks them. In Parts B, D and E every intermediate value is rounded, and the next step continues with the rounded value, as in a calculation by hand. Part G plans the air conditioning of a home through a hot afternoon, hour by hour, for the least money.

Part A: Which service of the twin?

Match each need of an operator with the service that meets it.

Back to the lecture: A calibrated core. The lecture continues there with Section 1 of the Colab notebook: Open it from the next orange box.

Part B: A Gaussian-process prediction, step by step

The worked example of the lecture: a Gaussian process with one input, the current, the squared exponential kernel and no noise. The mean of the training outputs is 50 °C, and the first training point is 53 °C at 40 A. A second training point, 60 °C at 55 A, can be added. The sliders set the query, the length scale \(\ell\) and the amplitude \(\sigma_f\). The figure draws the prediction over all currents with a band of two standard deviations on each side.

Back to the lecture: Surrogate models and their limits. The lecture continues there with Section 2 of the Colab notebook: Open it from the next orange box.

Part C: A cumulative sum by hand

The standardised residuals of five periods are 0.1, 0.4, 0.6, 0.5 and 0.7. The cumulative sum starts at zero and adds each residual minus an allowance of 0.25, but never falls below zero. The alarm is raised when the sum exceeds 1.0.

Back to the lecture: Detecting faults. The lecture continues there with Section 5 of the Colab notebook: Open it from the next orange box.

Part D: A remaining useful life from a fitted line

The estimate of the lecture on a short history: six measurements of the capacity, one every 20 trips from trip 0 to trip 100. A straight line is fitted by least squares and followed down to the end-of-life level of 48 Ah. The true pack loses a fixed amount of capacity per trip, and from a knee on it loses twice as much. The sliders set this loss, the measurement noise and the trip of the knee. The figure compares the extrapolated line with the true capacity.

Back to the lecture: Remaining useful life. The lecture continues there with Section 6 of the Colab notebook: Open it from the next orange box.

Part E: One decision of the twin in the loop

The planner of the lecture, shortened so that every number can be followed by hand: three candidate fan duties instead of six, three explicit Euler steps of 100 s instead of fifteen steps of 20 s, a constant current of 40 A and air at 35 °C, with the calibrated parameters of Day 3. The cost of a candidate adds the squared excess above 44 °C and the energy of the fan, each times the length of a step in minutes. The ageing term of the lecture is left out here. The sliders set the temperature at the moment of the decision and the weight of the fan energy.

Back to the lecture: What-if scenarios and control, where the text continues after the box of this part.

Part F: The control room

Four controllers drive the fan of the pack over a two-hour trip with a hot afternoon load. Set the weights of the objective, which put a degree-hour above 44 °C, a kilowatt-hour (kWh) of fan energy and a milliampere-hour (mAh) of lost capacity on one scale, then run all four. A degree-hour is one degree above 44 °C for one hour. Without cooling the fan stays off, and the always-on fan runs at full duty. The fixed rule switches the fan fully on above 42 °C and off again below 40 °C. The twin in the loop plans once per minute: It looks ten minutes ahead with three fan settings, 0, 0.5 and 1, and applies the cheapest one. The weights are a business decision: Watch how they change the ranking.

ControllerPeak (°C)Degree-hours above 44 °CFan energy (kWh) Capacity lost (mAh)Objective

Back to the lecture: What-if scenarios and control, where the text continues after the box of this part.

Part G: Cool a home for the least money

A home starts a hot afternoon at 25 °C at noon. Every hour its temperature moves by a fifth of its distance from the air outside, and the air conditioner removes 3 °C per hour at full power and 1.5 °C at half power, using 2 kWh or 1 kWh. Electricity costs 10 cents per kWh until 15:00, 30 cents in the peak from 15:00 to 19:00 and 15 cents after it. Click the hours to switch the air conditioner between off, half and full. Find a plan that keeps the home at or below 26 °C at every full hour until 20:00 for at most 160 cents. Then compute the first hour of the plan with full power by hand.

Back to the lecture: What-if scenarios and control. The lecture continues there with Section 7 of the Colab notebook: Open it from the next orange box.