Integral

integral - Built-in derivative data type

Synopsis
class class_name { integral name [ unit ] ; } object class_name { name S(variable1)d(variable2); name S(variable1)dt; }

Description
The integral property automatically calculates the average integral of variable1 with respect to another variable2. If dt is used, the integral is with respect to the global clock. The value of the integral is updated whenever variable1 or variable2 changes. If dt is used, the value of the integral is updated after the object's clock is updated.

Both variables must have either double or complex underlying type. The multiplication is performed according to the usual mathematical rules for a product of double and complex values, as appropriate.

The units of the integral must be consistent the units obtained when multiplying variable1 by variable2. The conversion is performed automatically each time the integral value is updated. If either of the variables has no unit, then the integral cannot have a unit, and the values are simply multiplied.

Variables can be local to the object, in which case they are simply named. If a variable in another object is used, the name of the object must be prepended, as in object_name.variable.

Global variables may used provided the are of double or complex type. The syntax for a global variable is ::variable for core globals and module::variable for module globals.

Example
The following example maintains the integral of the random variable x with respect to time and names it Sx.

class example { random x[m]; integral Sx[m/s]; } object example { x "type:normal(0,1); refresh:1h"; Sx S(x)dt; object recorder { property "x,Sx"; interval -1; file example.csv; }; }