-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
PID-Feature computes with outdated temperature values #17636
Labels
enhancement
Type - Enhancement that will be worked on
fixed
Result - The work on the issue has ended
Comments
arendst
added a commit
that referenced
this issue
Jan 7, 2023
arendst
added
enhancement
Type - Enhancement that will be worked on
fixed
Result - The work on the issue has ended
labels
Jan 7, 2023
Thx. |
Thanks for the effort |
14 tasks
Wintespe
referenced
this issue
Sep 20, 2024
#22162) * Refactor and fix PID sensor (PID_USE_LOCAL_SENSOR) read race condition Refactor PID since it was calling pid.tick willy-nilly upon demand from MQTT and the web instead of on a periodic basis (and was being called with time interval of 0 when those times lined up!). Refactor web/mqtt display because there was shared code (that code turned out to be misguided and belonged in Every_Second loop, but now we are also similar to 39 thermostat) Logging revealed that the vast majority of the time the sensor JSON was parsed to obtain current sensor data when using PID local sensor, it was failing to parse (and it would typically only work for a second around TELE_PERIOD, but even then, not reliably). This bug almost certainly affects xdrv_39_thermostat too, but using xsns_75_prometheus.ino as a template, we are able to update PV once per second, which allows us to be a lot more responsive. There is no danger of being "too responsive" because that's the point of PID, and the PID loop already scales feedback by interval between ticks. * Reduce logging of PID now that query side-effects removed * Comment out all new logging, but leave present for next debugger
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Type - Enhancement that will be worked on
fixed
Result - The work on the issue has ended
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
This problem report refers to the PID-feature implemented in xdrv_49_pid.ino.
The PID algorithm is called at the time intervals specified by the PID-command PidUpdateSecs. The temperature for the algorithm is updated by TelePeriod time slice.
If the time interval of TelePeriod is greater then the time interval from PidUpdateSecs the temperature value for the PID algorithm is outdated.
Code analysis
To run the PID algorithm, the function
is called.
The temperature for the algorithm is transmitted within the function
If the time interval of TelePeriod is greater then the time interval from PidUpdateSecs
the temperature value for the PID algorithm is outdated.
To fix the problem change:
to
by adding the line
if (Pid.run_pid_now == false) PIDShowSensor(); // set actual process value
That calls P IDShowSensor() if it wasn't triggered by PIDShowSensor() itself.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:TO REPRODUCE
Steps to reproduce the behavior:
na
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
The PID algorithm should not run with outdated temperature data.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
TelePeriod 300
PidUpdateSecs 1
The picture shows a time/temperature diagram of a step function (setpoint 25 ->30 °C) after the software fix.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: