Purpose: This knowledge base article will help you to configure unit conversion for your OPS interface. How do you know if your interface supports this feature? Look at the files where the interface is located. If you see a file called “unit_conversion.ini", then it probably does. If the file has not been changed, you should see the following text in the file when you open it:
Notice the file tells you the syntax of this file:
Sourceunit -> multiplication_factor -> targetunit
• Sourceunit is the units that appear in the source system.
• Multiplication_factor is the value to be multiplied to the value of the source value, in order get to the target unit but this is not always a straight multiplication, which we will discuss
• Targetunit is the units in OPS
Let’s look at a simple sample from the default file:
ppm -> 1000 -> ppb
The ppm is parts per million, and the ppb is parts per billion. 1000 ppm is the same as 1 ppb. Another way to read the line is: “I have a unit of ppm, how many ppm’s does it take to equal one ppb? So, 1000 ppm = 1 ppb. This gives you 'ppm -> 1000 -> ppb'."
Notice towards the bottom of our default unit_conversion.ini file we have conversion factors of -1 and -2. These are special cases for converting degrees Fahrenheit and Celsius. The -1 is used to convert Fahrenheit to Celsius (see Note 1), and -2 is just the opposite (see Note 2). Notice also that there are many occurrences. This is because the file must contain exact matches between the source system units and OPS units.
Let us set up a custom conversion. In our example, the source system stores Fahrenheit as ‘F’, and we want OPS to report Celsius. Our source system stores mg/l which is the same as ppm, and we want to total that value. In OPS we need to have ppb on our report so we need to convert mg/l to ppb. Here is what those two lines would look like:
F -> -1 -> degc
mg/l -> 1000 -> ppb
Now when the interface reads in values that have the units to the left, and the corresponding OPS variable has the units to the right, it will convert the value based on our conversion factor.
Note 1: The equation for factoring Fahrenheit to Celsius is: RESULT = (VALUE – 32) / 1.8
Note 2: The equation for factoring Celsius to Fahrenheit is: RESULT = (1.8 * VALUE) + 32