Set up design variables

A design variable is a value a study holds, searches or computes. Each one has one of three roles:

Role Meaning Who sets the value
Pinned Held at one value for the whole study You
Free Searched between bounds The driver
Linked Computed from other variables by an expression The study, at every point — not yet settable, see below

Name a variable

A variable is addressed <asset>.<entry>: the asset id from the project space, a dot, and the name of a varset entry in that scene. hull.span is the span entry of the scene added as hull. A variable that belongs to the study rather than to any scene uses the reserved asset id study, as in study.cruiseSpeed. An unqualified name is refused. A guess at which scene you meant would drive the wrong one and read like a modeling mistake.

Set one

{"task": "study.variable.set", "args": {"study": "s1", "variable": "hull.span",
  "role": "free", "min": 1.8, "max": 3.6, "steps": 18}}
{"task": "study.variable.set", "args": {"study": "s1", "variable": "study.liftToDrag",
  "role": "pinned", "value": 14}}
  • Steps are intervals. A free variable swept from 1.8 to 3.6 in 18 steps is evaluated at 19 points, because both ends are sampled.
  • Linked variables cannot be set through study.variable.set yet; the task refuses the role. When they arrive, a linked expression reads other variables by address, and a variable linked to itself, or a circle of linked variables, is refused: unlike a coupled pair of components, a circular definition has nothing to converge to.
  • Changing a pinned value keeps the study's results table. Adding a variable, or changing a role, starts a new one, because the study is now asking a different question. study.variable.set returns revisionChanged so you can tell which happened.

Where a variable is read

A variable does nothing until the model graph reads it: bind it to a component input. The study refuses a variable that nothing reads, and a graph that reads a variable the study does not declare.

The Variables section of the Study activity lists every variable with its role, and shows bounds only for the free ones.

Topics
howto construct study variables