({{, (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData])[…] 
represents simulation data from functions such as (RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate]) etc. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData]) is generated by functions such as (RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate]) and (RefLink[SystemModelSimulateSensitivity, paclet:ref/SystemModelSimulateSensitivity]) and provides ways of summarizing, exploring and extracting results.

(RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData])[…]["Properties"] gives a list of possible properties.

Properties of simulation data are obtained from (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData])[…]["property"].

For simulations with dynamic graphics, sim["Diagram",t] returns (RefLink[Graphics, paclet:ref/Graphics]) at time t.

Dynamic graphics for component "c1.c2..." are shown with sim["Diagram",{"c1","c2",…},t].

Properties of the simulated model: »

For variable and parameter lists, (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData])[…][{property,patt}] returns the elements of property whose names match the string pattern patt.

Properties specific to the simulation: »

Properties related to values of variables and parameters: »

Simulation results for variables "(Subscript[v, i])" are returned as functions that can be evaluated for any time t. »

Simulation results from (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData]) object sim can be evaluated at a point t with sim[{"(Subscript[v, 1])","(Subscript[v, 2])",…},t].

In sim["RawData",{"(Subscript[v, 1])",…}], events are indicated by duplicate time-value pairs at the same time point.

Variables "(Subscript[v, i])" and parameters "(Subscript[p, i])" are given using strings.

Complete lists of simulation results and parameter values: »

Lists of simulation results from sim can be evaluated at a point t with sim["VariableValues",t].

Variables depend on parameters (Subscript[v, i])[t,(Subscript[p, j])]; the sensitivity of a variable to a parameter (Subscript[p, j]) is the partial derivative (∂_(Subscript[p, j]))(Subscript[v, i])[t,(Subscript[p, j])]. Sensitivities can be computed using (RefLink[SystemModelSimulateSensitivity, paclet:ref/SystemModelSimulateSensitivity]). »

Sensitivities can be accessed using {{(Subscript[v, i]),(Subscript[p, i])},…}.

Properties related to sensitivities include:

The option (RefLink[TargetUnits, paclet:ref/TargetUnits]) controls the unit of simulation results:

OpenersPrimaryExamplesSection(Spacer1)Examples  (31)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Simulate a model:

sim=SystemModelSimulate[]

Get all variable names in the model:

sim["VariableNames"]

Get the trajectory of one variable:

sim[{"x"'}]

Get trajectories for all variables:

sim[sim["VariableNames"]]

Show the simulation interval:

sim["SimulationInterval"]

OpenersExampleSection1(Spacer1)Scope  (20)

OpenersExampleSubsection0(Spacer1)Model Properties  (8)

Get a list of all possible properties of a simulation data object:

sim=SystemModelSimulate[];

sim["Properties"]

Simulate a model:

sim=SystemModelSimulate[]

Get all variable names in the model:

sim["VariableNames"]//Short

Get all parameter names in the model:

sim["ParameterNames"]//Short

Simulate a model:

sim=SystemModelSimulate[]

Get names of stored plots in model:

sim["PlotNames"]

Show a stored plot:

SystemModelPlot[sim,"AngleAndPosition"]

Simulate a model:

sim=SystemModelSimulate[]

Get variable names matching a pattern:

sim[{"VariableNames","capacitor1.*"}]

Get parameter names matching a pattern:

sim[{"ParameterNames","*.R"}]

Get the state variables from a simulation:

sim=SystemModelSimulateSensitivity[,50,{"a"}];

sim["StateVariables"]

Plot the sensitivity of the state variable with respect to a parameter:

SystemModelPlot[sim,{{"y","a",0.05}}]

Simulate a model:

sim=SystemModelSimulate[];

Show the full name of the model that was simulated:

sim["ModelName"]

Plot variables and use a short model name as a label:

shortName=StringSplit[sim["ModelName"],"."]//Last

SystemModelPlot[sim,{"x1","x4"},PlotLabel->shortName]

Get descriptions for variables and parameters in a simulation:

sim=SystemModelSimulate[];

sim["Descriptions"]//Short

Get the model that was simulated:

sim=SystemModelSimulate[];

model=sim["Model"]

Show the name of the model:

model["ModelName"]

OpenersExampleSubsection1(Spacer1)Simulation Properties  (4)

Show the time interval of a simulation:

sim=SystemModelSimulate[];

sim["SimulationInterval"]

Use the simulation interval property to specify a plot interval:

vars=sim[{"angle1","angle5"},t];

Plot[vars,Evaluate@Prepend[sim["SimulationInterval"],t]]

Show the length of a simulation between 2 and 7 seconds:

sim=SystemModelSimulate[,{2,7}];

sim["SimulationLength"]

Simulate a model with events:

sim=SystemModelSimulate[];

Study the complexity by looking at the number of events during simulation:

sim["NumberOfEvents"]

Get the time points of all the events:

sim["Events"]//Short

Use time points when variables were sampled to retrieve values that are not interpolated:

sim=SystemModelSimulate[];

Retrieve the sample points:

times=sim["Samples"];

Retrieve a variable at these sample points:

sim[{"angle1"},times]//First//Short

OpenersExampleSubsection2(Spacer1)Variables and Parameters  (6)

Pick out variables and parameters:

sim=SystemModelSimulate[,3];

Get the functions for two variables:

{f1,f2}=sim[{"inertia1.a","inertia2.flange_a.phi"}]

Plot[{f1[t],f2[t]},{t,0,3}]

The values of two parameters:

sim[{"inertia3.J","pulse1.period"}]

Retrieve simulation results with units:

sim=SystemModelSimulate[];

Use the base unit from the model:

{v1}=sim[{"aimc.phiMechanical"},TargetUnits->"Unit"];

v1[0.6]

Use the display unit defined in the model:

{v2}=sim[{"aimc.phiMechanical"},TargetUnits->"DisplayUnit"];

v2[0.6]

Retrieve raw data from a simulation:

sim=SystemModelSimulate[,3];

Retrieve the time-value pairs for a loss power variable:

{data}=sim["RawData",{"R5.LossPower"}];

Find the point where the variable is the largest:

maxpt=MaximalBy[data,Last]

Show the largest point on the complete variable trajectory:

SystemModelPlot[sim,{"R5.LossPower"},Epilog->{Red,PointSize[Large],Point[maxpt]}]

Simulate a model with arrays:

sim=SystemModelSimulate[]

Retrieve the 2×2 matrix v.x as a vector-valued function:

{vx}=sim[{"v.x"}]

Plot the elements of the vector:

Plot[Evaluate@vx[t],{t,0,5}]

Retrieve the two elements of vector "v[1].x":

{v1x}=sim[{"v[1].x"}]

Use variable and parameter rules to get data:

sim=SystemModelSimulate[,10];

Pick out simulation trajectories for two variables:

{piContErr,tankH}={"piControl.e","tank.h"}/.sim["VariableValues",t]

Get replacement rules for all parameters in the model:

sim["ParameterValues"]

Simulate with sensitivities:

sim=SystemModelSimulateSensitivity[,2,{"capacitor1.C"}]

sim["SensitivityNames"]

Get simulation and sensitivity values:

{f,s}=sim[{"capacitor1.v",{"capacitor1.v","capacitor1.C"}}]

Find the nominal value of the parameter:

c0=First@sim[{"capacitor1.C"}]

Plot the variation f(t,(Subscript[c, 0]))±(c-(Subscript[c, 0])) ((∂f(t,(Subscript[c, 0])))/(∂c)) for c==0.5 (Subscript[c, 0]):

Plot[{f[t],f[t]+0.5c0 s[t],f[t]-0.5c0 s[t]},{t,0,2},Filling->{2->{3}}]

OpenersExampleSubsection3(Spacer1)Dynamic Diagrams  (2)

Show the dynamic model diagram at time 2:

sim=SystemModelSimulate[,6.28];

sim["Diagram",2]

Show an animation of the diagram over the complete simulation:

diag[t_]:=diag[t]=sim["Diagram",t]

Animate[diag[t],{t,0,6.28},AnimationRunning->False,SaveDefinitions->True]

Show the diagram while controlling a few options:

sim["Diagram",5,Frame->False,GridLines->Automatic,PlotRange->{{-50,50},{-20,20}}]

Show the dynamic model diagram for a component at time 2:

sim=SystemModelSimulate[,6.28];

sim["Diagram",{"component"},2]

Show an animation of the component diagram over the complete simulation:

diagc[t_]:=diagc[t]=sim["Diagram",{"component"},t]

Animate[diagc[t],{t,0,6.28},AnimationRunning->False,SaveDefinitions->True]

OpenersExampleSection3(Spacer1)Applications  (9)

Show the events in a simulation of a bouncing ball:

sim=SystemModelSimulate[,2.5];

Show the event times in a plot of the height:

SystemModelPlot[sim,{"h"},Mesh->{sim["Events"]},MeshStyle->Directive[PointSize[Large],Red]]

Compute the inverse function to an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) from (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData]):

sim=SystemModelSimulate[,10]

Pick out one (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) and compute its inverse:

ifun=sim[{"mass1.flange_b.s"}][[1]];

invfun=InverseFunction[ifun];

Plot the result:

