({{, (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[sim]
shows preferred plots from the (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData]) object sim.}, {, (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[sim,"name"]
shows stored plot "name".}, {, (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[sim,{"(Subscript[v, 1])","(Subscript[v, 2])",…}]
generates a plot of the variables (Subscript[v, i]) in sim.}, {, (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[{(Subscript[sim, 1]),(Subscript[sim, 2]),…},…]
plots variables from several simulations. }, {, (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[model,…]
plots from a new simulation of "model".}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[…,{(Subscript[t, min]),(Subscript[t, max])}] plots from (Subscript[t, min]) to (Subscript[t, max]).

(RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[{model,args},…] generates simulation data using (RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate])[model,args].

The model can be a (RefLink[SystemModel, paclet:ref/SystemModel]) object, a full model name string or a shortened model name accepted by (RefLink[SystemModel, paclet:ref/SystemModel]).

(RefLink[SystemModelPlot, paclet:ref/SystemModelPlot])[sim,{{"(Subscript[v, 1])","(Subscript[p, 1])",(Subscript[d, i])},…},…] plots variables (Subscript[v, i]) and sensitivity bounds when parameter (Subscript[p, i]) varies 100(Subscript[d, i])%. »

A list of stored plots for (RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData]) sim is available with sim["PlotNames"].

(RefLink[SystemModelPlot, paclet:ref/SystemModelPlot]) has the same options as (RefLink[ListLinePlot, paclet:ref/ListLinePlot]), with the following additions and changes:

Events in a simulation are indicated in a plot with (RefLink[Mesh, paclet:ref/Mesh])->"Events". »

Possible settings for (RefLink[TargetUnits, paclet:ref/TargetUnits]) include:

"Unit" and "DisplayUnit" attempt to convert compatible quantities to a common unit.

"DisplayUnit" and "IndividualDisplayUnit" convert to a unit specified in the model for plot purposes.

OpenersPrimaryExamplesSection(Spacer1)Examples  (38)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Plot a preferred stored plot from a model simulation:

SystemModelPlot[]

Plot a stored plot from a model simulation:

SystemModelPlot[,"PositionsX"]

Different simulations can be compared in the same plot:

{(Subscript[sim, 1]),(Subscript[sim, 2])}=SystemModelSimulate[,<|"InitialValues"->{"angle1"->{(π/4),(π/3)}}|>];

The tooltip is prepended with the simulation number:

SystemModelPlot[{(Subscript[sim, 1]),(Subscript[sim, 2])},{"angle1"}]

Randomly choose one of the example models from the (WebLink[analog electrical domain, http://reference.wolfram.com/system-modeler/libraries/Modelica/Modelica.Electrical.Analog.Examples.html]):

model=RandomChoice[SystemModelExamples["Models","Modelica.Electrical.Analog.*"]]

Show the stored plot for the model:

SystemModelPlot[model]

OpenersExampleSection1(Spacer1)Scope  (20)

OpenersExampleSubsection0(Spacer1)Variable Specification  (2)

Plot variables from a model simulation:

SystemModelPlot[,{"x1","x2","x3","x4","x5"}]

Show bounds when varying a parameter:

sim=SystemModelSimulateSensitivity[,5,{"sineVoltage1.freqHz"}];

Show the estimated capacitor voltage variation when varying the frequency by 5%:

SystemModelPlot[sim,{{"capacitor1.v","sineVoltage1.freqHz",0.05}}]

OpenersExampleSubsection1(Spacer1)Time Specification  (2)

Simulate a model for 10 seconds:

sim=SystemModelSimulate[,10];

Plot the variable x1 for the whole interval:

SystemModelPlot[sim,{"x1"}]

If no interval argument is given, the whole simulation interval is plotted:

sim=SystemModelSimulate[,{0,10}];

SystemModelPlot[sim,{"x1","x2"}]

Plot only a certain interval:

SystemModelPlot[sim,{"x1","x2"},{0,2}]

OpenersExampleSubsection2(Spacer1)Simulation Specification  (3)

Simulate and plot a model from 0 to 5:

SystemModelPlot[{,5},{"x1","x2"}]

Simulate a model with given initial values and plot the result:

SystemModelPlot[{,10,<|"InitialValues"->{"angle1"->π/3,"angle2"->3π/12}|>},{"angle1","angle2","angle4","angle5"}]

Simulate an oscillating mass on a spring, with a damper acting on the spring:

sim=SystemModelSimulate[,2,<|"ParameterValues"->{"spring2.c"->100,"damper1.d"->{1,3,10}}|>];

Compare the oscillation of the mass with the different levels of damping:

SystemModelPlot[sim,{"mass2.s"}]

OpenersExampleSubsection3(Spacer1)Stored Plots  (3)

Models can have stored plots:

sim=SystemModelSimulate[];

Get names of the stored plots:

sim["PlotNames"]

Show a stored plot:

SystemModelPlot[sim,"EndPosition"]

Stored plots may contain multiple subplots:

sim=SystemModelSimulate[];

SystemModelPlot[sim,"LevelsAndFlows"]

Stored plots may contain groupings of plots:

sim=SystemModelSimulate[];

Groups are indicated by the / separator:

sim["PlotNames"]

All plots in a group can be plotted at once:

SystemModelPlot[sim,"Angles"]

OpenersExampleSubsection4(Spacer1)Presentation  (10)

Multiple variables are automatically colored to be distinct:

sim=SystemModelSimulate[];

SystemModelPlot[sim,{"x1","x2","x3","x4","x5"}]

Use (RefLink[PlotStyle, paclet:ref/PlotStyle]) to change the plot colors:

SystemModelPlot[sim,{"x1","x2","x3","x4","x5"},PlotStyle->ColorData[90,"ColorList"]]

(RefLink[Filling, paclet:ref/Filling]) can be used to specify fill regions and styles:

sim=SystemModelSimulate[];

SystemModelPlot[sim,{"x1","x4"},PlotStyle->Thick,Filling->Axis]

Fill between the two curves:

SystemModelPlot[sim,{"x1","x4"},PlotStyle->Thick,Filling->{1->{2}}]

A legend is automatically shown for plots with multiple variables:

sim=SystemModelSimulate[,{0,10}];

SystemModelPlot[sim,{"x1","x2"}]

Turn off (RefLink[PlotLegends, paclet:ref/PlotLegends]):

SystemModelPlot[sim,{"x1","x2"},PlotLegends->None]

Style legends:

SystemModelPlot[sim,{"x1","x2"},PlotLegends->SwatchLegend[Automatic,LegendLabel->"Variables"]]

Events can be illustrated with (RefLink[Mesh, paclet:ref/Mesh]) points:

sim=SystemModelSimulate[,3];

SystemModelPlot[sim,{"h"},Mesh->"Events"]

For multiple simulations:

sim2=SystemModelSimulate[,3,<|"InitialValues"->{"h"->2}|>]

SystemModelPlot[{sim2,sim},{"h"},Mesh->"Events"]

Use any expressions in plot legends:

SystemModelPlot[,{"y","z"'},PlotLegends->{y[t],z'[t]==-a y[t]}]

Do multiple simulations:

sim=SystemModelSimulate[,{0,3},<|"InitialValues"->{"x"->{1,2,3}}|>];

The (RefLink[Tooltip, paclet:ref/Tooltip]) and plot legends show which simulation the curve belongs to:

SystemModelPlot[sim,{"x"}]

(RefLink[SystemModelPlot, paclet:ref/SystemModelPlot]) sets the option (RefLink[AxesLabel, paclet:ref/AxesLabel]):

sim=SystemModelSimulate[];

SystemModelPlot[sim,{"y","z"'}]

Override by setting (RefLink[AxesLabel, paclet:ref/AxesLabel]):

SystemModelPlot[sim,{"y","z"'},AxesLabel->{"t","x(t)"}]

Wrappers like (RefLink[Style, paclet:ref/Style]) can be used for styling variables:

sim=SystemModelSimulate[];

SystemModelPlot[sim,{Style["x1",Thick],Style["x4",Green]}]

Setting a (RefLink[Tooltip, paclet:ref/Tooltip]) removes all automatic tooltips:

sim=SystemModelSimulate[];

SystemModelPlot[sim,{Tooltip["x1","This is x1"],"x4"}]

Plots are shown in display units defined in the model:

sim=SystemModelSimulate[];

vars={"mass1.T","mass2.T"};

SystemModelPlot[sim,vars]

Use (RefLink[TargetUnits, paclet:ref/TargetUnits]) to choose a different unit:

SystemModelPlot[sim,vars,TargetUnits->"Fahrenheit"]

OpenersExampleSection2(Spacer1)Options  (6)

OpenersExampleSubsection5(Spacer1)PlotLegends  (1)

Use variable names as (RefLink[PlotLegends, paclet:ref/PlotLegends]):

SystemModelPlot[{,2},{"inertia1.w","inertia2.w"},PlotLegends->"Expressions"]

Use variable descriptions:

SystemModelPlot[{,3},{"inertia1.phi","resistor1.i"},PlotLegends->"Descriptions"]

OpenersExampleSubsection6(Spacer1)TargetUnits  (5)

Plot different units in the same plot:

sim=SystemModelSimulate[];

vars={"mass1.T","conduction.Q_flow"};

SystemModelPlot[sim,vars]

Variables of the same physical dimension are converted to the same unit:

sim=SystemModelSimulate[];

vars={"distance","distanceCm"};

SystemModelPlot[sim,vars]

Use "IndividualDisplayUnit" to use the given display unit for each variable:

SystemModelPlot[sim,vars,TargetUnits->"IndividualDisplayUnit"]

Use an explicitly given unit:

sim=SystemModelSimulate[];

vars={"distance","distanceCm"};

SystemModelPlot[sim,vars,TargetUnits->"m"]

Plot in a common base unit from the model:

sim=SystemModelSimulate[];

vars={"temp","tempC"};

SystemModelPlot[sim,vars,TargetUnits->"Unit"]

Use the individual base units without converting to a common unit:

SystemModelPlot[sim,vars,TargetUnits->"IndividualUnit"]

Turn off unit handling completely for maximum performance:

sim=SystemModelSimulate[];

vars={"temp","tempC"};

SystemModelPlot[sim,vars,TargetUnits->None]

OpenersExampleSection3(Spacer1)Applications  (3)

Do a parameter sweep:

sim=SystemModelSimulate[,4,<|"ParameterValues"->{{"springDamper1.d",Range[2,14,2]}}|>];

SystemModelPlot[sim,{"slidingMass1.s"},PlotRange->All]

Compare the different simulations to a first-order system:

sol=NDSolve[{0.2y'[t]+y[t]==0.05,y[0]==0},{y},{t,0,4}];

Show[Plot[y[t]/.sol,{t,0,4},PlotRange->All,PlotStyle->{Red,Thick}],SystemModelPlot[sim,{"slidingMass1.s"},PlotRange->All,PlotStyle->Thin]]

Find out which of three parameters a model is most sensitive to:

pars={"sine.amplitude","sine.freqHz","gain.k"};

sim=SystemModelSimulateSensitivity[,5,pars];

A 5% sensitivity bound on the output shows that "sine.freqHz" has the highest impact:

Table[SystemModelPlot[sim,{{"integrator.y",p,0.05}},PlotLabel->p],{p,pars}]

Show a custom explanatory legend:

sims=SystemModelSimulate[,4,<|"ParameterValues"->{"g"->{23.12,9.82,1.62}}|>];

SystemModelPlot[sims,{"h"},PlotLegends->SwatchLegend[{"Jupiter","Earth","Moon"},LegendLabel->"Bouncing ball on:"]]

OpenersExampleSection4(Spacer1)Properties & Relations  (4)

(RefLink[SystemModelPlot, paclet:ref/SystemModelPlot]) is related to (RefLink[Plot, paclet:ref/Plot]):

sim=SystemModelSimulate[,{0,10}];

Select the variables you want to plot:

vars={"x1","x2"};

Plot using (RefLink[SystemModelPlot, paclet:ref/SystemModelPlot]):

SystemModelPlot[sim,vars]

Plot using (RefLink[Plot, paclet:ref/Plot]):

Plot[Evaluate@sim[vars,t],{t,0,10}]

(RefLink[SystemModel, paclet:ref/SystemModel]) can store a plot in a model:

model=SystemModel[,<|"Plots"-><|"Name"->"MyPlot","Variables"->{"y","z"}|>|>];

Simulate and show the newly defined plot:

SystemModelPlot[{model,10},"MyPlot"]

Use (RefLink[Plot, paclet:ref/Plot]) to show variables of different magnitude in the same plot:

sim=SystemModelSimulate[,100];

Retrieve results from a simulation:

{ϕ,ω}=sim[{"inertia1.phi","inertia1.w"}];

Scale the rotational angle by a factor of 50 and show it with the rotational velocity:

Plot[{ϕ[t]/50,ω[t]},{t,0,100},PlotLegends->"Expressions"]

Simulate a rolling wheel:

sim=SystemModelSimulate[,{0,4}]

Get the x and y positions of the wheel axis:

{wheelx,wheely}=sim[{"wheel1.x","wheel1.y"},t];

Plot the position with a (RefLink[ParametricPlot, paclet:ref/ParametricPlot]):

ParametricPlot[{wheelx,wheely},Evaluate@Prepend[sim["SimulationInterval"],t]]

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Simulate a Newton's cradle:

sim=SystemModelSimulate[,{0,90},<|"ParameterValues"->{"e"->0.98},"InitialValues"->{"angle1"->(π/2),"angle2"->(π/3)}|>];

Show the x position of each of the five balls:

SystemModelPlot[sim,{"x1","x2","x3","x4","x5"}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SystemModelSimulationData, paclet:ref/SystemModelSimulationData])  ▪  (RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate])  ▪  (RefLink[Plot, paclet:ref/Plot])  ▪  (RefLink[ParametricPlot, paclet:ref/ParametricPlot])  ▪  (RefLink[SystemModel, paclet:ref/SystemModel])  ▪  (RefLink[SystemModelExamples, paclet:ref/SystemModelExamples])}})}})

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

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[System Model Analytics & Design, paclet:guide/SystemModelAnalyticsDesign])}, {▪(RefLinkPlain[System Modeling Overview, paclet:guide/SystemModelingOverview])}, {▪(RefLinkPlain[System Model Simulation, paclet:guide/SystemModelSimulation])}, {▪(RefLinkPlain[Systems Modeling, paclet:guide/SystemsModeling])}, {▪(RefLinkPlain[Life Sciences & Medicine: Data & Computation, paclet:guide/LifeSciencesAndMedicineDataAndComputation])}})}})

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