Initial state
Description
Loads the model initial states from a workspace before simulation begins.
Category:Data Import/Export
Settings
Default:Off,xInitial
-
On
-
万博1manbetx®software loads initial states from a workspace.
Specify the name of a variable that contains the initial state values, for example, a variable containing states saved from a previous simulation.
Use the structure or structure-with-time option to specify initial states if you want to accomplish any of the following:
Associate initial state values directly with the full path name to the states. This eliminates errors that could occur if Simulink software reorders the states, but the initial state array is not correspondingly reordered.
Assign a different data type to each state's initial value.
Initialize only a subset of the states.
Initialize the states of a top model and the models that it references
SeeLoad State Informationfor more information.
-
Off
-
Simulink software does not load initial states from a workspace.
Tips
The initial values that the workspace variable specifies override the initial values that the model specifies (the values that the initial condition parameters of those blocks in the model that have states specify).
Selecting theInitial statecheck box does not result in Simulink initializing discrete states in referenced models.
Avoid using an array for an initial state. If the order of the elements in the array does not match the order in which blocks initialize, the simulation can produce unexpected results. To promote deterministic simulation results, use theInitInArrayFormatMsgdiagnostic default setting of
warning
or set the diagnostic toerror
.Instead of array format for the initial state, consider using a
Simulink.SimulationData.Dataset
object, structure, structure with time, or a SimState.If you use a format other than
Dataset
, you can convert the logged data toDataset
format. Converting the data toDataset
makes it easier to postprocess with other logged data. For more information, seeDataset Conversion for Logged Data.If you use
Dataset
format, you can specify the discrete state bus type by setting the state label to DSTATE_NVBUS (nonvirtual bus) or DSTATE_VBUS (virtual bus).
Command-Line Information
Parameter:LoadInitialState |
Value:'on' |'off' |
Default:'off' |
Parameter:InitialState |
Type:variable (character vector) or vector |
Value:any valid value |
Default:'xInitial' |
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No recommendation |
Safety precaution | No recommendation |