Equations

A custom equation is a piece of script that user can create to implement the physical measurement conversion. SiteView uses .Net C# language as the script. The script or the source code is in the format of function call.

A function specifies the name of the function, the types and number of parameters it expects to receive, and its return type. The body of the function implements the conversion from one unit measurement to another. A simple custom equation looks like this:

public double CO2Equation(double Input)
{  
    double output;
    output = (5000 / 10 ) * Input ;
    return output;
}

The above equation has the name “CO2Equation”. The name must be unique and with maximum of 16 characters.

The function has one parameter named Input.  This value is read-only and it is the result of the caller function or the conversion from digital value to the unit measurement for that channel type if there is no caller function. In the latter case, Input refers to a value within the range of 0 – 10 volt for a 0 – 10 VDC channel type.

The function must return a value, which is the result of the conversion.

 The above equation is illustrated below. It indicates that for the input range 0 – 10, the output is proportional to the range of 0 – 5000. For instance, A CO2 transducer has output of 0 – 10 VDC representing 0 – 5000 PPM of CO2. The transducer is connected to the 0 – 10 VDC channel of the logger. When the transducer outputs 0 Volt, the physical measurement should be 0 PPM of CO2. When the transducer outputs 10Volt, the physical measurement should be 5000 PPM of CO2. When you apply the above equation to the channel you should get the correct conversion.


The followings are some of custom equations you can use as a code base for your own equations:

Linear Equations

Advanced Equations