Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Understanding the Demo Model

Opening the Demo Model

The demo model described in this chapter is called sldemo_househeat. You can open it from the MATLAB Command Window.

To open the demo model:

  1. Ensure that MATLAB is open.

  2. Enter sldemo_househeat in the MATLAB Command Window.

    The software starts and opens the sldemo_househeat model.

Anatomy of the Demo Model

The demo system models the outdoor environment, the thermal characteristics of the house, and the house heating system. It allows you to simulate how the thermostat setting and outdoor environment affect the indoor temperature and cumulative heating costs.

The demo model includes many of the same blocks you used to create the simple model in Creating a Simulink Model. These include:

In the demo, the thermostat is set to 70 degrees Fahrenheit. The system models fluctuations in outdoor temperature by applying a sine wave with amplitude of 15 degrees to a base temperature of 50 degrees.

The three data inputs (sources) are provided by two Constant blocks (labeled Set Point and Avg Outdoor Temp), and the Sine Wave block (labeled Daily Temp Variation). The Scope block labeled PlotResults is the one output (sink).

Using Subsystems

The sldemo_househeat demo model uses subsystems to simplify the appearance of the block diagram, create reusable components, and customize the appearance of blocks. A subsystem is a hierarchical grouping of blocks encapsulated by a single Subsystem block.

The demo model uses the following subsystems:

Subsystems can be complex and contain many blocks that might otherwise clutter a diagram. For example, double-click the House subsystem to open it.

You can see that the subsystem receives heat flow and external temperature as inputs, which it uses to compute the current room temperature. You could leave each of these blocks in the main model window, but combining them as a subsystem helps simplify the block diagram.

Subsystems can also be simple and contain only a few blocks. For example, double-click the Thermostat subsystem to open it.

This subsystem models the operation of a thermostat, determining when the heating system is on or off. It contains only one Relay block, but logically represents the thermostat in the block diagram.

Subsystems are also reusable, enabling you to implement an algorithm once and use it multiple times. For example, the model contains two instances of identical subsystems named Fahrenheit to Celsius. These subsystems convert the inside and outside temperatures from degrees Fahrenheit to degrees Celsius.

Creating a Subsystem

Creating a subsystem allows you to group multiple related blocks into one subsystem block.

To create a subsystem:

  1. Select the Thermostat block in the demo model.

  2. Shift-click the Heater block in the demo model to select it.

  3. Select Edit > Create Subsystem in the model window.

    The software creates a Subsystem block containing the Thermostat and Heater blocks.

  4. Select Edit > Undo Create Subsystem to return the model to its original configuration.

For more information about working with subsystems, see Creating Subsystems in the Simulink User's Guide.

Masking Subsystems

You can customize the appearance of a subsystem by using a process known as masking. Masking a subsystem allows you to specify a unique icon and dialog box for the Subsystem block. For example, the House and Thermostat subsystems display custom icons that depict physical objects, while the conversion subsystems display custom dialog boxes when you double-click them.

To view the underlying blocks in the conversion subsystem, right-click the subsystem block, then select Look Under Mask.

Creating a Subsystem Mask

To mask a subsystem:

  1. Select the Heater block in the demo model.

  2. Select Edit > Mask Subsystem in the model window.

    The Mask Editor dialog box appears.

  3. Select disp (show text in center of block) in the Command drop-down menu.

  4. Enter disp('HEATER') in the Drawing commands field.

  5. Click OK.

    The software masks the subsystem block with the text you entered.

For more information about masking subsystems, see Working with Block Masks in the Simulink User's Guide.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS