Other Parts Discussed in Thread: UCD3138, CONTROLSUITE, C2000WARE
Hello everyone!
I want to change analog pwm uc... on tms320... I have a buck converter which need to regulate output current (not voltage!), so output capacitor is almost absent. I`m using LEM as a sensor. There is a load frequency of 500 Hz for example (can be changed since 0 till 5 KHz) commutating short circuit and R=5 Ohm.
Earlier there was an analog regulator, and it was faster. Magnitude of current overshoot was less in 3 times at least. I`m trying some way to increase tms320 speed. In a SLUA708 for ucd3138 there is a 2.2 "Firmware Implementation of PI Controller" and looks like there is an opportunity to change gains depending on error. F_pwm=50kHz (T=20us). I wrote some coarse code for trying in
interrupt void cpu_timer2_isr(void) - 5 us since start of a period every cycle:
diff = Adc_Vout1 - Vout_Ref_wInj;
if(diff > 900000)//about 1 A magnitude
{//
CpuTimer2.InterruptCount++;
Pgain = 4000;
Igain = 1;
CpuTimer2Regs.TCR.bit.TIE = 0;//stop timer2
if(CpuTimer2.InterruptCount > 5 && flag_trip == 0)//new gain should be not more than 5 times during short cirquit
{
Pgain = 2500;//
Igain = 80;
CpuTimer2.InterruptCount = 0;
flag_trip = 1;
}
}
if(diff <= 900000)//if error less than 1 A, we use small gain
{
flag_trip = 0;
Pgain = 2500;
Igain = 80;
CpuTimer2.InterruptCount = 0;
}
That works much worse than just 2500 or 4000 because of oscillations. You ask: why don`t you use Pgain = 4000 since the beginning! I`ll say that there are oscillations too. There is a such a dependence: big gain - oscillations and unstable system, small gain - big overshoot. This is ususal and logical.
Can anyone give me some fragment of working source code (I can`t find for ucd3138 PWR026 PFC EVM source code)? Is there any sence in such an approach for tms320? Would anyone offer some approach for such a load mode? Maybe it`s impossible to get the same result as for analog controller, but I want to reach it as close as possible.
Will be very appreciate for any help!