Simulink.SimulationMetadata class
Package: 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
includes the
time that Simulink spent to roll back or step back in a simulation.
The ExecutionElapsedWallTime
does not include the
time spent between steps. For example, if you use Stepper to step
through a simulation, the ExecutionElapsedWallTime
time
does not include the time when the simulation is in a paused state.
For more information about using Stepper, see How Simulation Stepper Helps With Model Analysis.
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)
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 R2015a
See Also
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes 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)