Scenarios contain information about groups of signals, such as:
Location of signal files (MAT-file or Microsoft® Excel® files)
Location of the associated model
Use scenarios to exchange groups of signals in your model, such as when running multiple simulations or working with test harnesses. To easily exchange scenarios within these models, use the Signal Editor block. This block displays, creates, edits, and switches scenarios.
Consider using Signal Editor block in models where you use the Signal Builder block.
The Signal Editor block gets groups of signals (scenarios) from MAT-files.
The block has three sections.
Scenario — Set up scenario, such as specifying the MAT-file containing the list of scenarios and the active (current) scenario.
Signal properties — Use the Signal Editor user interface to examine, create, and edit scenarios and associated signals. The Signal Editor user interface organizes the signals according to the scenarios that contain them.
Parameters — Select the active signal to be output and set up characteristics, such as unit, sample time, linear interpolation, and so forth, for the active signal. To change the active signal, use the drop-down list. The
This example shows how to use the Signal Editor block with the Parallel Simulations Using Parsim: Parameter Sweep in Normal Mode example, which
runs multiple simulations of a Monte Carlo study in parallel using Parallel
Computing Toolbox™. Parallel execution leverages the multiple cores of your host machine to
run many simulations more quickly. If you do not have Parallel
Computing Toolbox, this example runs the simulations in serial. The model simulates vehicle
dynamics based on the interaction between road and suspension for different road
profiles. This example stores its road profile scenarios in the
sldemo_suspn_3dof model, open the Signal
The Signal Editor block File Name
parameter contains the MAT-file
Active scenario automatically sets to the first
Road1. This setting means that the
remainder of the block parameters apply to the signals in that scenario.
To change the active scenario, select a new scenario from the list of
Active signal automatically sets to the first
Left tire in the active scenario,
Road1. This setting means that the
remainder of the settings in the Parameter section
apply to the active signal. To change the active signal, select a new
signal from the list of signals.
Explore and edit the scenarios in the MAT-file. lick .
The Signal Editor user interface displays with the list of scenarios contained in the MAT-file. Explore and manipulate the scenarios and associated signals. If you make changes, you can save them back to the MAT-file.
The output from the block is the active signal data. To simulate the model
sequentially using each scenario and signal, use the
parsim function. This function simulates dynamic systems multiple times
in parallel or serial. For an example on how to use
Parallel Simulations Using Parsim: Parameter Sweep in Normal Mode.
The Signal Editor provides similar functionality to the Signal Builder block, but with greater flexibility. Replace the Signal Builder with the Signal Editor block. The benefits of Signal Editor block include:
Signal data storage outside model in MAT-file
Signal edit and creation
Support for Simulink® signal attributes, such as dimension and complexity
Support for standard Simulink data types, including bus and fixed-point
Unique signal-level data types for outputs
Multiple rates for outputs
Support forSimulink units
Zero crossing detection and data interpolation unique to each signal
To port signal data and properties from the Signal Builder block to
Signal Editor block, use the
signalBuilderToSignalEditor function. For the current model,
this function stores to a MAT-file the signal data and properties from an existing
Signal Builder block, adds a Signal Editor block to
the current model, and modifies the Signal Editor block to reference the
For an example, see Replace Signal Builder Block with Signal Editor Block.
Converting from Signal Builder block to Signal
Editor block is relatively straightforward using the
signalBuilderToSignalEditor function. However, take into
account these considerations:
Internal storage format and preprocessing of data differs between the Signal Builder and Signal Editor blocks. When using the variable step solver, different simulation time steps and mismatched output occur in the two blocks. To minimize the difference between the outputs of both blocks, you can:
Reduce the value of Max step size of the variable step solver.
Insert more data points in the input signal of the Signal Editor block to better represent its shape.
Use the fixed-step solver or set the sample time for both blocks to the same discrete sample time (greater than 0). For more information on discrete sample times, see Discrete Sample Time.
The Signal Builder block supports only doubles. To change the data type or otherwise change the signals after conversion, click the Signal Editor block button to access the Signal Editor user interface.
To programmatically get the total number of scenarios and signals in the Signal
Editor block, use the
These properties contain the values as character vectors. To convert these values to
doubles, use the
read-only properties available only through
get_param. he block
dialog box does not provide these values.