Problem 145552 · easy · Level 01 Prerequisites & Setup

The Dial Setting and the Open Window

open loop · steady state · disturbance · saturation

The cottage heater from the timetable problem has a dial. The owner wants to set it once so that the room settles at setpoint °C, using only a model of the room: no thermometer is involved (open loop). The room follows the same rule as before, with the heater delivering a constant p kW:

T = T + dt * ((T_out - T) / tau + gain * p)

Whatever the start, the temperature creeps towards the value where it stops changing, the steady state or final value: the temperature at which the bracket (T_out - T) / tau + gain * p equals 0.

The dial goes from 0 to max_power kW. If the exact power needed is below 0 (the room is already warmer outside than the setpoint) the dial is set to 0; if it is above max_power, the dial is set to max_power.

Then a guest opens a window and leaves it open. The room leaks heat much faster: its time constant drops from tau to tau_window, but nobody touches the dial.

Write open_loop_setting(setpoint, T_out, tau, gain, max_power, tau_window) that returns a tuple of three numbers:

  1. the dial setting p in kW (after limiting it to 0..max_power),
  2. the temperature the room settles at with that setting and the window closed,
  3. the temperature it settles at with the same setting and the window open.

Examples

Input:  setpoint = 20, T_out = 5, tau = 100, gain = 0.05, max_power = 4, tau_window = 40
Output: (3.0, 20.0, 11.0)
Explanation: 3 kW holds the room at 20 °C. With the window open the same 3 kW only
balances the larger leak at 11 °C: the open window is a disturbance, and an
open-loop setting does nothing about it.

Input:  setpoint = 22, T_out = -5, tau = 100, gain = 0.05, max_power = 4, tau_window = 50
Output: (4, 15.0, 5.0)
Explanation: 5.4 kW would be needed, but the dial stops at 4 kW.

Constraints

  • answers are compared with a tolerance of 1e-6; do not round

Goals

  • Find where a first-order system settles by setting its rate of change to zero
  • Choose an open-loop setting from a model of the system
  • See why an open-loop setting is wrong as soon as the system changes
Starting Python…