
Equations
142
2005 ACR Systems Inc.
7.9 APPENDIX B Compound Line Equations
7.9.1 Compound Line Equation Language
Compound line equations in
use the VB.Net language. Therefore,
any code in an equation must be compliant with the syntax of VB.Net. Although the equation
script is VB.Net compliant, you cannot use all VB.Net methods and functions because some
method related references may not be added to the equation project. Currently, all equation
references imported, so any functionality
and definitions under these two references can be implemented. For detailed information
please refer to VB.Net documentation.
The code for compound line equations and regular equations is very similar. See
APPENDIX A Equation Language
for more details on regular equations. The main difference
between the two is the use of public variables and objects.
The public variables available in compound line equations are: SOURCE0, ..., SOURCE9, and
ANSWER0, ..., ANSWER9. Whereas the SOURCE variables represent properties such as
sample rate, calibration values, and compensation values for regular equations, in compound
line equations they are used to input data into the equation. For example, to calculate watts,
you need voltage, current, and power factor correction. In your equation, you could use
SOURCE0 to represent voltage, SOURCE1 for current, and SOURCE2 for power factor
correction. When you add the compound line equation in your graph, you would be asked to
enter values for SOURCE0, SOURCE1, and SOURCE2. You would select which logger
channel corresponds to SOURCE0 and SOURCE1 and possibly enter a constant for
SOURCE2. You can associate a logger channel or a constant to a SOURCE variable.
ANSWER0 is used the same as for regular equations: to store the result of the equation. The
variables ANSWER1 to ANSWER9 are channel level variables you can use that are persistent
during the whole life cycle of the logger, such as for time accumulation type equations.
An object is a software entity which can be used in equations. An object includes properties
and methods which can be invoked by equations. For compound line equations, you only
have access to the Logger object, which is a software representation of the physical logger.
The only property associated with the Logger available for compound line equations is the
sample rate, stored as type Double, Logger.SampleRate (in seconds).
An example of a compound line to calculate total Watt Hours is shown below:
'SOURCE0=voltage, SOURCE1=current, SOURCE2=power factor correction
Watts=SOURCE0*SOURCE1*SOURCE2
Hours=Logger.SampleRate/(60*60)
ANSWER1=Watts*Hours + ANSWER1
'Accumulate Watt Hours over time
Comentários a estes Manuais