I am a student of electrical and computer engineering and am currently working on a project that involves the study of a multiphase buck converter or synchronous buck converter (2 phases, in my case).
The following table shows the parameters of the converter I'm building.
Parameter | Value | Unit |
---|---|---|
Input Voltage | 12 | V |
Output Voltage | 6 | V |
Inductor | 3.3 | mH |
Capacitor | 10 | uF |
Load Resistance | 20 | ohm |
Switching Frequency | 20 | kHz |
Therefore, in my project I'm using a closed-loop PI controller to control the output voltage. With the following Arduino code I obtain the desired output voltage but the current only flows through only one phase, instead of half in each 2 phases.
// Parâmetros globaisdouble Kp = 0.00825; // Ganho proporcionaldouble Ki = 50; // Ganho integraldouble t = 0.01; // T = 1/fsw = 1/20000 = 5*10^-5 s = 0.05 ms ; t = T/5 = 0.05/5 = 0.01 ms --> 5 amostrasunsigned long last_time;double proportional = 0.0;double integrator = 0.0; // Variável para armazenar o termo integral anteriordouble error_sum = 0.0; // Soma acumulada dos errosdouble last_error;double V;double Vo;double Vref = 5.0;double R1 = 30000.0; // Resistência do módulo do sensor de tensãodouble R2 = 7500.0; // Resistência do módulo do sensor de tensão// Limites do duty cycle PWMconst int dutyCycleMin = 20; // Duty cycle é máximo quando OCR1A é 20 = 399*0.05const int dutyCycleMax = 379; // Duty cycle é máximo quando OCR1A é 379 = 399*0.95void setup() { pinMode(9, OUTPUT); // Set the PWM pin as output pinMode(10, OUTPUT); // Set the PWM pin as output TCCR1A = _BV(COM1A1) | _BV(COM1A0) | _BV(COM1B1) | _BV(WGM11); // Set non-inverted mode for COM1A, inverted mode for COM1B TCCR1B = _BV(WGM13) | _BV(CS10); // Set Fast PWM mode with prescaler of 1 ICR1 = 399; // Set the TOP value for the PWM frequency (16MHz / (1 * 20000) - 1 = 399)}// Função para ler o valor da tensão à saída do conversordouble lerTensao() { double tensao = analogRead(A0); // leitura do pino analógico A0 V = tensao * (Vref / 1024); // Conversão da leitura da tensão Vo = (V / (R2/(R1 + R2))); // Multiplicar por 5 devido ao divisor de tensão do sensor return Vo;}// Função controlador PIvoid PI_control() { unsigned long current_time = millis(); int delta_time = current_time - last_time; if(delta_time >= t) { double setpoint = 6.0; double feedback = lerTensao(); double error = setpoint - feedback; // Cálculo do termo proporcional proportional = Kp * error; // Cálculo do termo integral error_sum += error; integrator = (Ki*t) * error_sum; // Cálculo do duty cycle do PWM int dutyCycle = round(proportional + integrator); // Restrição do duty cycle dentro dos limites permitidos if (dutyCycle > dutyCycleMax) { dutyCycle = dutyCycleMax; } else if (dutyCycle < dutyCycleMin) { dutyCycle = dutyCycleMin; } last_error = error; last_time = current_time; OCR1A = dutyCycle; OCR1B = dutyCycle; }}void loop() { PI_control();}
To obtain the parameters of the PI controller (Kp and Ki) I used an article where the same parameters are calculated but for a converter with one phase. I don't know if these values change for a two-phase converter.I don't know what I'm doing wrong so that the current only flows through one phase. If anyone can help me resolve this situation, I'd appreciate it.
José Alves