Contents

sdo.SimulationTest class

Package: sdo

Simulation scenario description

Syntax

sim_obj = sdo.SimulationTest(modelname)

Description

Create a scenario to simulate a Simulink® model. A simulation scenario specifies input signals, model parameter and initial state values, and signals to log for a model. Use a simulation scenario to simulate a model with alternative inputs and model parameter and initial state values, without modifying the model.

Construction

sim_obj = sdo.SimulationTest(modelname) constructs an sdo.SimulationTest object and assigns the specified model name to the ModelName property and default values to the remaining properties.

You can also construct an sdo.SimulationTest object using the sdo.Experiment.createSimulator method of an sdo.Experiment object. The createSimulator method configures the properties of the sdo.SimulationTest object to simulate the model associated with the experiment.

Input Arguments

modelname

Simulink model name, specified as a string inside single quotes (' ').

The model must be on the MATLAB® path.

Properties

InitialState

Model initial state for simulation.

This property can be any initial state format that sim command supports.

Inputs

Input signals.

Specify signals to apply to root level input ports when simulating the model. The signal can be any input signal format that the sim command supports.

Default: []

LoggedData

Data logged during simulation.

You must also specify the signals to log in the LoggingInfo property. The logged data is stored in a Simulink.SimulationOutput object and is populated by the sim method.

This property is read-only.

Default: []

LoggingInfo

Signals to log when simulating a model.

This property is a Simulink.SimulationData.ModelLoggingInfo object. Specify the signals to log in its Signals property.

Default: 1x1 Simulink.SimulationData.ModelLoggingInfo object

ModelName

Simulink model name associated with the simulation scenario. The model must be on the MATLAB path.

Name

Name of the scenario

Default: ''

Parameters

Parameter values.

The software changes the model parameters to the specified values before simulating the model and restores them to their original value after the simulation completes.

This property must be a param.Continuous object.

Default: []

Methods

findFind logged data set
simSimulate Simulink model using simulation scenario
whoList logged data names

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB documentation.

Examples

expand all

Create Simulation Scenario for Model

Create a simulation scenario for a model.

Pressures = Simulink.SimulationData.SignalLoggingInfo;
Pressures.BlockPath = 'sdoHydraulicCylinder/Cylinder Assembly';
Pressures.OutputPortIndex = 1;
simulator = sdo.SimulationTest('sdoHydraulicCylinder');

Specify model signals to log.

simulator.LoggingInfo.Signals = [Pressures];

Create Simulation Scenario for Experiment

Specify an experiment for a model.

experiment = sdo.Experiment('sdoRCCircuit');

Create a simulation scenario for the experiment.

sim_obj = createSimulator(experiment);
Was this topic helpful?