Unlimited speed when fmax<20 [SOLVED]
Posted: Mon Mar 11, 2019 2:14 am
In the old software revisions, fmax was being enforced on the motor by commanding zero slip beyond fmax. Johannes changed the fmax algorithm on software version 3.19. Now fmax is being enforced by lowering the voltage linearly when motor is running near fmax. It's like a ramp function, when frequency = fmax-20, software starts decreasing the amplitude, when frequency=fmax, amplitude is zero. The issue is, when you set fmax<20, some calculation error occurs due to the unsigned integer stuff and the motor spins up to +10000 RPM in only a few seconds very easily, especially if you are running the inverter with batteries, with no motor load.
To fix it, in the src/generic/fu.cpp file, I have added a (s32fp) casting to the line marked with **. I tested it and seems to be working, but we need Johannes' opinions on this.
To fix it, in the src/generic/fu.cpp file, I have added a (s32fp) casting to the line marked with **. I tested it and seems to be working, but we need Johannes' opinions on this.
Code: Select all
uint32_t MotorVoltage::GetAmpPerc(u32fp frq, u32fp perc)
{
uint32_t amp = FP_MUL(perc, (FP_TOINT(FP_MUL(fac, frq)) + boost)) / 100;
if (frq < minFrq)
{
amp = 0;
}
if (amp > maxAmp)
{
amp = maxAmp;
}
if ((s32fp)frq > (s32fp)(maxFrq - FRQ_DRT_STR)) // **
{
s32fp diff = maxFrq - frq;
diff = diff < 0 ? 0 : diff;
amp = FP_TOINT(FP_MUL(FP_FROMINT(amp), FP_DIV(diff, FRQ_DRT_STR)));
}
return amp;
}