Create An Auto Pid Tuning Algorithm
- Jan 13, 2015 You don't want to manually tune the PID gains of your motor controller anymore? Well, use genetic algorithms! To fully understand 'how does genetic algorithms work?' , I decided to build a small demonstrator/simulator of an auto-tuned PID controller using a genetic algorithm.
- Oct 01, 2006 John “Zeke” Ziegler and Nathaniel Nichols may not have invented the proportional-integral-derivative (PID) controller, but their famous loop tuning techniques helped make the PID algorithm the most popular of all feedback control strategies used in industrial applications.
- The MathWorks algorithm for tuning PID controllers helps you meet these objectives by automatically tuning the PID gains to balance performance (response time) and robustness (stability margins). By default, the algorithm chooses a crossover frequency (loop bandwidth) based upon the plant dynamics, and designs for a target phase margin of 60°.
- Genetic: enable the user to control the genetic algorithm parameters such as: input: value of the input applied on the system. Min/max Kx: boundary values of each PID action. Evaluation time: system running time when evaluating fitness. Population size: size of the genetic algorithm's population.
- The distinguishing feature of the PID controller is the ability to use the three control terms of proportional, integral and derivative influence on the controller output to apply accurate and optimal control. The block diagram on the right shows the principles of how these terms are generated and applied.
- Create An Auto Pid Tuning Algorithm Download
- Pid Tuning Software
- Genetic Algorithm Pid Tuning
- Pid Tuning Methods
Genetic Algorithm & Ziegler-Nichols Tuning Criteria. Tuning methods for PID controllers are very important for the process industries. Traditional methods such as Ziegler-Nichols method often do not provide adequate tuning. Genetic Algorithm (GA) as an intelligent approach has also been widely used to tune the parameters of PID.
A self-tuning PID demonstration GPL software using genetic algorithm.
Demonstration video here : https://www.youtube.com/watch?v=cK6kWN9K_do
Explanation here : https://kevinjoly25.wordpress.com/2015/01/13/pid-controller-auto-tuning-using-genetic-algorithm/
- Qt4
$ mkdir build
$ cd build
$ cmake .
$ make
No install method has been provided yet. However, you can run the software from the build directory:$ ./pid-autotune
There is 4 dock widgets in this software:
- Motor: enable the user to choose a motor to use and test it in closed on opened loop.
- Controller : enable the user to choose a controller to use with the motor (check 'Use controller'). The controller parameters can be set in this widget for test purpose.
- Graph settings : enable the user to change the axes scale by setting the min and max to be displayed.
- Genetic : enable the user to control the genetic algorithm parameters such as:
- input : value of the input applied on the system.
- min/max Kx : boundary values of each PID action.
- Evaluation time : system running time when evaluating fitness.
- Population size : size of the genetic algorithm's population.
- Mutation ratio : probability to mutate the offspring's variable.
- Crossover ratio : probability to crossover two parents.
- Overshoot penalty : ratio which multiply the error when an overshoot occurs. If you don't want any overshoot, set this to the maximum.
- Elite num : Number of best parents kept in the next generation of population.The start button launch the genetic process. Pause stop the process, press start to launch it again without any loss. Reset enable the user to generate a new random population by deleting the old one.
Example
- Under 'Motor' : choose the DummyMotor.
- Under 'Graph settings' : set xMax to 0.1 and yMax to 2.0.
- Under 'Genetic' : set maxKp to 1.0, maxKd to 2.0, maxKi to 0.1.
- Hit start button and enjoy the dance of a self-tuning PID! ;)
More on GAs..
The fitness function is using the sum of squarred error to evaluate the generated PID.Thanks to this fitness function, tournament selection can be used in order to select parents of the next PID population.The genetic algorithm implemented in Genetic.cpp uses arithmetic crossover and gaussian mutation to generate the new population.Elitism can be used.
Novation bass station 2 vst download. This software is using the GPL software QCustomPlot from Emanuel Eichhammer.
PID Tuning Algorithm
Typical PID tuning objectives include:
Create An Auto Pid Tuning Algorithm Download

Pid Tuning Software
Closed-loop stability — The closed-loop systemoutput remains bounded for bounded input.
Adequate performance — The closed-loop systemtracks reference changes and suppresses disturbances as rapidly aspossible. The larger the loop bandwidth (the frequency of unity open-loopgain), the faster the controller responds to changes in the referenceor disturbances in the loop.
Adequate robustness — The loop design has enoughgain margin and phase margin to allow for modeling errors or variationsin system dynamics.
MathWorks® algorithm for tuning PID controllersmeets these objectives by tuning the PID gains to achieve a good balancebetween performance and robustness. By default, the algorithm choosesa crossover frequency (loop bandwidth) based on the plant dynamics,and designs for a target phase margin of 60°. When you interactivelychange the response time, bandwidth, transient response, or phasemargin using the PID Tuner interface, the algorithm computesnew PID gains.
Genetic Algorithm Pid Tuning
For a given robustness (minimum phase margin), the tuning algorithmchooses a controller design that balances the two measures of performance,reference tracking and disturbance rejection. You can change the designfocus to favor one of these performance measures. To do so, use the DesignFocus
option of pidtune
atthe command line or the Options dialogbox in PID Tuner.
Pid Tuning Methods
When you change the design focus, the algorithm attempts toadjust the gains to favor either reference tracking or disturbancerejection, while achieving the same minimum phase margin. The moretunable parameters there are in the system, the more likely it isthat the PID algorithm can achieve the desired design focus withoutsacrificing robustness. For example, setting the design focus is morelikely to be effective for PID controllers than for P or PI controllers.In all cases, fine-tuning the performance of the system depends stronglyon the properties of your plant. For some plants, changing the designfocus has little or no effect.