You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying a new usage for your simplePID package, this time dedicaced for EV charging thanks to an OpenEVSE module. The idea is to regulate the AC current value sent to the car (through the OpenEVSE) according to a DC battery current measure. For my particular application, input (DC battery current) can vary about - 40A up to 40A and the output (AC current sent) is between 6A up to 20A (for example)... So PID must be a function from [-40,40]ADC |---> [6,20]AAC
When I first tried with these setting, actually with just some Kp non-zero value (Kp=0.2, Ki=Kd=0) and setpoint = 0A, I noticed the regulation was not working, i.e. the output was always staying at 6A (the output_min value) whatever the error was largely positive.... I noticed a potential problem (or something I didn't understood) with the P,I,D contributions values:
The Icontribution whatever Ki = 0 converged to the output_min value.... here 6A... More assuming I momentanary set the output_min point to 7A, the Icontribution shift to 7... but if I revert back output_min to 6A, the Icontribution.... now slowly decreases from 7A to 6A (I guess according the Ki value)
See figure attached below
For me it's not normal... and would explain why the regulation don't "take off"...
Cheers,
Sébastien
BTW... it would be also nice if we can change the default device_class/icon of the output.. .coz for my application it's not percent but current device_class..
So since I set it the startup value to 6... I guess it's explaining everything... The problem actually I can't set it to 0 .... (since currently it must bound into [6,20]
Okay, that's what I would expect, since you have the minimum output at 6, the I has to be set to meet your output min.
If you really want to get to the basic functionality of the PID controller, zero-start is your starting point, and wind-up protection off.
Regarding the diagnostics, please use the 'download diagnostics' button of the integration (use the "..." behind te integration in the device overview)
By the way I tried without the windup option and start with zero... but as expected... the EV don't start to charge with such low value ...:(.... This line l99 in the original lib is my main concern ... :(
So, you error is roughly 40, which results in a p-contrib of roughly -8. But since you've limited the output to 6, it won't go any lower than 6. That's what would be expected.
The I contribution is set to the lowest value when at 0-start. It won't change if you have Ki at 0, so that means that the I contribution will always be stable. Using a small value for Ki will change this behavior.
Another option is to decrease your Kp, so it won't result in a correction lower than the minimal output you've set.
If I understand correctly you're using it to control a EV charge rate. Note that some older cars need a current of >8A to start (although the standard says 6A), and some chargers are also not very precise in their configuration. So I would start trying with some bigger numbers during your tests.
Activity
bvweerd commentedon Sep 18, 2025
Hi @SeByDocKy ,
Please add your diagnostics file to the issue, so I can understand your complete config.
SeByDocKy commentedon Sep 18, 2025
Ok I think I found a potential problem in the original simple-pid lib l99
So since I set it the startup value to 6... I guess it's explaining everything... The problem actually I can't set it to 0 .... (since currently it must bound into [6,20]
bvweerd commentedon Sep 18, 2025
You can change the way it starts with the select "PID Start Value" and let it start at 0 or at previous.
SeByDocKy commentedon Sep 18, 2025
It's what I did
bvweerd commentedon Sep 18, 2025
Okay, that's what I would expect, since you have the minimum output at 6, the I has to be set to meet your output min.
If you really want to get to the basic functionality of the PID controller, zero-start is your starting point, and wind-up protection off.
Regarding the diagnostics, please use the 'download diagnostics' button of the integration (use the "..." behind te integration in the device overview)
SeByDocKy commentedon Sep 18, 2025
config_entry-simple_pid_controller-01K4WPQGS1QGN3KD6QTXN9281J.json
SeByDocKy commentedon Sep 18, 2025
By the way I tried without the windup option and start with zero... but as expected... the EV don't start to charge with such low value ...:(.... This line l99 in the original lib is my main concern ... :(
bvweerd commentedon Sep 20, 2025
So, you error is roughly 40, which results in a p-contrib of roughly -8. But since you've limited the output to 6, it won't go any lower than 6. That's what would be expected.
The I contribution is set to the lowest value when at 0-start. It won't change if you have Ki at 0, so that means that the I contribution will always be stable. Using a small value for Ki will change this behavior.
Another option is to decrease your Kp, so it won't result in a correction lower than the minimal output you've set.
If I understand correctly you're using it to control a EV charge rate. Note that some older cars need a current of >8A to start (although the standard says 6A), and some chargers are also not very precise in their configuration. So I would start trying with some bigger numbers during your tests.
SeByDocKy commentedon Sep 20, 2025
I converged with some (Kp,Ki) values which are just fine.... Definitively was required a non-zero (but) small Ki value