SiteView Custom Equations

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:

  • Voltage
  • Current
  • Pulse count
  • Other supported logger measurements

and that electrical signal must be converted into a physical value such as:

  • Pressure
  • Temperature
  • Relative humidity
  • CO₂ concentration
  • Flow
  • Power
  • Energy
  • Other engineering units

SiteView custom equations use C#-style function syntax. Each equation receives an input value, performs the required calculation, and returns the converted result.


Basic Equation Structure

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.

How It Works

The equation name is:

CO2Equation

The function receives one parameter:

Input

and returns the converted engineering value. 

For this example:

  • 0 V = 0 ppm CO₂
  • 5 V = 2500 ppm CO₂
  • 10 V = 5000 ppm CO₂

The relationship is linear:

CO₂ = 500 × Input Voltage


Equation Name

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
TempConvert

The Input Parameter

Input 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.

Example

A CO₂ transmitter has:

  • Output: 0–10 VDC
  • Measurement range: 0–5000 ppm

The transmitter is connected to a logger channel configured for 0–10 VDC.

The custom equation converts:

InputConverted Value
0 V0 ppm
2 V1000 ppm
5 V2500 ppm
8 V4000 ppm
10 V5000 ppm

Return Value

Every custom equation must return a value.

For example:

return output;

The returned value becomes the converted channel reading displayed and recorded by SiteView.


Linear Equations

Many sensors and transmitters use a linear relationship between electrical output and physical measurement.

Examples include:

  • 0–5 V
  • 0–10 V
  • 1–5 V
  • 4–20 mA

For these sensors, the general conversion is:

Output =
(OutputSpan / InputSpan)
× (Input - InputMinimum)
+ OutputMinimum

A more general form is:

Y = ((Ymax - Ymin) / (Xmax - Xmin))
    × (X - Xmin)
    + Ymin

where:

  • X = measured electrical input
  • Xmin = minimum electrical input
  • Xmax = maximum electrical input
  • Ymin = minimum engineering value
  • Ymax = maximum engineering value

Example: 0–10 V to 0–5000 ppm CO₂

public double CO2Equation(double Input)
{
    return (5000.0 / 10.0) * Input;
}

Example: 1–5 V to 0–1000 PSI

For a pressure transmitter with:

  • 1 V = 0 PSI
  • 5 V = 1000 PSI

the equation is:

public double Pressure(double Input)
{
    return ((Input - 1.0) / 4.0) * 1000.0;
}

Example: 4–20 mA to −200°C to +850°C

For a temperature transmitter with:

  • 4 mA = −200°C
  • 20 mA = +850°C

the measurement span is:

850 - (-200) = 1050°C

and the current span is:

20 - 4 = 16 mA

The 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.


Available Linear Equation Examples

The following examples can be used as starting points for your own SiteView equations:

Pressure Transducer

1–5 V output representing 0–1000 PSI

Use with a compatible voltage-input channel. 

Oxygen Sensor

0–4 V output representing 0–25% oxygen

Use with a compatible voltage-input channel. 

Relative Humidity Sensor

0.9–4.1 V output representing 0–100% RH

Use with a compatible voltage-input channel. 

Temperature Transmitter

4–20 mA output representing −200°C to +850°C

Use with a compatible 4–20 mA input channel. 


Advanced Equations

SiteView custom equations can also be used for calculations that go beyond simple engineering-unit conversion.

Current examples include:

  • Average of previous 5 samples
  • Average value of the previous hour
  • Power consumption
  • Energy consumption

These equations can be used as code examples for more advanced processing and derived measurements.


Average of Previous Samples

An advanced equation can calculate a moving average using several previous measurements.

This is useful when:

  • Sensor readings fluctuate
  • Short-term noise needs to be reduced
  • A smoother displayed value is preferred

The existing example calculates the average of the previous five samples. 


Average Value of Previous Hour

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:

  • Environmental monitoring
  • Process trending
  • Temperature averaging
  • Other slowly changing measurements

The current equation library includes an example based on the previous hour. 


Power Consumption

A custom equation can combine compatible measurements to calculate electrical power.

A typical relationship is:

Power = Voltage × Current

The exact implementation depends on how the input channels and equation functions are configured.


Energy Consumption

Energy can be derived from power over time.

A typical relationship is:

Energy = Power × Time

SiteView's existing advanced-equation examples include both Power Consumption and Energy Consumption calculations. 


Creating a Custom Equation

A practical workflow is:

  1. Identify the sensor's electrical output range.
  2. Identify the physical measurement range represented by that output.
  3. Configure the logger channel for the correct electrical input type.
  4. Create a SiteView custom equation to convert the input into engineering units.
  5. Apply the equation to the required channel.
  6. Verify the result using known sensor input values.

Example

For a pressure transmitter:

Electrical Output: 1–5 V
Pressure Range: 0–1000 PSI

Verify at several points:

1 V → 0 PSI
2 V → 250 PSI
3 V → 500 PSI
4 V → 750 PSI
5 V → 1000 PSI

Checking multiple points helps confirm that the equation and channel configuration are correct.


Important Considerations

Before creating an equation, verify:

  • The sensor output type
  • Minimum and maximum electrical output
  • Minimum and maximum engineering value
  • Correct logger channel type
  • Sensor polarity
  • Required sensor power supply
  • Whether excitation control is required
  • Sensor calibration information

A custom equation converts the logger's measured value. It does not correct an incorrect sensor connection, input range, or power-supply configuration.


Custom Equation Examples

Linear Equations

Advanced Equations


Need Help Creating an Equation?

If you are not sure how to convert your sensor output, provide Microedge Instruments with:

  • Sensor manufacturer and model
  • Sensor datasheet
  • Electrical output range
  • Measurement range
  • Microedge data logger model
  • Logger channel type