Function Switch
Use the Function Switch node () to switch between functions during a solver sweep. You add the functions as subnodes under the Function Switch node. The function switch acts essentially as a switch statement in a programming language; that is, it dynamically chooses one of its underlying branches depending on a parameter that can be controlled from the solvers using a Function Sweep study.
In addition to the Label, you can also enter a name for the switch in the Function name field (default: sw1). Use that function name where you want to switch across the functions under the Switch node using a function sweep. Without a sweep, the function name for the switch uses the first function node under the Switch node by default.
The parameter name used by Function Sweep studies is constructed based on the name of the Switch node, prepending the special namespace funsw. For example, the parameter controlling a Switch node on the global level will typically be funsw.sw1, while for a component-level Switch it will be funsw.comp1.sw1.
During a function sweep, the sweep parameter takes consecutive integer values, starting from one, indicating which function under the switch that should currently define the function values. You can use the parameter name in conditional expressions to control also other aspects of the model. Conversely, it is possible to control a function Switch also by manually defining the full switch parameter name in a Parameters node. You can then choose the parameter to sweep over in a standard Parametric Sweep node or assign it different (integer) values in different parameter Case nodes and sweep using a Parameter switch sweep.
When sweeping over functions defined under a Function Switch node, make sure that the functions have the same unit. If the units differ (including some function that assumes dimensionless units) a Warning subnode, informing you about the inconsistent unit settings, will appear under the Compile Equations node in the solver configuration,