Sometimes it is necessary to perform simple continuous conversions of values, and the Scheduler Worksheet of InduSoft Web Studio can do this conversion simply and easily with very little overhead. Here is an example of converting a Read tag containing either a Fahrenheit or Celsius value and converting it to the other or to a Kelvin value.
The correct conversion for Fahrenheit° from Celsius° is: (x°C * (9°F / 5°C)) + 32. (9 degrees F per 5 degrees C plus 32).
It is usually best to use whole numbers in each expression so that rounding and decimal point errors do not occur, (especially if many conversion calculations are performed sequentially, as in a script).
Here are some example conversions:
10° » (10*9/5) + 32 = 50°F
2°C » (2*9/5) + 32 = 35.6°F
0°C » (0*9/5) + 32 = 32°F
-2°C » (-2*9/5) + 32 = 28.4°F
-10°C » (-10*9/5) + 32 = 14°F
Reversing the conversion for Celsius° from Fahrenheit° is (x°F -32) * (5°C / 9°F) (Fahrenheit degrees minus 32 then times 5 degrees Celsius per 9 degrees Fahrenheit):
-10°F » (-10-32) * 5/9 = -23.3°C
0°F » (0-32) * 5/9 = -17.7°C
32°F » (32-32) * 5/9 = 0°C
68°F » (68-32) * 5/9 = 20°C
Conversion to Kelvin from Celsius° is a simple matter of adding 273.15 to the C°value.
An easy way to handle this continuous conversion for a temperature tag that is changing is to use a Scheduler Worksheet, putting the read tag as the trigger for a change event. There is not much overhead in these simple conversions and every time the Scheduler Task is updated, the conversion will take place if the read value has changed.
When you create the tags in InduSoft Web Studio, be sure to put corresponding default values in them, initialize them at startup, or add a script with error handling until the first read tag change trigger is processed.