stuartpittaway / diyBMSv4ESP32

diyBMS v4 code for the ESP32 and new controller hardware
Other
181 stars 80 forks source link

Cell under temperature external rule hysterisis not working #272

Closed delboy711 closed 8 months ago

delboy711 commented 8 months ago

Today for the first time temperatures dropped low enough to activate my cell under temperature(external) rule which closes a relay to activate a warming pad I have placed between my rows of cells. That worked perfectly (at 5 deg) and my cells warmed up nicely, but the relay failed to switch off when the cells reached the hysteresis temperature of 9 degrees. By the time I noticed the cells were at 18 degrees.

Looking at the code to see why this might have happened I found the relevant code in Rules.cpp in function RunRules()

        // Doesn't cater for negative temperatures on rule (int8 vs uint32)
        if ((lowestExternalTemp < value[Rule::ModuleUnderTemperatureExternal]) && ruleOutcome(Rule::ModuleUnderTemperatureExternal) == false)
        {
            // Rule Individual cell UNDER temperature (external probe)
            setRuleStatus(Rule::ModuleUnderTemperatureExternal, true);
        }
        else if ((lowestExternalTemp > hysteresisvalue[Rule::ModuleUnderTemperatureExternal]) && ruleOutcome(Rule::ModuleUnderTemperatureExternal) == true)
        {
            // Rule Individual cell UNDER temperature (external probe) - HYSTERESIS RESET
            setRuleStatus(Rule::ModuleUnderTemperatureExternal, false);
        }

I do not see anything wrong with this code but wonder if the 'else' is really necessary, and somehow the second 'if' block is not being executed to cancel the hysteresis.

stuartpittaway commented 8 months ago

By the time I noticed the cells were at 18 degrees.

What was the "LOWEST EXTERNAL TEMP" - as the controller uses the lowest temperature across all the cells in the system. What cell modules are you using?

If you take a look at the history page, it should show the temperature around the time you had this problem.

delboy711 commented 8 months ago

The lowest external temp of my cells was 18 deg

BUT I still have not got around to upgrading the firmware on my AllInOne board so the AllInOne on board temp sensor was showing up as an external sensor instead of an internal one. My bad...

I shall update the firmware like I should have done months ago.

Sorry for wasting your time :-{