https://vaclavkosar.com/ml/PID-controller-control-loop-mechanism Vaclav Kosar Vaclav Kosar's face photo Software And Machine Learning Blog * Blog * Youtube * Github * Email * LinkedIn * Donate PID Controller: A Simple Control Loop Mechanism Proportional-integral-derivative controller calculates feedback to reduce the error in the next step. PID Controller: A Simple Control Loop Mechanism When to use PID controller? * measured value (process variable) is a time series * ideal value (setpoint) is known * can correct via a feedback in the next steps * tuning (training) data is available * cannot model of the process * in non-linear systems may not work * example: cruise control + process variable = speed + setpoint = ideal speed + error = ideal speed - actual speed + feedback = gas pedal What is PID controller? * is sometimes called three-term controller * tool to stay close to the ideal (control loop mechanism) * uses distance from setpoint (error) to produce feedback + error = setpoint - process variable * defined as sum of 3 terms: + proportional term o current error o corrects for error in the previous step + integral term o sum of errors till now o corrects for error in the same direction in the past + derivative o current derivative of the error o can cause instability and not used often o or low pass filtering o corrects for sudden change in error * mathematical form: + error: \( e(t) \) + proportional coefficient: \( K_p \) + integral coefficient: \( K_i \) + derivative coefficient: \( K_d \) + time: \( t \) + feedback value (control function): \( u(t) \) + equation: \( u(t) = K_p e(t) + K_i \int_0^t e(t) dt + K_d \ frac{de(t)}{dt} \) Demo * grey dots represent setpoint + here: constantly zero * blue represents original process variable + uncontrolled process variable * red represents process variable after corrective feedback + here: process variable minus feedback * try changing the input function * Find the demo source below [ ] sine input function Kp: [ ] Kd: [ ] Ki: [ ] Extension * Self-tuning PID using Kalman filter + Kalman filter uses linear relationship between measured values + to estimate true values and uncertainty + in the paper relationship between the PID parameters defines the Kalman filter tuning Related Posts Constant 1D Kalman Filter Is Exponential Or Cumulative Average Demo Source Code [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] 21 May 2021 [ ] [ ] [Subscribe] By using our website you are consenting to our use of cookies in accordance with our cookie policy. Ok!