Thermal Model of a House
This example shows how to use Simulink® to create the thermal model of a house. This system models the outdoor environment, the thermal characteristics of the house, and the house heating system.
The sldemo_househeat_data.m
file initializes data in the model workspace. To make changes, you can edit the model workspace directly or edit the file and re-load the model workspace. To view the model workspace, from the Simulink Editor, on the Modeling tab, click Model Explorer.
Open Model
Open the sldemo_househeat
model.
Initialize Model
This model calculates heating costs for a generic house. Opening the model loads the information about the house from the sldemo_househeat_data.m
file. The file:
Defines the house geometry (size, number of windows)
Specifies the thermal properties of house materials
Calculates the thermal resistance of the house
Provides the heater characteristics (temperature of the hot air, flow-rate)
Defines the cost of electricity (0.09$/kWhr)
Specifies the initial room temperature (20 ºC = 68 ºF)
Model Components
Set Point
The Set Point
is a Constant block that specifies the temperature that must be maintained indoors. By default, it is 70 ºF. Temperatures are given in ºF. The model converts the temperature to ºC.
Thermostat
The Thermostat
subsystem contains a Relay block. The thermostat allows fluctuations of 5 ºF above or below the desired room temperature. If air temperature drops below 65 ºF, the thermostat turns on the heater.
Open the Thermostat
subsystem.
Heater
The Heater
subsystem models a constant air flow rate, Mdot
, which is specified in the sldemo_househeat_data.m
file. The thermostat signal turns the heater on or off. When the heater is on, it blows hot air at temperature THeater
(50 ºC = 122 ºF by default) at a constant flow rate of Mdot
(1kg/sec = 3600kg/hr by default). Equation 1 expresses the heat flow into the room.
Equation 1
Open the Heater
subsystem.
Cost Calculator
The Cost Calculator
is a Gain block that integrates the heat flow over time and multiplies it by the energy cost. The model plots the heating cost in the PlotResults
scope.
House
The House
is a subsystem that calculates room temperature variations. It takes into consideration the heat flow from the heater and heat losses to the environment. Heat losses and the temperature time derivative are expressed by Equation 2.
Equation 2
Open the House
subsystem.
Model the Environment
To simulate the environment, the model uses a heat sink with infinite heat capacity and time varying temperature, Tout
. The Constant block Avg Outdoor Temp
specifies the average air temperature outdoors. The block named Daily Temp Variation Sine Wave
generates daily outdoor temperature fluctuations. You can vary these parameters to see how they affect the heating costs.
Run Simulation and Visualize Results
Run the simulation. Use the PlotResults
scope to visualize the results. The scope plots the heat cost and indoor versus outdoor temperatures. The temperature outdoor varies sinusoidally. The indoors temperature remains within 5 ºC of the Set Point
. The time axis is in seconds.
According to this model, heating the house for two days would cost about $30. Try varying the parameters and observe the system response.
Modify Model
This model calculates the heating costs only. If the temperature of the outside air is higher than the room temperature, the room temperature will exceed the desired Set Point
.
You can modify this model to include an air conditioner. You can implement the air conditioner as a modified heater. To do this, add parameters such as the following to sldemo_househeat_data.m
.
Cold air output
Temperature of the stream from the air conditioner
Air conditioner efficiency
To control both the air conditioner and the heater, modify the thermostat.
See Also
Sine Wave | Sine Wave Function