WSMLink`
WSMLink`

WSMSetValues

WSMSetValues is being phased out in favor of SystemModel, which was introduced experimentally in Version 11.3.

WSMSetValues["mmodel",{p1->c1,}]

sets parameters pi to ci in the Modelica model "mmodel".

WSMSetValues["mmodel",{p1->c1,},"InitialValues"]

sets the initial values for pi to ci in the Modelica model "mmodel".

Details and Options

  • WSMSetValues sets values for the Wolfram SystemModeler kernel.
  • WSMSetValues allows you to set parameter values and input variables.
  • WSMSetValues["mmodel",{p1->c1,}] is short for WSMSetValues["mmodel",{p1->c1,},"ParameterValues"].
  • Current parameter values can be found using WSMModelData["mmodel","ParameterValues"].
  • With WSMSetValues["mmodel",{},"InitialValues"], initial values can be set for all variables and parameters.
  • Current initial values can be found using WSMModelData["mmodel","InitialValues"].
  • The shortest unique model name mmodel can be used where WSMNames["*.mmodel"] gives a unique match.

Examples

open allclose all

Basic Examples  (4)

Load Wolfram SystemModeler Link:

Make a copy, and change the value for the parameter a from 3 to 10:

Set the start value of the variable x to 3:

Use the diagram representation of a model as input:

Copy and paste the output above:

Scope  (4)

Use a model with a multidimensional variable:

Set the initial values for the variable:

The start value of the variable x is updated:

Set string values in a model:

Give the string parameter a new value:

The value of x is updated:

Transfer a StateSpaceModel of a mass-spring-damper system into a SystemModeler model:

Simulate the changed model:

Transfer a mass-spring-damper TransferFunctionModel into a model:

Get coefficients for denominator and numerator:

Set coefficients in the model:

Simulate the changed model:

Applications  (1)

Design a controller in the Wolfram Language, and change the model to use chosen control parameters:

Get the transfer function for the model:

Interactively design a PI controller:

Set chosen values in the model with a controller:

Simulate the model with a controller and verify the result:

Properties & Relations  (1)

Define a model:

Simulating with initial values does not change the model:

Change the start value with WSMSetValues: