Hello,
i'm having problems with the control algorithm for a step up converter.
i have this project with consist i designing and buid a step up , and insted of using big capacitor to reduce the ripple after the rectification , we are asked to build a software (in C language, we are using a arduino for the taks) that when the Vout is lower than Vref it will increase the duty cicle and when Vout is higher it will drecrease the duty cile to mantain a stable output.
the ripple i have to compensate is aprox 10V at 100hz.
i've tryed the simples algorithms like
e=yr-y
u=Dref+Kp*e
but it didnt worked.
if anyone who have experience in this area could help me out i will be very gratefull
In attachement i send the code I wrote so far, with definition of timers, ADC readings, and serial port (the latter using the Arduino functions)

This is the power circuit.
after the rectifier and the capacitor e have aprox 5V ripple.
the reference voltage is 56V, so when i have 56 V at Vout i have 2.5V at the arduino adc.
i have 2 polypropylene capacitor ( 10u//22u) at the output to filter the high frequency riple.

I believe you will need some form of compensation in the feedback loop to cancel the resonance of the output inductor and capacitor, such as PID, to avoid oscillations at the resonant frequency.

Another way generate a stable system, besides a PID loop, is to use a Fuzzy Logic controller. It uses a series if IF-THEN-ELSE statements to control non-linear as well as linear feedback systems in an intuitive manner. It's generally easier to understand the operation of a digital Fuzzy Logic system and tweak it to obtain stable operation then it is a PID loop, which is derived from analog pole-zero feedback control theory.

Edit: Basically for Fuzzy Logic control you would add extra IF-THEN-ELSE statements to those suggested by mic3 to make the feedback sensitivity somewhat proportional to the error level between the desired output voltage and the actual output voltage. Thus, for example, if the error is large, you make a large correction to the PWM duty-cycle, and if the error is small, you make a small correction to the duty-cycle. The number of IF-THEN-ELSE statements required is largely determined by the output error and ripple you can tolerate and the required response speed of the system.

I'm using a 2kHz sample frequency. is that enough? i'm using this because if i increase this frequency too much im afraid that e get interference from de 40khz comutations ripple. the riple i want to compensate is at 100Hz.

I believe you will need some form of compensation in the feedback loop to cancel the resonance of the output inductor and capacitor, such as PID, to avoid oscillations at the resonant frequency.

Another way generate a stable system, besides a PID loop, is to use a Fuzzy Logic controller. It uses a series if IF-THEN-ELSE statements to control non-linear as well as linear feedback systems in an intuitive manner. It's generally easier to understand the operation of a digital Fuzzy Logic system and tweak it to obtain stable operation then it is a PID loop, which is derived from analog pole-zero feedback control theory.

Edit: Basically for Fuzzy Logic control you would add extra IF-THEN-ELSE statements to those suggested by mic3 to make the feedback sensitivity somewhat proportional to the error level between the desired output voltage and the actual output voltage. Thus, for example, if the error is large, you make a large correction to the PWM duty-cycle, and if the error is small, you make a small correction to the duty-cycle. The number of IF-THEN-ELSE statements required is largely determined by the output error and ripple you can tolerate and the required response speed of the system.

Click to expand...

If i understood correctly, the fuzzy logic will create something like diferent zones, for example, instead of having a fixed Kp ( or fixed d, since de Vin/Vout constantly change ) , i should devide the ripple into small parts and use the fuzzy logic to change the kp value for something more suitable according to the zone ?
but wouldn't this make the system slower?

You can start with Kp=1 and then increase it to decrease the error on Vout from the desired value.

If it opearates in DCM, then it is better you use the second way I posted for a start. Use it without any interrupt to see what happens.

Note that the proper way to do this is to use a PID or PD controller.

Click to expand...

Vin/Vout isnt a fixed vallue! is that a problem?
This is the simullation without any control from the Vin, Vout and Vin/Vout.
Maybe if i sample both Vin and Vout i can have more acuracy for that value! is it a good idea?

I believe you will need some form of compensation in the feedback loop to cancel the resonance of the output inductor and capacitor, such as PID, to avoid oscillations at the resonant frequency.

Another way generate a stable system, besides a PID loop, is to use a Fuzzy Logic controller. It uses a series if IF-THEN-ELSE statements to control non-linear as well as linear feedback systems in an intuitive manner. It's generally easier to understand the operation of a digital Fuzzy Logic system and tweak it to obtain stable operation then it is a PID loop, which is derived from analog pole-zero feedback control theory.

Edit: Basically for Fuzzy Logic control you would add extra IF-THEN-ELSE statements to those suggested by mic3 to make the feedback sensitivity somewhat proportional to the error level between the desired output voltage and the actual output voltage. Thus, for example, if the error is large, you make a large correction to the PWM duty-cycle, and if the error is small, you make a small correction to the duty-cycle. The number of IF-THEN-ELSE statements required is largely determined by the output error and ripple you can tolerate and the required response speed of the system.