Electrical – how to control duty cycle of a MOSFET using PI controller

battery-chargingcontroldc/dc converterduty cyclepid controller

I have designed a buck boost converter, how can I use a PI controller which will automatically change the duty cycle of the mosfet as per my desired output voltage or current?
I have been fidgeting with the PID controller in simulink and have found a way to get my desired load current.I have used a signal generator to produce a square wave which is compared with the actual load current(which is negative and I'm using a negative feedback so it becomes positive, what?) and a Proportional controller of gain=5,I=D=0, the output of which is given to gate. I came to the conclusion that the load current is always equal to the amplitude of the square wave so can we can control it by changing amplitude of the square wave. Is this method credible? Honestly I don't really understand what's going on. Please take a look at the second picture

Buck Boost revised

Converter Control

Best Answer

It is not easy to explain the whole thing in a simple post like in here. First-off, power supply designers rarely speak about PID coefficients but talk about poles and zeros placement. There are bridges between the two but as a power designer, I am more at ease to place a compensation zero than tweaking a D coefficient : ) Second, before attempting to stabilize anything, you need to characterize the dynamic response of your power stage (a voltage-mode buck-boost converter in your case). This is truly the starting point. That is, what transfer function \$H(s)\$ links my output variable (\$V_{out}\$ or \$I_{out}\$) to my control variable? This is expressed as \$H(s)=\frac{V_{out}(s)}{V_{err}(s)}\$ in which \$V_{err}(s)\$ is the voltage delivered by the compensation block (an op amp or your PID output whose transfer function is designated as \$G(s)\$). By adjusting \$V_{err}(s)\$ you have a means to adjust the output variable. However, as you control your series MOSFET through a duty ratio \$D\$ which is defined as \$D=\frac{t_{on}}{T_{sw}}\$, you need another block to convert the error voltage into a duty ratio. That block is called a pulse width modulator (PWM) and is shown below

enter image description here

This is what is called a naturally-sampled modulator and considering a perfect comparator its small-signal gain is simply \$\frac{1}{V_p}\$. It works by comparing the dc voltage \$V_{err}\$ with a ramp (whose peak amplitude is \$V_p\$) and when both meet, the comparator toggles. By changing \$V_{err}\$ you change \$D\$. I believe you may find a block like this in Simulink (https://fr.mathworks.com/help/slcontrol/ug/models-with-pulse-width-modulation-pwm-signals.html?requestedDomain=www.mathworks.com).

You can obtain your power stage transfer function in many ways: analytical analysis, simulation with average models, bench experiments etc. but you need it before attempting to do anything. When you have it, you select a crossover frequency and calculate the pole-zero placement (or the PID coefficients) in the compensation block \$G(s)\$ to shape the loop gain \$H(s)G(s)\$ and build the desired phase and gain margins. That sounds complicated but it's not : )

Please have a look at a seminar I taught at APEC a while ago which describes the link between PID and poles/zeros and gives a lot of compensation examples: http://cbasso.pagesperso-orange.fr/Downloads/PPTs/Chris%20Basso%20APEC%20seminar%202012.pdf. You will also find numerous other seminars on small-signal analysis and power stage characterization here http://cbasso.pagesperso-orange.fr/Spice.htm. Good luck with your circuit!

Related Topic