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.
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 reload the model workspace. To view the model workspace, from the Simulink Editor, on the Modeling tab, in the Design section, click Model Explorer.
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 and number of windows
Specifies the thermal properties of house materials
Calculates the thermal resistance of the house
Provides the heater characteristics: hot air temperature and flow-rate
Defines the cost of electricity: $0.09/kWhr
Specifies the initial room temperature: 20 ºC = 68 ºF
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 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.
Heater subsystem models a constant air flow rate,
Mdot, 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). This equation expresses the heat flow into the room.
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
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. This equation expresses the heat losses and the temperature time derivative.
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 outdoors,
Toutdoors, varies sinusoidally. The temperature indoors,
Tindoors, remains within 5 ºC of the
Set Point. The time axis is in seconds.
evalc('sim(mdl)'); open_system([mdl '/PlotResults']),
According to this model, heating the house for two days would cost about $30. Try varying the parameters and observing the system response.
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
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 like these to
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.