({{, (RefLink[SystemModelParametricSimulate, paclet:ref/SystemModelParametricSimulate])[model,v,{(Subscript[p, 1]),(Subscript[p, 2]),…}] 
simulates model for the variable v with parameters (Subscript[p, i]).}, {, (RefLink[SystemModelParametricSimulate, paclet:ref/SystemModelParametricSimulate])[model,{(Subscript[v, 1]),(Subscript[v, 2]),…},{(Subscript[p, 1]),(Subscript[p, 2]),…}] 
simulates model for multiple variables (Subscript[v, i]).}, {, (RefLink[SystemModelParametricSimulate, paclet:ref/SystemModelParametricSimulate])[model,vars,(Subscript[t, max]),…] 
simulates from 0 to (Subscript[t, max]).}, {, (RefLink[SystemModelParametricSimulate, paclet:ref/SystemModelParametricSimulate])[model,vars,{(Subscript[t, min]),(Subscript[t, max])},…] 
simulates from (Subscript[t, min]) to (Subscript[t, max]).}})

OpenersNotesSection(Spacer1)Details and Options

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[SystemModelParametricSimulate, paclet:ref/SystemModelParametricSimulate]) gives results in terms of (RefLink[ParametricFunction, paclet:ref/ParametricFunction]) objects.