Plot[{Tooltip[invfun[x],"invfun[x]"],Tooltip[ifun[x],"ifun[x]"],Tooltip[x]},{x,0,10},PlotRange->{0,10},AspectRatio->Automatic,Filling->{1->{2},3->{2}}]

Find maxima in a simulation:

sim=SystemModelSimulate[,3];

Plot a variable:

SystemModelPlot[sim,{"R5.LossPower"},PlotRange->All]

Search for the highest points:

pts=Quiet@FindMaximum[sim[{"R5.LossPower"},t],{t,#}]&/@Range[0,3,0.4];

Show the results:

Show[SystemModelPlot[sim,{"R5.LossPower"},PlotRange->All],ListPlot[Transpose[{pts[[All,2,1,2]],pts[[All,1]]}],PlotStyle->{Red}]]

Analyze several variables:

sim=SystemModelSimulate[,10];

Table[SystemModelPlot[sim,{v},PlotLabel->v],{v,sim["VariableNames"][[13;;18]]}]

Use several simulations:

sims=SystemModelSimulate[,10,<|"InitialValues"->{"x1"->0,"x2"->Range[-5,5,0.1]}|>];

Show@(ParametricPlot[Evaluate[#[{"x1","x2"},t]],{t,0,10},PlotRange->All]&/@sims)

Calculate a number of metrics for simulation data:

sim=SystemModelSimulate[,3];

f=sim[{"pipe.Q_flow"}][[1]];

Plot the function:

Plot[f[t],{t,0,3},PlotRange->All,Filling->Axis]

Calculate the 1-norm (Norm2[f, 1])==(∫_0^3)(Abs[f(t)])dt:

NIntegrate[Abs[f[t]],{t,0,3}]

The 2-norm (Norm2[f, 2])==(∫_0^3)((Abs[f(t)])^2)dt:

NIntegrate[Abs[f[t]]^2,{t,0,3}]

The RMS-norm (Subscript[(Norm[f]), RMS])==(Sqrt[(1/3) (∫_0^3)((Abs[f(t)])^2)dt]):

(Sqrt[NIntegrate[Abs[f[t]]^2,{t,0,3}]/3])

Simulate bouncing balls dropped from different heights:

simball=SystemModelSimulate[,20,<|"InitialValues"->{"h"->Range[5]}|>];

ballTraj=Table[s["h"],{s,simball}];

Animate the balls and their heights in a plot:

Animate[{Graphics[{PointSize[0.1],Table[Point[{i,ballTraj[[i]][t]}],{i,5}]},PlotRange->{0,5}],Plot[Evaluate[(#[z]&)/@ballTraj],{z,0,5},PlotRange->{0,5},RegionFunction->(#1<t&)]},{t,0,5},SaveDefinitions->True,AnimationRunning->False]

Visualize with (RefLink[ParametricPlot3D, paclet:ref/ParametricPlot3D]):

sim=SystemModelSimulate[,100,Method->{"DASSL","InterpolationPoints"->5000}];

ParametricPlot3D[Evaluate[sim[{"x","y","z"},t]],{t,0,100},ColorFunction -> ColorData["SunsetColors"],PlotPoints->100]

Filter simulation data with (RefLink[LowpassFilter, paclet:ref/LowpassFilter]):

sim=SystemModelSimulate[,4,<|"Inputs"-> {"v"->  Function[x, Sin[x]+.4RandomReal[]]}|>];

Extract the raw data of a variable:

data=sim["RawData",{"capacitor.v"'}];

Create a (RefLink[TimeSeries, paclet:ref/TimeSeries]) and plot together with the lowpass filtered signal:

ts=TimeSeries[data];

ListLinePlot[Evaluate[{ts,LowpassFilter[ts,10π]}]]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

(RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData]) can be created in (RefLink[SystemModeler, paclet:ref/SystemModeler]) and imported into the Wolfram Language:

sim=Import["ExampleData/OneMass.sme",{"SystemModelSimulationData"}];

SystemModelPlot[sim,{"dTCoolant","dTMass","dTtoPipe"}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate])  ▪  (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])  ▪  (RefLink[SystemModelSimulateSensitivity, paclet:ref/SystemModelSimulateSensitivity])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Getting Started with Model Simulation and Analysis, paclet:tutorial/GettingStartedWithModelSimulationAndAnalysis])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[System Model Simulation, paclet:guide/SystemModelSimulation])}, {▪(RefLinkPlain[System Model Analytics & Design, paclet:guide/SystemModelAnalyticsDesign])}, {▪(RefLinkPlain[System Modeling Overview, paclet:guide/SystemModelingOverview])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(Spacer1)▪(WebLink[(Spacer1)Wolfram SystemModeler Documentation, http://reference.wolfram.com/system-modeler/])}})}})