WSMLink`
WSMLink`

WSMSimulate

WSMSimulate is being phased out in favor of SystemModelSimulate, which was introduced experimentally in Version 11.3.

WSMSimulate["mmodel"]

simulates "mmodel" according to experiment settings.

WSMSimulate["mmodel",tmax]

simulates from 0 to tmax.

WSMSimulate["mmodel",{tmin,tmax}]

simulates from tmin to tmax.

WSMSimulate["mmodel",vars,{tmin,tmax}]

stores only simulation data for the variables vars.

Details

  • WSMSimulate returns a WSMSimulationData object.
  • The "mmodel" refers to the fully qualified Modelica name.
  • The shortest unique model name mmodel can be used where WSMNames["*.mmodel"] gives a unique match.
  • The stored simulation variables vars can have the following values:
  • Automaticautomatically choose what to store
    {v1,v2,}store only variables vi
    Allstore all variables
  • The following options can be given:
  • InterpolationOrderAutomaticcontinuity degree of output between events
    MethodAutomaticwhat simulation method to use
    WSMInitialValuesAutomaticoverriding initial values
    WSMInputFunctionsAutomaticoverriding input values
    WSMParameterValuesAutomaticoverriding parameter values
    WSMProgressMonitorAutomaticcontrol display of progress
  • The option setting Automatic normally means that the setting is taken from "mmodel" or its experiment setting.
  • Setting WSMParameterValues or WSMInitialValues to {pi->{c1,c2,},} runs simulations in parallel, with pi taking values cj.
  • WSMInitialValues corresponds to the start property in the Modelica model.
  • WSMInputFunctions->{"var1"->fun1,} uses funi[t] as the input value for vari at time t.
  • 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)

Load Wolfram SystemModeler Link:

In[1]:=
Click for copyable input

Simulate a model with the time interval from experiment settings:

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

Do a parameter sweep over a voltage offset:

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

Plot the voltage for all simulations:

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

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]=

Scope  (13)

Generalizations & Extensions  (1)

Options  (17)

Applications  (11)

Properties & Relations  (4)

Neat Examples  (1)

See Also

WSMSimulationData  WSMRealTimeSimulate  WSMModelData  WSMSimulateSensitivity  WSMPlot

Tutorials