WSMLink`
WSMLink`

WSMParameterValues

WSMParameterValues is being phased out in favor of the association key "ParameterValues" in functions introduced experimentally in Version 11.3.

WSMParameterValues

is an option for functions such as WSMSimulate that specifies values for parameters.

Details and Options

  • Using WSMParameterValues for a simulation does not recompile the model.
  • WSMParameterValues takes the following values:
  • {p1c1,}set parameters pi to ci
    {p1{c1,c2,},}run simulations in parallel, with pi taking values cj
  • Each pi can be either a string or DotName.

Examples

open allclose all

Basic Examples  (4)

Load Wolfram System Modeler Link:

Simulate with default parameters:

Change the offset to 2:

Simulate with a range of parameters:

Vary the part of the momentum that is transferred to the next ball in the cradle:

The angles of the first and last ball in the cradle for different parameters:

Create a model with a parameter value for par:

Scope  (11)

Simulate  (6)

WSMParameterValues is used to set values for parameters in simulation:

WSMParameterValues can be used together with WSMInitialValues:

If a list is given for WSMParameterValues, multiple simulations are run in parallel:

Sweeps with multiple parameters changing can be done with lists of equal length:

Simulate all combinations of a parameter and an initial value:

Set a discrete parameter by using True or False:

Create Models  (5)

Create a model with one parameter depending on another:

Create a model with a parameter equal to an expression:

Create the Modelica string for a model with parameter values:

Give parameter values for a TransferFunctionModel:

Give parameter values for a StateSpaceModel:

Applications  (1)

Study a pendulum model:

A real pendulum with length 10 and starting angle is measured to follow this function:

Simulate for a range of different gravitational constants:

Save the angles of the pendulum in the simulations:

Define a difference function:

The constant 9.82 is closest, so reiterate around that point:

A gravitational constant of 9.82 is closest to the measured one:

Properties & Relations  (1)

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