Main Content

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. You can also specify linear systems to compute if you haveSimulink 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.

Construction

sim_obj= sdo.SimulationTest(modelname)constructs ansdo.SimulationTestobject and assigns the specified model name to theModelNameproperty and default values to the remaining properties.

You can also construct ansdo.SimulationTestobject using thecreateSimulatormethod of ansdo.Experimentobject. ThecreateSimulatormethod configures the properties of thesdo.SimulationTestobject to simulate the model associated with the experiment.

Input Arguments

modelname

Simulink model name, specified as a character vector or string. For example,'sdoHydraulicCylinder'.

The model must be on the MATLAB®path.

适当的ties

InitialState

Model initial state for simulation.

This property can be any initial state format thatsimcommand 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 thesimcommand supports.

Default:[]

LoggedData

Data logged during simulation.

You must also specify the signals to log in theLoggingInfoproperty. The logged data is stored in aSimulink.SimulationOutputobject and is populated by thesimmethod.

This property is read-only.

Default:[]

LoggingInfo

Signals to log when simulating a model.

This property is aSimulink.SimulationData.ModelLoggingInfoobject. Specify the signals to log in itsSignalsproperty.

Default:1x1 Simulink.SimulationData.ModelLoggingInfoobject

SystemLoggingInfo

Linear system logging settings.

This property is a vector ofsdo.SystemLoggingInfoobjects.

If you specify theSystemLoggingInfoproperty, thesimmethod linearizes the model during simulation.

Note

You can also uselinearize(Simulink Control Design)command fromSimulink Control Designto compute linear systems. However, to use fast restart, you must useSystemLoggingInfoproperty andsiminstead.

Default:[]

ModelName

金宝app与模拟仿真软件模型的名字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 aparam.Continuousobject.

Default:[]

Methods

fastRestart Simulate金宝appmodel in fast restart mode using simulation scenario
find Find logged data set
prepareToDeploy Configure simulation scenario for deployment with金宝appCompiler
sim Simulate金宝appmodel using simulation scenario
who List logged data names

Copy Semantics

Value. To learn how value classes affect copy operations, seeCopying Objects.

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