Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling NaN values #92

Open
ioneater opened this issue Jan 13, 2025 · 0 comments
Open

Handling NaN values #92

ioneater opened this issue Jan 13, 2025 · 0 comments

Comments

@ioneater
Copy link

I control a heater voltage based on a temperature reading.
The temperature reading may be NaN if there is a communication issue or if the communication is initialized.
I can off course check for that and only call pid if it is not NaN but it may be good to have a general solution for what happens in this case.
In my case it caused the Integral value to be NaN as well and it did not recover from that.
It was returning NaN which caused the heater to run at full power.

Suggestions:

  1. If the input is NaN it should be ignored and not affect the values of the components.
  2. If the input is NaN a warning should be printed independent of the return value.
  3. pid should never return NaN as this can have unpredictable consequences.
  4. What should be returned when the input is NaN I am not sure. Maybe the minimum allowed value or an additionally defined "save/neutral output value".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant