Open bellabrez opened 2 years ago
I do not have something to comment about since I haven't run into something similar. But I can confirm that I have successfully run multiple PIDs in the same program (>5), for days. I use this library since its birth. I am very interested to learn the cause of your issue.
Just a few comments on your code:
In an Input was ever a nan, it will propagate through into Output and persist. You can check and protect against it in userspace before your compute step:
if(isnan(pidOutput)){
pidCont.setMode(MANUAL);
pidOutput = 0;
pidCont.setMode(AUTOMATIC); // bumpless reset of the PID internal values to match Output.
}
Full code is 20220308_my_working_kiln_more_logging_reduce_memory.zip but most relevant bits pasted here. I'm controlling a relay to heat a kiln, and it works perfectly for a few hours, but then after about 3 or 5 hrs Output (here variable is pidOutput) keeps being nan.
In variables section:
Setup run once:
Update loop:
updatePIDs basically just calls
pidCont.Compute();
Turn on heaters:
I've confirmed pidInput and pidSetPoint are behaving correctly. I'm using an Arduino Uno and am using 79% of program storage and 74% of dynamic memory (at 75% it says warning low memory, may cause stability issue) - not sure if being close to this limit could be my issue.
I've reproduced this issue about 5 times now, but once it did run the full ~10hr with no nans.
Thank you very much for your thoughts!