I use lambda, OH 3.3:
val heatIndex = [ Number TT, Number H |
val Number T = TT * 9/5 + 32
var Number HI = 0.0
if (T <= 40.0) {
HI = T
} else {
HI = -42.379 + 2.04901523*T + 10.14333127*H - 0.22475541*T*H - 0.00683783*T*T - 0.05481717*H*H + 0.00122874*T*T*H + 0.00085282*T*H*H - 0.00000199*T*T*H*H
if (H < 13 && T >= 80 && T <= 112) {
HI = HI - ((13-H)/4) * Math.sqrt(17-Math.abs(T.doubleValue-95)/17)
} else if (H > 85 && T >= 80 && T <= 87) {
HI = HI + ((H-85)/10) * ((87-T)/5)
} else if (T < 80){
HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (H*0.094))
}
}
Math.round(((HI - 32) * 5/9).floatValue*10.0)/10.0
]
rule "SENS ROOM FeelsLike"
when
Item roomSens_InWallTemp_R changed
then
roomSens_FeelsLikeTemp.postUpdate(heatIndex.apply(roomSens_InWallTemp_R.state as Number, roomSens_InWallHum.state as Number))
end