Programming - First steps
P.
59 of 349
Dew-point calculation
A calculator
Data type f32:
32-bit floating point number
log(a,b): Log
a
(b)
pow(x,y): x
y
The following example is less about automation tasks. At this point, we want only to show how
flexible calculating with variables is.
In a winter garden, the dew point temperature (TD) dependent on the humidity (r) and room
temperature (T) shall be calculated.
The necessary calculations for this purpose:
Denotations:
r = relative humidity
T = Temperature in °C
TD = dew-point temperature in °C
DD = vapor pressure in hPa
SDD = saturation vapor pressure in hPa
Parameters:
a = 7.5, b = 237.3 for Temperature >= 0
Formulas:
TD(r,T) = b*v / (a-v) with
v(r,T) = log10(DD(r,T)/ 6.1078
DD(r,T) = r/100 * SDD(T)
SDD(T) = 6.1078 * 10^((a*T) / (b+T))
The implementation is then:
a=7.5f32
b= 237.3f32
r=“SensorHumidity-1/0/2“
T=“SensorTemperature-1/0/3“
SDDT=6.1078f32 * pow(10f32,(a*T)/(b+T))
DDrT= r/100f32*SDDT
v=log(10f32,(DDrT/6.1078f32))
TD=b*v/(a-v)
You can use your Enertex
®
EibPC like a calculator - other mathematical functions can be found on
page 201.
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]