SystemModelSimulate

SystemModelSimulate[model]

simulates model according to experiment settings.

SystemModelSimulate[model,tmax]

simulates from 0 to tmax.

SystemModelSimulate[model,{tmin,tmax}]

simulates from tmin to tmax.

SystemModelSimulate[model,vars,{tmin,tmax}]

stores only simulation data for the variables vars.

Details and Options

  • The model can be a SystemModel object, a full model name string or a shortened model name accepted by SystemModel.
  • SystemModelSimulate returns a SystemModelSimulationData object.
  • The stored simulation variables vars can have the following values:
  • Automaticautomatically choose what to store
    {v1,v2,}store only variables vi
    Allstore all variables
  • SystemModelSimulate[,spec] uses Association spec for initial values, parameters and inputs:
  • "ParameterValues"{"p1"val1,}parameter "pi" has value vali
    "InitialValues"{"v1"val1,}variable "vi" has value vali
    "Inputs"{"in1"fun1,}input "ini" has value funi[t] at time t
  • Setting "ParameterValues" or "InitialValues" to {pi->{c1,c2,},} runs simulations in parallel, with pi taking values cj.
  • "InitialValues" corresponds to the start property in the Modelica model.
  • The following options can be given:
  • InterpolationOrderAutomaticcontinuity degree of output between events
    MethodAutomaticwhat simulation method to use
    SystemModelProgressReportingAutomaticcontrol display of progress
  • Method settings take the form Method->"method" or Method{"method","sub1"->val1,}.
  • The following adaptive step methods can be used:
  • "DASSL"DASSL DAE solver
    "CVODES"CVODES ODE solver
  • Suboptions for adaptive-step methods include:
  • "InterpolationPoints"Automaticnumber of interpolation points
    "Tolerance"10^-6tolerance for adaptive step size
  • The following fixed-step methods can be used:
  • "Euler"explicit Euler's method of order 1
    "Heun"Heun's method of order 2
    "RungeKutta"explicit RungeKutta method of order 4
  • Suboptions for fixed-step methods include:
  • "StepSize"10^-3fixed step size
  • With Method->{"NDSolve",sub1->val1,}, NDSolve is used as the solver. Method options subi are passed to NDSolve.

Examples

open allclose all

Basic Examples  (4)

Simulate a model with the time interval from experiment settings:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Do a parameter sweep over a voltage offset:

In[1]:=
Click for copyable input

Plot the voltage for all simulations:

In[2]:=
Click for copyable input
Out[2]=

Use the diagram representation of a model as input:

In[1]:=
Click for copyable input
Out[1]=

Copy and paste the output above:

In[2]:=
Click for copyable input
Out[2]=

Simulate one of the included example models from the electrical domain:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Scope  (17)

Generalizations & Extensions  (1)

Options  (10)

Applications  (11)

Properties & Relations  (3)

Neat Examples  (1)

See Also

SystemModelSimulationData  SystemModelExamples  SystemModel  SystemModelSimulateSensitivity  SystemModelPlot  SystemModelParametricSimulate  NDSolveValue  DSolveValue

Tutorials

Introduced in 2018
(11.3)