A complete simulation of a room’s thermal behavior using Simscape Thermal along with a PID-controlled HVAC system for temperature regulation. This project demonstrates dynamic modeling, debugging, controller design, and system-level understanding using MATLAB/Simulink.
This project models a room as a thermal mass exposed to a constant outside temperature via wall conduction.
- The System: An HVAC system, modeled as a Controlled Heat Flow Rate Source, injects or removes heat to regulate room temperature.
- The Control: A PID controller adjusts HVAC power to maintain the room at a target temperature despite disturbances such as heat leakage.
- Key Deliverables:
- Thermal system modeling
- Simscape physical connections
- PID controller design & tuning
- Simulation and analysis
-
Thermal Mass: Represents room air + thermal inertia (
$C$ ). -
Conductive Heat Transfer: Models wall heat conduction (
$R_{th}$ ). - Temperature Source: Represents the constant outdoor temperature.
- Controlled Heat Flow Rate Source: Acts as the HVAC actuator.
- Thermal Reference: Ground node for zero heat flow.
- Temperature Sensor: Measures real-time room temperature.
- PID Controller: Computes the control effort.
- Saturation: Limits HVAC power to realistic values.
- Simulink-PS / PS-Simulink Converters: Interfaces between physical signals and control logic.
- Scopes: For visualizing temperature and heat flow over time.
The system is governed by the First Law of Thermodynamics (Energy Balance):
The HVAC output (
Where
Iterative tuning was performed to achieve stability.
| Attempt | Kp | Ki | Kd | Notes |
|---|---|---|---|---|
| 1 | 200 | 0.1 | 0 | Slow response, underdamped. |
| 2 | 500 | 0.05 | 0 | Stable, minimal overshoot. |
| 3 | High | Low | 0 | Stable but slower convergence. |
Final Result: Tuning strategy #2 was selected for smooth and stable control.
- Initial room temperature starts at approx 293 K.
- System rises to 300–303 K (depending on setpoint).
- PID stabilizes temperature close to setpoint with minimal overshoot.
- Long-duration simulations confirm stable convergence.
- HVAC injects heat (
$+Q$ ) when$T_{room} < T_{set}$ . - HVAC applies cooling (
$-Q$ ) when$T_{room} > T_{set}$ . - Saturation limits prevent unrealistic infinite power spikes.
HVAC-Temperature-Control/
│
├── resources/
│ ├── project/
│ │ ├── fjRQtWiSIy7hIIj-Kmk87M7s21k
│ │ ├── NjSPEMsluLUyIpr2u1Js5bVPsOs
│ │ └── root
│ ├── Project.xml
│ └── rootp.xml
│
├── 1.png # Simulation result figure
├── 2.png # Simulation result figure
├── 3.png # Simulation result figure
├── HVAC Room Model.png # Diagram of the Simulink model
├── HVAC_Project_Report.pdf # Full project report
├── HVAC_Project.prj # Simulink Project definition file
├── HVAC.m # MATLAB script for parameters/initialization
├── HVAC.slx # Main Simulink model file
└── README.md # Project documentation
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.



