soloam / ha-pid-controller

PID Controller to Home Assistant
MIT License
97 stars 12 forks source link

Calibration of a PID (need explanation) #41

Open LeoI5 opened 1 year ago

LeoI5 commented 1 year ago

Thanks for project! And could You explain yours recommendation for Calibration of a PID. My setting: Set point: 5 C p|i|d variables is zero The peak temperature: 9 С The time that it took since it crossed the set point until it reached the peak: 800 seconds According recommendation the setting should be: Kp=8 Ki=1600 I'm afraid that 1600 is too big for Ki. Please dispel my doubts/misunderstandings

0rphu commented 1 year ago

Hello, I'm by no means an expert, but your hunch seems right. 1600 is a huge Ki. I'm not familiar with the heuristic used in the readme, but you can find a good descriptions of Ziegler Nichols on the net. One of them here: https://eng.libretexts.org/Bookshelves/Industrial_and_Systems_Engineering/Chemical_Process_Dynamics_and_Controls_(Woolf)/09%3A_Proportional-Integral-Derivative_(PID)_Control/9.03%3A_PID_Tuning_via_Classical_Methods Please note, the pid equation used is a bit different, using Kc, Ti and Td parameters. But looking at the equation, Kp=Kc, Ki=Kc/Ti, Kd=Kc*Td. There's a table in the article describing how to plug those numbers in. Using this method, I found (but not tested) the following values based on data from my boiler. Kp=5.88 (Ku/1.7; Ku being 10 which would roughly equal to an on/off thermostat with a deadband of 0.1 degrees) Ki=0.003 (Pu is 3600s in my case, that makes Ti 1800, Kd=2646 (Td = Pu/8) I can't guarantee I didn't make a mistake or that I did not misunderstand the equations altogether. But the numbers look more like it.

HTH

martin3000 commented 8 months ago

Maybe the values depend on the sample time? If you have a sample time of 60s, then the Ki should be 800*2/60=26 Just guessing....