Hi out there in the openHAB world,
to increase the WAF (Wife acceptance factor) of my openHAB installation i realised a wish og my wife.
The airing of basements is not as easy as you thnik. If you do it wrong airing brings moisture in the basement, of which one would like to get rid of. Technically you should check that the air fromoutside the basement is able to absorb moisture. Depending on the temperature and humidity, the air is able to take more or less less moisture. In order to evaluate this we calculate the dew point of the air. On the Internet I found the note that the dew point of the outside air by 5 ° C should be lower than the dew point of the basement air. Is that the case openHAB sends my wife a notifcation that it is an optimal time to ventilate the basement and when the ventilation window is over she gets a hint too.
For this I have now built the appropriate Item and rules.
Sitemap:
Very simple. Just a group that displays if ventilation should start
Group item=gStatusVentilation visibility=[gStatusVentilation==CLOSED]
Items:
A Contact that refelcts if airing is permitted, You may use a switch as well
Group:Contact:OR(CLOSED, OPEN) gStatusVentilation "Lüftung optimal" <myVentilation>
Contact VCBSSupplyCellarVentilation "Vorratskeller: Lüftung [MAP(ventilation.map):%s]" <myVentilation> (gStatusVentilation)
Rules:First a lambda to calculate the dewpoint and then the rule that troggers the contact and send out a messageimport org.openhab.core.library.*
import org.openhab.core.items.*
import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import org.joda.time.*
import java.lang.Math.*
/* ------------------------------------------------------------------------------------------------------
*
* Berechnung des Taupunktes für eine gegebene Temperatur und Luftfeuchtigkeit
*
* Beschreibung:
* Die Luft ist ein Gemisch verschiedener Gase. Eines dieser Gase ist der Wasserdampf. Die Menge an
* Wasserdampf, die in der Luft enthalten sein kann, ist allerdings begrenzt. Je wärmer die Luft ist,
* desto mehr Wasserdampf kann in ihr enthalten sein.
*
* Die relative Luftfeuchtigkeit gibt an, wie viel Prozent des maximalen Wasserdampfgehaltes die Luft
* im Augenblick enthält. Da der maximale Wasserdampfgehalt mit steigender Temperatur ansteigt,
* fällt die relative Luftfeuchtigkeit mit steigender Temperatur (und umgekehrt).
*
* Die Taupunkttemperatur ist definiert als die Temperatur, bei der der aktuelle Wasserdampfgehalt in
* der Luft der maximale (100% relative Luftfeuchtigkeit) ist. Die Taupunkttemperatur ist damit eine von
* der aktuellen Temperatur unabhängige Größe. Eine Möglichkeit die Taupunkttemperatur zu messen
* ist das Abkühlen von Metall bis sich die Oberfläche mit Wasserdampf beschlägt. Dann ist die
* Temperatur des Metalls die Taupunkttemperatur.
*
* Es gibt keine exakte Formel zur Umrechnung der Taupunkttemperatur in die relative Luftfeuchtigkeit.
* Zur Erstellung des Taupunktrechners habe ich eine einfache Näherungsformel benutzt. Eine exakte
* Umrechnung ist nur mit experimentell ermittelten Tabellen möglich.
*
* Aus Temperatur und relativer Luftfeuchte bzw. Temperatur und Taupunkt lässt sich auch der
* absolute Feuchtegehalt der Luft in Gramm Wasserdampf pro Kubikmeter ausrechnen.
*
* Formeln:
* Die Grundlage der Berechnungen ist die Näherungsformel für den Sättigungsdampfdruck ( Gleichung 1 ),
* die sogenannte Magnusformel. Die relative Luftfeuchtigkeit ist definiert als das Verhältnis vom
* augenblicklichen Dampfdruck zum Sättigungsdampfdruck (umgeformte Gleichung 2). Bei der
* Taupunkttemperatur ist definitionsgemäß der Sättigungsdampfdruck gleich dem aktuellen Dampfdruck.
* Aus diesen beiden Definitionen folgt unmittelbar Gleichung 3, die Formel zur Berechnung der
* relativen Luftfeuchtigkeit aus der Taupunkttemperatur. Die 4. Gleichung beschreibt umgekehrt die
* Berechnung der Taupunkttemperatur aus der relativen Luftfeuchtigkeit und der aktuellen Temperatur.
* Diese 4. Gleichung ist im Grunde nichts anderes als die nach T aufgelöste 1. Gleichung , wobei für
* den Sättigungsdampfdruck der aktuelle Dampfdruck (und nicht der aktuelle Sättigungsdampfdruck)
* eingesetzt wird, so dass die Taupunkttemperatur und nicht die normale Temperatur als Ergebnis
* herauskommt. Aus der allgemeinen Gasgleichung ergibt sich die 5. Gleichung .
*
* Bezeichnungen:
* r = relative Luftfeuchte
* T = Temperatur in °C
* TK = Temperatur in Kelvin (TK = T + 273.15)
* TD = Taupunkttemperatur in °C
* DD = Dampfdruck in hPa
* SDD = Sättigungsdampfdruck in hPa
*
* Parameter:
* a = 7.5, b = 237.3 für T >= 0
* a = 7.6, b = 240.7 für T < 0 über Wasser (Taupunkt)
* a = 9.5, b = 265.5 für T < 0 über Eis (Frostpunkt)
*
* R* = 8314.3 J/(kmol*K) (universelle Gaskonstante)
* mw = 18.016 kg/kmol (Molekulargewicht des Wasserdampfes)
* AF = absolute Feuchte in g Wasserdampf pro m3 Luft
*
* Formeln:
* SDD(T) = 6.1078 * 10^((a*T)/(b+T))
* DD(r,T) = r/100 * SDD(T)
* r(T,TD) = 100 * SDD(TD) / SDD(T)
* TD(r,T) = b*v/(a-v) mit v(r,T) = log10(DD(r,T)/6.1078)
* AF(r,TK) = 10^5 * mw/R* * DD(r,T)/TK; AF(TD,TK) = 10^5 * mw/R* * SDD(TD)/TK
*
* Quelle: http://www.wetterochs.de/wetter/feuchte.html
*
* Danke an Stefan Ochs von www.wetterochs.de
*
* ------------------------------------------------------------------------------------------------------ */
val org.eclipse.xtext.xbase.lib.Functions$Function2 calculateDewPoint = [
double temperature, double humidity
|
var double a
var double b
var double SDD
var double DD
var double v
var double TD
if (temperature >= 0.0){ // T >= 0 °C
a = 7.5
b = 237.3
} else { // T < 0 °C über Wasser
a = 7.6
b = 240.7
}
SDD=(6.1078 * Math::pow(10.0, ((a*temperature)/(b+temperature)).doubleValue)).doubleValue
DD = (humidity/100*SDD).doubleValue
v = Math::log10((DD/6.107).doubleValue)
TD = ((b*v)/(a-v)).doubleValue
// Return Value is TD
TD
]
rule "Lüftung Vorratskeller"
when
Item CSBSSupplyCellarTemperature changed or
Item CSBSSupplyCellarHumidity changed or
Item CSGDOutsideTemperature changed or
Item CSGDOutsideHumidity changed or
System started
then
var double TDi
var double TDo
TDo = calculateDewPoint.apply((CSGDOutsideTemperature.state as DecimalType).doubleValue, (CSGDOutsideHumidity.state as DecimalType).doubleValue) as Double
TDi = calculateDewPoint.apply((CSBSSupplyCellarTemperature.state as DecimalType).doubleValue, (CSBSSupplyCellarHumidity.state as DecimalType).doubleValue) as Double
if ((TDo+5.0 <= TDi)&& (VCBSSupplyCellarVentilation.state == OPEN)) {
sendCommand(VCBSSupplyCellarVentilation, CLOSED)
// Send notification -> Airing possible
} else if ((TDo+3.0 > TDi)&& (VCBSSupplyCellarVentilation.state == CLOSED)){
sendCommand(VCBSSupplyCellarVentilation, OPEN)
// Send notification -> Stop Airing
} else {
sendCommand(VCBSSupplyCellarVentilation, OPEN)
}
end
Thats it for the moment. Any remarks and improvements are welcomeare welcome. Next topics are to rework humidex, the german hitzeindex and the summe simmer indexRegards and have funThomas