Interactively Simulate a Thermal Model of a House

This example uses a dashboard of controls and indicators to configure and then interactively simulate a thermal model of a house. You can configure the simulation to use either traditional or renewable energy sources and to use an outdoor temperature setpoint based on the season. During the simulation, you can adjust the thermostat and monitor the indoor temperature and heat cost. The model in this example adds a subsystem named Dashboard to the sldemo_househeat model. For more information about the underlying model, see Thermal Model of a House.

Build the Dashboard Subsystem

This model uses a Subsystem block to organize the controls and displays for the model in a single interface. To create the subsystem in this example:

1. Add a Subsystem block to the model.

2. Delete the prepopulated contents of the subsystem. A subsystem of Dashboard blocks does not require Inport or Outport blocks because Dashboard blocks do not use ports to make connections.

3. Add the components of the dashboard.

The dashboard for this model includes a Knob block, a Radio Button block, and a Combo Box block to modify simulation parameters. A Linear Gauge block, three Display blocks, and a Dashboard Scope block display key signals during simulation.

You can use areas in the subsystem to group and label related controls and displays. For more information about creating areas, see Box and Label Areas of a Model.

Connect Dashboard Blocks to the Model

To explore connections between each block in the Dashboard subsystem and the model, you can select a block in the dashboard, pause on the ellipsis that appears above it, and click Jump to Connected Element. The Simulink® editor navigates to and highlights the block or signal connected to that block in the dashboard.

  • The Knob block connects to the Set Point block and allows you to adjust the thermostat set point in the model during simulation.

  • The Radio Button Block connects to the Avg Outdoor Temp block and maps seasonal average temperatures for Boston, MA, to season labels. Right- click the Radio Button block and select Block Parameters from the context menu to modify the average temperature value used for each season.

  • The Display block in the Avg Outdoor Temperature area shows the outdoor temperature value used in the simulation based on the selected season.

  • The Combo Box block connects to the Gain block used to calculate the cost during simulation. Right-click the Combo Box block and select Block Parameters from the context menu to view or modify the cost, specified in units of cents per Joule.

  • The Linear Scale and Display blocks in the Indoor Temperature area provide analog and digital indications of the instantaneous value of the house temperature during simulation.

  • The Display block in the Heat Cost area shows the cumulative cost of heating the house over the course of the simulation is shown on a Display block.

  • The Dashboard Scope block displays the heat cost, indoor temperature, and outdoor temperature in the same plot.

Interactively Simulate

This model uses simulation pacing to slow model execution so you can interact with the model during simulation. For more information, see Simulation Pacing.

The simulation is set up to run for 48 hours. Within that time period, it makes sense to use the Radio Button block and Combo Box block to configure a simulation for a particular season and energy source. If you want to run another type of simulation where you interactively modify the season or energy source, consider lengthening the simulation time to something more realistic for those types of changes.

Choose the season and energy source for a 48-hour simulation, and then run the simulation. During the simulation, use the Knob block to adjust the set point for the house thermostat, and observe the effect of the change on the indoor temperature and heat cost.