SiteView supports custom equations that allow raw logger measurements to be converted into meaningful engineering units.
A custom equation can be used when a sensor or transducer produces an electrical output such as:
and that electrical signal must be converted into a physical value such as:
SiteView custom equations use C#-style function syntax. Each equation receives an input value, performs the required calculation, and returns the converted result.
A simple custom equation looks like this:
public double CO2Equation(double Input)
{
double output;
output = (5000.0 / 10.0) * Input;
return output;
}This equation converts a 0–10 VDC signal into a 0–5000 ppm CO₂ measurement.
The equation name is:
CO2EquationThe function receives one parameter:
Inputand returns the converted engineering value.
For this example:
The relationship is linear:
CO₂ = 500 × Input Voltage
Each custom equation must have a unique function name.
For example:
public double CO2Equation(double Input)The current SiteView equation format allows an equation name of up to 16 characters.
Choose names that clearly describe the conversion, such as:
Pressure1000
CO2Equation
Humidity
FlowRate
TempConvertInput is the measurement value supplied by SiteView to the custom equation.
For a basic equation, Input represents the measurement after the logger has converted its digital reading into the selected channel's electrical unit.
For example, if the channel is configured as 0–10 VDC, Input will normally represent a value in the 0–10 V range.
The custom equation then converts that electrical measurement into the required engineering value.
A CO₂ transmitter has:
The transmitter is connected to a logger channel configured for 0–10 VDC.
The custom equation converts:
| Input | Converted Value |
|---|---|
| 0 V | 0 ppm |
| 2 V | 1000 ppm |
| 5 V | 2500 ppm |
| 8 V | 4000 ppm |
| 10 V | 5000 ppm |
Every custom equation must return a value.
For example:
return output;The returned value becomes the converted channel reading displayed and recorded by SiteView.
Many sensors and transmitters use a linear relationship between electrical output and physical measurement.
Examples include:
For these sensors, the general conversion is:
Output =
(OutputSpan / InputSpan)
× (Input - InputMinimum)
+ OutputMinimumA more general form is:
Y = ((Ymax - Ymin) / (Xmax - Xmin))
× (X - Xmin)
+ Yminwhere:
X = measured electrical inputXmin = minimum electrical inputXmax = maximum electrical inputYmin = minimum engineering valueYmax = maximum engineering valuepublic double CO2Equation(double Input)
{
return (5000.0 / 10.0) * Input;
}For a pressure transmitter with:
the equation is:
public double Pressure(double Input)
{
return ((Input - 1.0) / 4.0) * 1000.0;
}For a temperature transmitter with:
the measurement span is:
850 - (-200) = 1050°Cand the current span is:
20 - 4 = 16 mAThe custom equation becomes:
public double TempConvert(double Input)
{
return ((Input - 4.0) / 16.0) * 1050.0 - 200.0;
}This type of calculation is useful for transmitters that convert a physical measurement into a standard industrial signal.
The following examples can be used as starting points for your own SiteView equations:
1–5 V output representing 0–1000 PSI
Use with a compatible voltage-input channel.
0–4 V output representing 0–25% oxygen
Use with a compatible voltage-input channel.
0.9–4.1 V output representing 0–100% RH
Use with a compatible voltage-input channel.
4–20 mA output representing −200°C to +850°C
Use with a compatible 4–20 mA input channel.
SiteView custom equations can also be used for calculations that go beyond simple engineering-unit conversion.
Current examples include:
These equations can be used as code examples for more advanced processing and derived measurements.
An advanced equation can calculate a moving average using several previous measurements.
This is useful when:
The existing example calculates the average of the previous five samples.
This type of equation can calculate an average over a longer time period rather than a fixed number of individual samples.
It can be useful for:
The current equation library includes an example based on the previous hour.
A custom equation can combine compatible measurements to calculate electrical power.
A typical relationship is:
Power = Voltage × CurrentThe exact implementation depends on how the input channels and equation functions are configured.
Energy can be derived from power over time.
A typical relationship is:
Energy = Power × TimeSiteView's existing advanced-equation examples include both Power Consumption and Energy Consumption calculations.
A practical workflow is:
For a pressure transmitter:
Electrical Output: 1–5 V
Pressure Range: 0–1000 PSIVerify at several points:
1 V → 0 PSI
2 V → 250 PSI
3 V → 500 PSI
4 V → 750 PSI
5 V → 1000 PSIChecking multiple points helps confirm that the equation and channel configuration are correct.
Before creating an equation, verify:
A custom equation converts the logger's measured value. It does not correct an incorrect sensor connection, input range, or power-supply configuration.
If you are not sure how to convert your sensor output, provide Microedge Instruments with: