Home : Unit Conversion in OPS SQL interfaces
Q10403 - HOWTO: Unit Conversion in OPS SQL interfaces

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

 

 

Related Articles
No Related Articles Available.

Article Attachments
unit_conversion.ini

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 6/7/2007 9:52 AM.
Last Modified on 1/30/2008 10:48 AM.
Last Modified by No Author Name Available!.
Skill Level: Intermediate.
Article has been viewed 6233 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article