(RefLink[SystemModelParametricSimulate, paclet:ref/SystemModelParametricSimulate]) takes the same options as (RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Get a parametric solution for z with parameter a:

sol=SystemModelParametricSimulate[,"z",{"a"}]

Evaluating with a numerical value of a gives an approximate function solution for z:

z1=sol[1]

Evaluate at a time t=10:

z1[10]

Plot the solutions for several different values of the parameter:

Plot[Evaluate[Table[sol[a][t],{a,0,1,.1}]],{t,0,10}]

Get a parametric solution for z with respect to the initial value of y:

sol=SystemModelParametricSimulate[,"z",{"y"}]

Plot the solutions for several different values of the parameter:

Plot[Evaluate[Table[sol[a][t],{a,0,1,.1}]],{t,0,10}]

Show the sensitivity of the variable z to the parameter a:

sol=SystemModelParametricSimulate[,"z",{"a"}]

The sensitivity with respect to a increases with time:

Plot[Evaluate[(sol[a][t]+{0,.1,-.1}D[sol[a][t],a])/.{a->1}],{t,0,10},Filling->{2->{3}}]

OpenersExampleSection1(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)Method  (1)

Use (RefLink[Method, paclet:ref/Method]) to choose the underlying solver:

model=;

Use the DASSL solver:

dassl=SystemModelParametricSimulate[model,"z",{"a"},Method->"DASSL"]

Use (RefLink[ParametricNDSolve, paclet:ref/ParametricNDSolve]) as the solver:

ndsolve=SystemModelParametricSimulate[model,"z",{"a"},Method->"ParametricNDSolve"]

(RefLink[ParametricNDSolve, paclet:ref/ParametricNDSolve]) is often faster than other solvers:

AbsoluteTiming[ndsolve[1][10]]

AbsoluteTiming[dassl[1][10]]

OpenersExampleSection2(Spacer1)Applications  (3)

Optimize parameters for maximizing a throw by a trebuchet:

model=;

Retrieve a parametric function for the thrown distance, varying release time and rope length:

distance=SystemModelParametricSimulate[model,"distance",{"releaseTime","ropeLength"}]

Maximize the throwing distance, constraining parameters to reasonable ranges:

Monitor[fittedpars=NMaximize[{distance[time,length][10],0.1<length<3&&5<time<6.5},{time,length},AccuracyGoal->2,PrecisionGoal->2],{time,length}]

Simulate using the optimal throwing parameters:

sim=SystemModelSimulate[model,<|"ParameterValues"->({"releaseTime"->time,"ropeLength"->length}/.fittedpars[[2]])|>]

Show the distance until the first bounce:

sim[{"distance"},10]

Plot the trajectory of the thrown object using a stored plot:

SystemModelPlot[sim,"Trajectory"]

Calibrate parameters in a model by comparing to measurement data:

data=Import["ExampleData/inertiaTestData.dat"];

Compute a parametric function for the inertia variable measured:

pf=SystemModelParametricSimulate[,"Inertia2.w",40,{"Resistor1.R","SpringDamper1.d"}]

Set up a criteria function for model fitting:

criteriaFun[p_?NumericQ,q_?NumericQ]:=Module[{f},
f=pf[p,q];
((Norm[Table[data[[i,2]]-f[data[[i,1]]],{i,Length[data]}]])^2)
]

Fit parameters to the test data:

fittedpars=FindMinimum[criteriaFun[p,q],{{p,0.1},{q,0.25}},StepMonitor:>PrintTemporary[{p,q}]]

Simulate with the fitted parameters:

sol=pf[p,q]/.fittedpars[[2]];

Show the test data and the calibrated model together:

Show[Plot[sol[t],{t,0,40},PlotStyle->Orange],ListPlot[data]]

Fit model parameters to the mean of many measurements:

vars={"B.c","C.c"};
pars={"k1","k2","k3"};

Create parametric functions for concentration variables based on parameters k1, k2 and k3:

simFun=SystemModelParametricSimulate[,vars,20,pars,Method->{"NDSolve",AccuracyGoal->6,PrecisionGoal->6,InterpolationOrder->1,Compiled->{Automatic,CompilationTarget->"C"}}]

Define a fitting function that evaluates at a time and parameter set:

fittingFun[k1_?NumericQ,k2_?NumericQ,k3_?NumericQ,time_?NumericQ,varNum_?NumericQ]:=fittingFun[k1,k2,k3,time,varNum]=simFun[k1,k2,k3][[varNum]][time]

Define the measurement data:

measureDataB=TemporalData[];
measureDataC=TemporalData[];

Show the data and its distribution:

Show[BoxWhiskerChart[Transpose[measureDataB["ValueList"]],ChartStyle->Hue[.5]],BoxWhiskerChart[Transpose[measureDataC["ValueList"]]]]

Compute the mean of the measurements at each time point:

meanB=TimeSeriesThread[Mean,measureDataB];
meanC=TimeSeriesThread[Mean,measureDataC];

Compute the standard deviation of measurements at each time point:

stdDevB=TimeSeriesThread[StandardDeviation,measureDataB];
stdDevC=TimeSeriesThread[StandardDeviation,measureDataC];

Construct the data to fit against, using the mean of measurements:

data=Join[
Map[Prepend[#,1]&,meanB["Path"]],
Map[Prepend[#,2]&,meanC["Path"]]
];

Weight each time point based on the standard deviation:

dataWeights=1/Join[stdDevB["Values"],stdDevC["Values"]]^2;

Fit parameters against the data:

Monitor[
evalCount=0;
fittedModel=NonlinearModelFit[data,
{fittingFun[k1,k2,k3,time,varNum],
0.01<k1<10&&
0.01<k2<10&&
0.01<k3<10},
{k1,k2,k3},
{varNum,time},
Weights->dataWeights,
VarianceEstimatorFunction->(1&),Method->{NMinimize,Method->"DifferentialEvolution",AccuracyGoal->3,PrecisionGoal->3,EvaluationMonitor:>evalCount++}],evalCount]

Extract the best-fitting parameters:

bestFitParameters=fittedModel["BestFitParameters"]

Show the found fit together with all the measured data:

Show[Plot[
Through[(simFun[k1,k2,k3]/.bestFitParameters)[t]],{t,0,20},
PlotLegends->vars],
ListPlot[{Join@@measureDataB["Paths"],Join@@measureDataC["Paths"]}]]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

(RefLink[SystemModelSimulateSensitivity, paclet:ref/SystemModelSimulateSensitivity]) can be used to easily compute parameter sensitivity:

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

Plot sensitivity bounds for y and z when varying a by 10%:

SystemModelPlot[sim,{{"y","a",0.1},{"z","a",0.1}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ParametricFunction, paclet:ref/ParametricFunction])  ▪  (RefLink[SystemModelSimulate, paclet:ref/SystemModelSimulate])  ▪  (RefLink[SystemModelSimulateSensitivity, paclet:ref/SystemModelSimulateSensitivity])  ▪  (RefLink[SystemModel, paclet:ref/SystemModel])  ▪  (RefLink[ParametricNDSolveValue, paclet:ref/ParametricNDSolveValue])  ▪  (RefLink[DSolveValue, paclet:ref/DSolveValue])  ▪  (RefLink[SystemModelExamples, paclet:ref/SystemModelExamples])}})}})

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

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