Skip to Main Content Skip to Search
Product Documentation

Model Loop - Loop on Simulink models and systems, as specified by child components

Description

This component loops on Simulink models and systems, as specified by child components. For example, you can use a Model Loop with a child System Loop to report on the subsystems of the specified system.

Consider making these components children of the Model Loop (although the Model Loop not necessarily required to be the immediate parent of a given component).

Models to Include

You can add a model to the list by clicking Add New Model to List. The following table shows the buttons you can use to move a model up or down in the list, or to add or delete a model.

Button

Action

Move a model up in the list.

Move a model down in the list.

Remove a model from the list.

Add a new model to the list.

Model Options

Section Options

Examples

Generating Reports on Specified Systems and their Subsystems

This example shows how to loop over a specified system and its subsystems in the sample model sldemo_auto_climate_elec, which the Simulink software includes.

  1. (Optional) To open the sldemo_auto_climate_elec model, at the MATLAB command prompt, enter the following command:

    sldemo_auto_climate_elec

    Explore the model to familiarize yourself with its subsystems.

  2. Open the Report Explorer.

  3. Create a report setup file by clicking File > New.

  4. Save the report setup file by clicking File > Save As. Give it the name sldemo_auto_report.

  5. Add a Chapter/Subsection component to the report setup file to include information about model subsystems:

    1. In the Library pane in the middle, double-click Chapter/Subsection to add it to the report setup file.

    2. For Title, choose Custom. In the title field, enter Description of sldemo_auto_climate_elec subsystems.

  6. Add a Model Loop as a child of the Chapter/Subsection component. This loops over the ClimateControlSystem system and its subsystems in the sldemo_auto_climate_elec model:

    1. In the Library pane in the middle, double-click Model Loop to add it to the report setup file. By default, the Report Explorer adds that component as a child of the Chapter/Subsection component.

    2. In the Model Loop properties pane, from the Model name selection list, select <Custom block diagram> .

    3. In the Model name field, delete the text <Custom block diagram>, and then enter sldemo_auto_climate_elec.mdl. Click any component in the report setup file to add this model to the Models to include list.

    4. In the Traverse model selection list, select Selected system(s) and children.

    5. In the Look under masks selection list, select All masks.

    6. In the Model reference selection list, select Do not follow model reference blocks.

    7. In the Starting system(s) field, enter sldemo_auto_climate_elec/ClimateControlSystem. Because you selected Selected system(s) and children for Traverse model, the Model Loop loops over sldemo_auto_climate_elec/ClimateControlSystem and its subsystems.

    8. Under Section Options, select the Create section for each object in loop check box. Selecting this option creates separate sections in the generated report for each model over which the component loops.

    The Model Loop properties pane looks as follows.

  7. Save the report by clicking File > Save.

  8. Add a System Loop as a child of the Model Loop component.

    1. In the Library pane in the middle, double-click System Loop to add it to the report setup file. By default, Model Explorer adds this component as a child of the Model Loop component.

    2. In the System Loop properties pane, under Section Options, select the Create section for each object in loop check box. Selecting this option creates a section in the generated report for each subsystem on which the component loops. Accept the default values for all other fields.

  9. Add a System Snapshot component as a child of the System Loop component. This step creates snapshots of all the subsystems of ClimateControlSystem in the generated report. In the Library pane in the middle, double-click System Snapshot. By default, Model Explorer adds this component as a child of the System Loop component.

  10. Save the report.

    The report setup file hierarchy now looks as follows.

  11. Run the report by clicking File > Report.

    The report loops on the system ClimateControlSystem of the sldemo_auto_climate_elec model and all of its subsystems, as shown in the following Message List.

The report looks as follows.

Temporarily Omitting a Model from a Loop

This example shows how to use the Model Loop Active check box to temporarily omit a model from the loop. This example uses the report setup file that you created in Generating Reports on Specified Systems and their Subsystems, sldemo_auto_report.rpt, and the model f14.mdl, which the Simulink software includes.

  1. In the Report Explorer, click File > Open, and then open sldemo_auto_report.rpt by double-clicking it.

  2. In the Outline pane on the left, click Model Loop Section 1 - sldemo_auto_climate_elec.

  3. In the Model Loop properties pane, click the button to add a model to the Models to include list.

  4. In the Model Loop properties pane, from the Model name selection list, select <Custom block diagram>.

  5. In the Model name field, delete the text <Custom block diagram> and enter f14.mdl.

    The Model Loop properties pane now looks as follows.

  6. Save the report setup file.

  7. Generate the report.

    The report generation process loops over the specified systems in the f14 and sldemo_auto_climate_elec models, as shown in the following message box.

    The report looks as follows.

  8. In the Models to include list, click f14 to select it.

  9. Clear the Active check box to omit f14 model information from the generated report.

  10. Rerun the report.

    The report now includes information only on the sldemo_auto_climate_elec model, as shown at the end of the previous example, Generating Reports on Specified Systems and their Subsystems.

  11. To reactivate the f14 model, in the Model Loop Models to include list, select the f14 model and then select the Active check box.

Insert Anything into Report?

Yes, inserts a section if you select the Create section for each object in loop option.

Class

rptgen_sl.csl_mdl_loop

See Also

Block Loop, System Loop

  


Related Products & Applications

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

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