Simulink.SimulationMetadata Class
Namespace: Simulink
Superclasses:
Access metadata of simulation runs
Description
The SimulationMetadata
class contains information about a simulation run including:
Model information
Timing information
Execution and diagnostic information
Custom character vector to tag the simulation
Custom data to describe the simulation
SimulationMetadata
packages this information with the
SimulationOutput
object. To use SimulationMetadata
,
use one of these approaches:
In Configuration Parameters > Data Import/Export, under Save options, select Single simulation output.
Use
set_param
to setReturnWorkspaceOutputs
toon
.set_param(model_name,'ReturnWorkspaceOutputs','on');
To retrieve the SimulationMetadata
object, use the
getSimulationMetadata
method on a SimulationOutput
object.
Properties
ModelInfo
— Information about the model and simulation operating environment
structure
The ModelInfo
structure has these fields.
Field Name | Type | Description |
---|---|---|
ModelName | char | Name of the model |
ModelVersion | char | Version of the model |
ModelFilePath | char | Absolute location of the .mdl /.slx file |
UserID | char | System user ID of the machine used for the simulation |
MachineName | char | Hostname of the machine used for the simulation |
Platform | char | Operating system of the machine used for the simulation |
ModelStructuralChecksum | 4–by–1 uint32 | Structural checksum of the model calculated after an update diagram |
SimulationMode | char | Simulation mode |
StartTime | double | Simulation start time |
StopTime | double | Time at which the simulation was terminated |
SolverInfo | structure | Solver information:
|
SimulinkVersion | structure | Version of Simulink® |
LoggingInfo | structure | Metadata about logging to persistent storage:
|
ExecutionInfo
— Structure to store information about a simulation run
structure
Structure to store information about a simulation run, including the reason a simulation stopped and any diagnostics reported during the simulation. The structure has these fields.
Field Name | Type | Description |
---|---|---|
StopEvent | Nontranslated character vector | Reason the simulation stopped, represented by one of the following:
|
StopEventSource | Simulink.SimulationData.BlockPath | Source of stop event, if it is a valid Simulink object. |
StopEventDescription | Translated character vector | Superset of information stored in StopEvent and
StopEventSource . |
ErrorDiagnostic | struct | Error reported during simulation, represented by the following fields:
By passing the name–value pair
|
WarningDiagnostics | Array of struct | Array of all warnings reported during the simulation. Each array item is represented by the following fields:
|
TimingInfo
— Structure to store profiling information about the simulation
structure
Structure to store profiling information about the simulation, including the time stamps for the start and end of the simulation. The structure has these fields.
Field Name | Type | Description |
---|---|---|
WallClockTimestampStart | character vector | Wall clock time when the simulation started, in YYYY-MM-DD
HH:MI:SS format with microsecond resolution |
WallClockTimestampStop | character vector | Wall clock time when the simulation stopped, in YYYY-MM-DD
HH:MI:SS format with microsecond resolution |
InitializationElapsedWallTime | double | Time spent before execution, in seconds |
ExecutionElapsedWallTime | double | Time spent during execution, in seconds |
TerminationElapsedWallTime | double | Time spent after execution, in seconds |
TotalElapsedWallTime | double | Total time spent in initialization, execution, and termination, in seconds |
ProfilerData | Simulink.profiler.Data | Profiling results of the model, returned as a
Note The |
The ExecutionElapsedWallTime
does not include time that the
simulation is paused. For example, when you step through a simulation, the simulation
pauses after each step, and the ExecutionElapsedWallTime
does not
count the time the simulation is paused between steps. When you step through a
simulation with stepping back enabled, the ExecutionElapsedWallTime
does include the time required to step back in the simulation.
UserString
— Custom character vector to describe the simulation
character vector
Use Simulink.SimulationOutput.setUserString
to
directly store a character vector in the SimulationMetadata
object
that is contained in the SimulationOutput
object.
UserData
— Custom data to store in SimulationMetadata
object that is contained in the SimulationOutput
object
character vector
Use Simulink.SimulationOutput.setUserData
to
store custom data in the SimulationMetadata
object
that is contained in the SimulationOutput
object.
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Examples
Get a SimulationMetadata Object for vdp Simulation
Simulate the vdp
model. Retrieve metadata from a SimulationMetadata
object of the simulation.
Simulate the vdp
model. Save the results of the Simulink.SimulationOutput
object in simout
.
open_system('vdp'); simout = sim(bdroot,'ReturnWorkspaceOutputs','on');
Retrieve metadata information about this simulation using mData
. This is the SimulationMetadata
object that simout
contains.
mData=simout.getSimulationMetadata()
mData = SimulationMetadata with properties: ModelInfo: [1x1 struct] TimingInfo: [1x1 struct] ExecutionInfo: [1x1 struct] UserString: '' UserData: []
Store custom data or string in simout
.
simout=simout.setUserData(struct('param1','value1','param2','value2','param3','value3')); simout=simout.setUserString('Store first simulation results');
Retrieve the custom data you stored from mData
.
mData=simout.getSimulationMetadata() disp(mData.UserData)
mData = SimulationMetadata with properties: ModelInfo: [1x1 struct] TimingInfo: [1x1 struct] ExecutionInfo: [1x1 struct] UserString: 'Store first simulation results' UserData: [1x1 struct] param1: 'value1' param2: 'value2' param3: 'value3'
Retrieve the custom string you stored from mData
.
mData=simout.getSimulationMetadata()
disp(mData.UserString)
% Copyright 2018-2022 The MathWorks, Inc.
mData = SimulationMetadata with properties: ModelInfo: [1x1 struct] TimingInfo: [1x1 struct] ExecutionInfo: [1x1 struct] UserString: 'Store first simulation results' UserData: [1x1 struct] Store first simulation results
Version History
Introduced in R2015aR2023b: Initialization time includes time to set up simulations configured using Simulink.SimulationInput
objects
The initialization time captured as part of the TimingInfo
property
now captures the time required to set up a simulation based on the configuration in a
Simulink.SimulationInput
object, such as:
Model reference build time, including time to set up parallel workers
Time to run the presimulation callback function specified using the
setPreSimFcn
functionTime to set variable, block parameter, and model parameter values
See Also
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)