Reviewing the model and extracting constraints…
Confirm engineering requirements
I'll fix the model first, then tune the heating controller and check these constraints:
Time 0m 00s
- I’ll reproduce the model-check error first. Once the model runs, I’ll use the original controller as the baseline.
Checking the model
Read 2 Modelica files
NominalMorning.mo → extends HeatingSystem HeatingSystem.mo → room sensor and controller wiring
OpenModelica · Model check failed
checkModel(NominalMorning) Error: Too few equations. The model is structurally singular. Equation balance: 1 unmatched variable. Next: inspect unbound inputs in the flattened model.
Trace unbound controller input
hysteresis.u: no binding in the flattened model temRoo.T: room temperature sensor output
Patch
HeatingSystem.mo+ connect(temRoo.T, hysteresis.u);
OpenModelica · Recheck passed
checkModel(NominalMorning) Equation balance: no unmatched variables.
Simulate baseline and inspect warm-up
simulate(NominalMorning, stopTime=7200) Signal: roomTemperature Check first entry into the warm-up band. 20°C minimum after 30 min: outside range
- The model runs after restoring the sensor connection. The baseline drops below 20°C after warm-up, so I’ll tune the controller while keeping the plant settings fixed.
Tuning the controller
Read controller declarations
HeatingSystem.mo dTSetRoo controls the gap between the two switching thresholds. Change scope: controller only.
Simulate candidate · Peak above limit
Signal: roomTemperature · window: 0–7200 s Peak: about 23°C · cap: 22°C
Simulate with
dTSetRoo = 0.5 KApply controller parameter, recheck, simulate. Compare the warm-up and hold windows against baseline.
Simulate with
dTSetRoo = 5.0 KFull-run peak: about 22.1°C Rejected: observed peak exceeds 22°C.
Apply final controller setting ·
2.0 KHeatingSystem.mo Set dTSetRoo to 2.0 K and name the lower and upper switching thresholds. OpenModelica model check passed.
- The 5.0 K setting still overshoots. I’ll run the revised setting for the full two hours and check each requirement separately.
Verifying the final run
OpenModelica · Simulate the full hold window
simulate(NominalMorning, stopTime=7200) Result: NominalMorning_res.mat Simulation finished. Solver warnings logged.
Check warm-up window
0–30 min · first entry into [20.5, 21.5]°C The displayed curve enters the target band before 30 min.
Check 30–120 min hold
30–120 min · compare the curve against [20, 22]°C The displayed curve stays inside the band.
Check full-run peak
0–120 min · compare maximum against 22°C Peak: about 21.7°C on the displayed curve.
Thinking…
Summary
All three temperature requirements met. I restored the room sensor connection and tuned the heating controller. In the final OMEdit run, the room reached the target band before 30 minutes, stayed within 20–22°C from minute 30 onward, and peaked at about 21.7°C.
HeatingSystem.mo· restored sensor feedback and tuned the controllerNominalMorning.mo· used for verification, unchanged
I have a Modelica model NominalMorning.mo with a heat pump, a radiator, a thermal model of the room, and a heating controller. The model fails its model check (error: one more variable than equations). Fix the issue, then tune the controller so the temperature reaches 21°C ± 0.5°C within 30 minutes. Keep it between 20°C and 22°C from minute 30 to the end of the two-hour simulation. Never let it exceed 22°C during the run.
Message Pufibara…