dynVectorOperator

Performs arithmetic operations on a set of input dynVectors and stores the ouput in a single user-specifed dynVector using an expression evaluator. The expression evaluator recognizes time t, along with the current timestep dt. The expression evaluator checks the user supplied expression for validity and errors on finding undefined expressions.

The dynVectorOperator accepts the following parameters, in addition to those required by Updater:

Data

in (string vector, required)
Input 1 to N are input dynVectors which will be supplied to the expression evaluator.
out (string vector, required)
Output is a dynVector which will contain the evaluation.

Parameters

indVars_inName (string vector, required)
For each input variable an indVars string vector must be defined. So if in = [charge, current] where charge and current are each 1-component dynVectors then the dynVectorOperator block must define indVars_charge = [“Q”] and indVars_current = [“I”]. Note that the labels “Q” and “I” are arbitrary; the requirement is that there is a unique name for each component of each input data structure.
exprs (string vector, required)
Strings must be put in quotes. The strings are evaluated and placed in the output array. The number of strings must be identical to the number of components in the output array. Available command are defined by the muParser (http://muparser.sourceforge.net/)
preExprs (string vector, optional)
Strings must be put in quotes. The preExprs is used to compute quantities based on indVars that can later be used in the exprs to evaluate the output. Available commands are defined by the muParser (http://muparser.sourceforge.net)
other (strings, optional)
In addition, an arbitrary number of constants can be defined that can then be used in evaluating expression in both preExprs and exprs.

Example

The following code block demonstrates the use of a dynVectorOperator to compute update the current associated with the flow of charge. Two input dynVectors (charge and current) are combined in an exprs and the output is stored in a dynVector (current). Note that a dynVector can be both an input data structure and and output data structure for this updater.

<Updater integrateCurrent>
  kind = dynVectorOperator
  in = [charge, current]
  out = [current]

  indVars_charge = ["Q"]
  indVars_current = ["I"]
  C = CAPACITANCE
  bgL = L0

  exprs = ["I-dt*(1.0/bgL)*(Q/C)"]
</Updater>