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


simulates "mmodel" according to experiment settings.


simulates from 0 to tmax.


simulates from tmin to tmax.


stores only simulation data for the variables vars.


  • 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
  • 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.


open allclose all

Basic Examples  (4)

Load Wolfram SystemModeler Link:

Simulate a model with the time interval from experiment settings:

Do a parameter sweep over a voltage offset:

Plot the voltage for all simulations:

Use the diagram representation of a model as input:

Copy and paste the output above:

Scope  (13)

Simulation Time  (4)

Simulate with settings from the model:

Simulate from time 0 to 5:

Simulate for an explicit time interval:

Use a Quantity to specify the time interval:

Variables and Parameters  (5)

Simulate a model with different parameters:

Use default parameters:

Set a parameter:

Compare the variable capacitor1.v^(') between the simulations:

Initial values for variables can be set with the WSMInitialValues option:

Parameter values can be set with the WSMParameterValues option:

Simulate a model with given input:

Simulate the model that adds two inputs:

Plot the inputs and the output:

Store only selected variables:

Only the given variables are saved:

Simulation Results  (4)

Simulate a model and plot the variables x1 and x2:

Simulate a model:

Get simulation results for the variables x and x':

Plot the variables using the Plot function:

Simulate a model and find the maximum of a variable:

Get the value of the variable angle1v:

Find the maximum value of the angle:

Run a simulation and plot in a single call:

Specify arguments to WSMSimulate:

Generalizations & Extensions  (1)

Debug messages are collected in the message group "WSMLinkDebug":

Turn on debug messages for initialization:

Turn off all debug messages for WSMLink:

Options  (17)

InterpolationOrder  (1)

Simulate with interpolation orders 1 and 3, and 3 interpolation points:

Show the x variable:

Method  (8)

Use a fixed-step solver:

Plot the result:

Use an adaptive-step solver:

Show the result in a ParametricPlot:

For stiff problems, use an adaptive-step method:

Simulating with too few interpolation points can give inexact plots:

Increasing the number of points gives a better result:

The default step size for a fixed-step solver might be smaller than needed:

Use a larger step size to speed up computation:

The result is comparable:

Let an adaptive solver choose the solver steps:

Use NDSolve for simulating a model:

The result is a WSMSimulationData object containing the simulation results:

Pass options to NDSolve:

The accuracy is reduced because of the options:

WSMInitialValues  (2)

Simulate with a changed initial value for the variable x:

Simulate for different initial values for the variable x:

Plot the variable x from all simulations:

WSMInputFunctions  (2)

Simulate a model with a given input:

Simulate the model that derives the input:

Plot the input and the output:

Simulate a model with a TimeSeries as input:

Define a time series object:

Simulate the model:

Plot the input and the output:

WSMParameterValues  (3)

Change two parameter values:

Check the parameters in the simulation result:

Do a parameter sweep over a voltage offset:

Plot the voltage for all simulations:

Setting ranges for two parameters simulates once for each position in the ranges:

WSMProgressMonitor  (1)

Turn off the progress dialog with WSMProgressMonitor:

Applications  (11)

Calculate the overshoot of the height in a tank system:

Find the maximum peak value:

Get the value of the step sent in to the tank:

Calculate the overshoot:

Show the overshoot:

Calculate the rise time for the height in a tank system:

Get the required values at 10% and 90% by looking at the steady-state value for height:

Find the times at which the signal reaches these values:

Calculate the rise time:

Plot lines at the final value, and when the signal reaches 10% and 90% of the final value:

Calculate the settling time for the height in a tank system:

Find 5% bounds on the final value:

Find the time at which the signal stays within these values:

Plot the bounds and the found settling time:

Change parameter values interactively:

Simulate a rolling wheel for different starting inertias along the wheel axis:

Fetch the trajectories for the wheel:

Plot the trajectories:

Analyze resonance peaks when varying a parameter:

Simulate with varying spring constant:

Compute TemplateBox[{{H, (, {ⅈ,  , omega}, )}}, Abs] from :

Show the resonance peaks:

Calibrate parameters in a model by comparing to measurement data:

Set up a criteria function for model fitting:

Fit parameters to the test data:

Simulate with the fitted parameters:

Show the test data and the calibrated model together:

Filter sampled data from a Tinker Forge Weather Station:

Time shift and retrieve the magnitude of the data:

Run the time series through a lowpass filter:

Simulate a lowpass filter with sound as input:

Define an input sound:

Simulate with given input sound:

Retrieve the output and play both to compare:

Simulate a Newton's cradle:

Fetch trajectories from the result:

Visualize the cradle:

Visualize simulated data with a WaveletScalogram:

Simulate the model:

Pick out the data you are interested in:

Compute the wavelet transform:

Plot the wavelet vector coefficients:

Properties & Relations  (4)

The output from WSMSimulate is a WSMSimulationData object:

Use properties to get variable trajectories:

Use WSMSimulateSensitivity to also get sensitivities to parameters:

Plot the capacitor's voltage sensitivity to the frequency of "sineVoltage1":

Use WSMParametricSimulate for a function that can be evaluated for different values:

Compute solutions for different values of the frequency parameter:

Plot the solutions over time:

Use WSMRealTimeSimulate to simulate a model in real time:

Show a plot in real time:

Start the simulation:

Neat Examples  (1)

Use the Van der Pol model:

Simulate and show in a parametric plot: