# [SOLVED]Implementing a PID controller from a transfer function

Status
Not open for further replies.

#### metamisers

##### Junior Member level 1 Hello everyone, this is the boost circuit that I am trying to implement. It has an input of 11.1 volts with output of 20V and Output power of 60W. The switching frequency is 100kHz. The closed loop bode plot is shown below While designing the Type-3 controller in MATLAB, I chose the corner frequency as 2350Hz, phase margin of 45 degrees with a double pole resonance at 716 Hz. After designing the controller the following results were obtained Which is almost what I wanted. Now, after implementing the PID controller as shown in the first picture, this is the output voltage result. The simulation continues while the output voltage is increasing indefinately. About the reference voltage at the positive terminal of the OPAMP, since D = 0.445, hence my reference voltage should be 5x0.445 = 2.225 Volts. Is this correct? I can't figure out where the problem is in the circuit.
For the Boost converter, esr zero is at 19.9kHz, R.H.P. zero is at 8600 Hz, the double zeros of the PID compensator are at 500Hz, the first pole of the compensator is at 10.79 kHz and the 2nd pole is at half the switching frequency of 50 kHz. I chose the voltage divider ratio to be 0.1, hence 2 volts should appear at the negative terminal, but i am not sure what reference voltage should be selected. Any help will be greatly appreciated.

Zahid.

Solution
One thing is that the compensator is outputting 5.02 Volts which is above the op-amp maximum supply voltage, where as the sawtooth voltage has a maximum of 5 volts peak.
As expected, the control is switching the boost transistor permanently on, effectively shorting the input supply which mucst never happen. A real boost converter would implement overcurrent limiting which also limits the duty cycle.

I suggest to add a circuit that limits the duty cycle to e.g. 90%.

#### d123 Hi,

Am I misinderstanding something?

A quick calculation of 111.1/1,111.1 = 0.0999
20V * 0.0999 = 0.1999Vfeedback

That isn't 2.25V, the OA must be going crazy to match Vfeedback to Vref.

2.25Vref/20Vout = 0.1125

e.g. 1,330 * 0.1125 = 149 > 150R
1,330 - 150 = 1,180 > 1k + 180R

To cut a long story of repeat calculations short, that gets 2.255Vfeedback from 20Vout.

#### metamisers

##### Junior Member level 1 Hi,

Am I misinderstanding something?

A quick calculation of 111.1/1,111.1 = 0.0999
20V * 0.0999 = 0.1999Vfeedback

That isn't 2.25V, the OA must be going crazy to match Vfeedback to Vref.

2.25Vref/20Vout = 0.1125

e.g. 1,330 * 0.1125 = 149 > 150R
1,330 - 150 = 1,180 > 1k + 180R

To cut a long story of repeat calculations short, that gets 2.255Vfeedback from 20Vout.
20V * 0.0999 = 0.1999Vfeedback
It is not 0.1999 it's 1.999 around 2.0V,

Rest is as you mentioned, voltage division using resistors.

#### d123 Hi,

Whoops, you're right, my apologies. Not sure what happened with the calculator there first time around, thanks for the correction.

Even so, 2Vfeedback and 2.25Vref will make the OA try to match Vfeedback to Vref at inputs by attempting to increase Vout. But (2.25/2) * 20V is only 22.5V, which wouldn't explain the graph results that appear to be heading for 30V.

FWIW, when I was trying to make/exploring SEPICs, I was very unconvinced by my type III compensation calculations for different reasons, mostly hazy understanding of what to aim for, and saw similar results to yours - rising Vout beyond desired Vout, occasionally Vout was correct value and stable, and it was unpredictable (for me). I certainly can't answer your questions, but does stuff like changing load value make any difference?

#### FvM

##### Super Moderator
Staff member To avoid latch-up, the duty cycle must be clamped below 1. Not sure what's the voltage limit of the controller.

#### metamisers

##### Junior Member level 1 I changed the Rlower to 125.2 ohms, that way, when the output of the converter is 20 volts, the input to the positive of the Opamp terminal is 2.225 volts, since Vout = Vin/(1-D), it should boost the 11.1 volts to 20 volts. Increasing or decreasing the load didn't change anything, the simulation just keeps on running slowly. One thing is that the compensator is outputting 5.02 Volts which is above the op-amp maximum supply voltage, where as the sawtooth voltage has a maximum of 5 volts peak. Increasing the saw-tooth to 5.03 makes the output voltage of the converter go to zero. Can anybody else recommend any other easy program to simulate this circuit? I do not want to use LTSpice because there are too many non-idealities involved its library components.

#### FvM

##### Super Moderator
Staff member One thing is that the compensator is outputting 5.02 Volts which is above the op-amp maximum supply voltage, where as the sawtooth voltage has a maximum of 5 volts peak.
As expected, the control is switching the boost transistor permanently on, effectively shorting the input supply which mucst never happen. A real boost converter would implement overcurrent limiting which also limits the duty cycle.

I suggest to add a circuit that limits the duty cycle to e.g. 90%.

### d123

Points: 2

#### metamisers

##### Junior Member level 1 As expected, the control is switching the boost transistor permanently on, effectively shorting the input supply which mucst never happen. A real boost converter would implement overcurrent limiting which also limits the duty cycle.

I suggest to add a circuit that limits the duty cycle to e.g. 90%.
Ok added a limiter that reduces the duty cyc;e to98% and works as a charm, thanks for the help. These little things are the most bothersome ones I am marking this as solved! Thanks again!.

Status
Not open for further replies.