Virtual sensor for temperature difference problem **solved**
Posted: Thu Jul 24, 2014 3:36 pm
After a lot of trial and error, I think that I have created a virtual sensor for temperature difference. I have two Davis temperature sensors outside. One is in the ISS the other is a Temperature/Humidity station.
There is a math quirk that you cannot subtract the difference in Celsius, then convert to Fahrenheit. I discovered that I cannot make a T# virtual sensor, I could only use a "Data#" sensor. After resolving the math issue and converting each sensor to Fahrenheit with the standard formula and then subtracting the two, I was left with a difference that appears to be twice the actual.
As a hack, I divide the result by two which gives the desired result.
Here is the calculation for the two virtual sensors. I would appreciate any further understanding on why my results were twice that expected and what I might be doing wrong.
....(($2)*((9/5)--32)))/2) Note the /2 that I added.
The data8 sensor (th0/th1)
The data9 sensor (thb0/th0)
Greg
There is a math quirk that you cannot subtract the difference in Celsius, then convert to Fahrenheit. I discovered that I cannot make a T# virtual sensor, I could only use a "Data#" sensor. After resolving the math issue and converting each sensor to Fahrenheit with the standard formula and then subtracting the two, I was left with a difference that appears to be twice the actual.
As a hack, I divide the result by two which gives the desired result.
Here is the calculation for the two virtual sensors. I would appreciate any further understanding on why my results were twice that expected and what I might be doing wrong.
....(($2)*((9/5)--32)))/2) Note the /2 that I added.
The data8 sensor (th0/th1)
Code: Select all
selectmaster 1 300 | gawk '{ if ($1 == ''none'') printf ''none''; else printf ''%d'', (((($1)*((9/5)--32)) - (($2)*((9/5)--32)))/2)}'
Code: Select all
selectslave 1 300 | gawk '{ if ($1 == ''none'') printf ''none''; else printf ''%d'', (((($1)*((9/5)--32)) - (($2)*((9/5)--32)))/2)}'
Code: Select all
selectmaster 1 300 | gawk '{ if ($1 == ''none'') printf ''none''; else printf ''%d'', ((($1)*(((9/5)--32)) - (($2)*((9/5)--32)))/2)}'
Code: Select all
selectslave 1 300 | gawk '{ if ($1 == ''none'') printf ''none''; else printf ''%d'', (((($1)*((9/5)--32)) - (($2)*((9/5)--32)))/2)}'