## File Exchange Pick of the WeekOur best user submissions

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# Easy design iteration sweeps for Simulink models

Posted by Guest Picker,

Greg’s pick this week is STOICAL by Reinhold.

Simulink is well suited for laying out block diagrams of system simulations. These models can be configured in numerous ways including block parameter values, logging various signals in the model, conditional block variations, model configuration settings.

Reinhold provides a unique way to identify, manage, and script interactions with a Simulink model that enable creating numerous model configurations, running simulations for those configurations, and collecting the results of the simulations.

Reinhold essentially provides a markup language that enables identification of various configurable model elements along with an command line API that is used to interpret the markup language and make adjustments to the model configuration.

### Contents

#### What does the Markup Look Like?

There are several examples included.

Note the use of #PARAM# to identify a tunable element in the model.

The API can then be used to set values for the parameter

setParameterValue('#System#SystemGain','myNewValue',STOICAL);


This includes a hierarchical reference as the SystemGain parameter is contained a subsystem that was identified as System using the following markup syntax.

Another interesting feature is the ability to restore default values for parameters using

 setParameterValues2Default(STOICAL);


#### What problems does STOICAL work to solve?

Historically there hasn’t been much tooling in Simulink to manage model configurations, especially for variations between simulation runs. STOICAL provides the following features to help out with the configuration management.

• Parameter values are available as part of model file
• Searching and retrieving parameter values
• Captures errors that occur in simulation runs
• Manages Simscape Powersystems solver configurations
• Providing a default choice for variant subsystems
• Easily enable logging signal lines from a script
• Use regular expressions to change parameters, signal logging, etc.
• Enable subsystem variant management using descriptive names
• Store results from multiple simulation runs in a consistent format

Over the past couple of years, a number of features have been released with Simulink to address many of these issues.

The following are a couple of my personal favorites:

I’ll avoid diving into excruciating detail about these new features, sufficed to say that if you’re interested it’s worth checking out the documentation and release notes.

#### STOIOCAL is best suited when modeling system level dynamics.

The STOICAL tool does a great job at making model configuration accessible. The methods it uses to achieve this excludes its use from many code generation applications. If you plan on using this for parameter tuning, I would recommend using this only on elements of system models that will not be the source of generated C-code. For example, plant models and environment models.

Also the use of regular expressions to quickly identify model elements from the MATLAB Command Line is quite nice. While some progress has been made in this area within Simulink, the command line interface for this type of activity is clunky (see find_system as an example).

#### What do you think?

Let us know here.

Published with MATLAB® R2017b