WSMInitialValues
WSMInitialValues
is an option for functions such as WSMSimulate that specifies initial values for variables.
Details and Options
- Setting WSMInitialValues->{v1->a1,…} sets initial values vi to ai in the simulation or model.
- WSMInitialValues corresponds to the start property in the model.
- Using WSMInitialValues for a simulation does not recompile the model.
- WSMInitialValues takes the following values:
-
{v1a1,…} set initial values for vi to ai {v1{a1,a2,…},…} run simulations in parallel, with initial values aj for vi - Each vi can be either a string or DotName.
Examples
open allclose allBasic Examples (4)
Scope (8)
Simulate (5)
WSMInitialValues is used to set initial values for variables in simulation:
WSMInitialValues can be used together with WSMParameterValues:
If a list is given for WSMInitialValues, multiple simulations are run in parallel:
Sweeps with multiple initial values changing can be done with lists of equal length:
Simulate all combinations of a parameter and an initial value:
Applications (2)
Find initial values to satisfy a condition on a final value:
Simulate a bouncing ball with a range of initial heights:
Pick out the simulations where the ball bounced 18 times:
Find initial heights of successful simulations:
Do a parallel sweep to fit a variable to experimental data for a rolling wheel:
Import and interpolate experimental data:
Simulate with initial values in the interval 1.9 to 2.3:
Find the total norm differences from simulations and experiment:
The plot shows that the second simulation, with a mass of 2, is closest to the experimental data:
Properties & Relations (1)
Parameters can be set with the option WSMParameterValues:
Possible Issues (2)
Some initial values are calculated and cannot be changed by WSMSimulate:
No message is generated when setting a parameter with WSMInitialValues:
Use WSMParameterValues to set parameters: