Hi,
I am new to openhab and i am trying to do HVAC controller of raspberry pi b+. I have done some rules for a week now and today i hitted a wall.
My question is for advanced users is that how can i change negative value to positive value.
Rule example:
/// HVAC
rule "Lämmitys käyrä"
when
Item Netatmo_Outdoor_Temperature changed or
Item PatteriAsetusTmp changed
then
val asetuskayra = (Netatmo_Outdoor_Temperature.state as DecimalType) - 40
Lammitys_viesti.postUpdate(asetuskayra)
At this point if outside temperature is 10*C and i minus 40 it will be a negative value. I did this because i want to control water temperature linear with the outside temperature.
Thank you for answer that is useful information for me.
I have now added slope feature to the code and it looks like this:
/// HVAC
rule "Lämmitys käyrä"
when
Item Netatmo_Outdoor_Temperature changed or
Item PatteriAsetusTmp changed
then
//Changes outdoor celcius temp to kelvin
val UlkoTmpKelvin = (Netatmo_Outdoor_Temperature.state as DecimalType) + 273.15
//Setpoint value for water temp when outdoor temp is 20
var LattiaAsetusPlus20 = LattialammitysAsetusTmp.state as DecimalType
//Setpoint value for slope
var LattiaAsetusKerroin = LattiaAsetusKerroinSet.state as DecimalType
//Calculating Slope * 293.25 - Outdoor temperature
val LattiAsetusKerroinMuunnettu = (LattiaAsetusKerroin)*(293.15 - (UlkoTmpKelvin))
//Final calculating for water temperature which depending on outside temperature
val LattiaAsetuslampotila =(LattiaAsetusPlus20) + (LattiAsetusKerroinMuunnettu)
//Sends value to item
Lammitys_viesti.postUpdate(LattiaAsetuslampotila)
Is there any cons if i do calculating like this? Or is it always better youse math functions (didin’t find any documentation about math function).