Rule with formula seems to blow the rule engine

  • Platform information: OpenHab 2.5.6 on RPi 4

The following rule completely halts the loading & execution of all the other rules. I read couple comments about double parsing but even after 20 minutes, this rule is still hanging the whole openhab. Any suggestions?

/**
  https://weather.gc.ca/windchill/wind_chill_e.html
  https://rdrr.io/cran/frost/src/R/dewPoint.R
  **/


rule "Humidex Calculation"
    when Item DewPoint changed
then
    var temp = (GardenTemperature.state as Number).doubleValue
    var dewPoint = (DewPoint.state as Number).doubleValue
    var humidex = temp + 0.5555 * (6.11 * Math.exp((5417.753 * ((1/273.16) - (1/(273.15 + dewPoint))))) - 10)
    logInfo("humidex", "Current Temp:" + temp + " Dew:" + dewPoint + " Humidex:" + humidex)
    Humidex.postUpdate(humidex)
end

Looks related

Are your Items defined with UoM?

Incredible… indeed… breaking down the formula was sufficient to make the rule engine working again.

rule "Humidex Calculation"
    when Item DewPoint changed
then
    var temp = (GardenTemperature.state as Number).doubleValue
    var dewPoint = (DewPoint.state as Number).doubleValue
    var expValue = Math.exp((5417.753 * ((1/273.16) - (1/(273.15 + dewPoint)))))
    var humidex = temp + 0.5555 * (6.11 * expValue - 10)
    logInfo("humidex", "Current Temp:" + temp + " Dew:" + dewPoint + " Humidex:" + humidex)
    Humidex.postUpdate(humidex)
end
1 Like

Magical, isn’t it. Not so much the (old) rule engine, as the parser/interpreter getting mired in deeply nested maths brackets.

1 Like