Main Content

sdo.SimulationTest

Simulation scenario description

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. You can also specify linear systems to compute if you have Simulink Control Design™ toolbox. Use a simulation scenario to simulate a model with alternative inputs and model parameter and initial state values, without modifying the model.

Creation

Description

example

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

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

Properties

expand all

Name of Simulink model, specified as a character vector or string scalar. The model must be on the MATLAB® path.

Model parameter values, specified as a param.Continuous object. 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.

Input signals to apply to root level input ports when simulating the model, specified as an input signal format that the sim function supports.

Initial state of model for simulation, specified as an initial state format that the sim function supports.

Signals to log when simulating a model, specified as a Simulink.SimulationData.ModelLoggingInfo object. Specify the signals to log in its Signals property.

Linear system logging settings, specified as a vector of sdo.SystemLoggingInfo objects. If you specify the SystemLoggingInfo property, the sim method linearizes the model during simulation.

Note

You can also use linearize (Simulink Control Design) command from Simulink Control Design to compute linear systems. However, to use fast restart, you must use SystemLoggingInfo property and sim instead.

This property is read-only.

Data logged during simulation, stored in a Simulink.SimulationOutput object and populated by the sim function. You must also specify the signals to log in the LoggingInfo property.

Name of the scenario, specified as a character vector or string scalar.

Object Functions

fastRestartSimulate Simulink model in fast restart mode using simulation scenario
findFind logged data set
prepareToDeploy Configure simulation scenario for deployment with Simulink Compiler
simSimulate Simulink model using simulation scenario
whoList logged data names

Examples

collapse all

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];

Specify an experiment for a model.

experiment = sdo.Experiment('sdoRCCircuit');

Create a simulation scenario for the experiment.

sim_obj = createSimulator(experiment);

Version History

Introduced in R2011b