Unlimited speed when fmax<20  [SOLVED]

Post Reply
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Unlimited speed when fmax<20  [SOLVED]

Post by nailgg »

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.

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;
}
User avatar
johu
Site Admin
Posts: 7182
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 552 times
Been thanked: 1913 times
Contact:

Re: Unlimited speed when fmax<20

Post by johu »

Indeed. In addition maybe the range of fmax should be limited to be at least 21Hz? Do you want to create another pull request?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: Unlimited speed when fmax<20

Post by nailgg »

Just created the pull request. I also set the minimum fmax to 21 in param_prj.h. The main reason I set fmax<20 was to measure the RMS and other current calculation stuff, in order to see how nice ilmax and ilrms calculations are done at low frequencies. I can override it myself if I need to set it <20 again.

Included the changes we made in LimitCurrent() in the pull request too, I can create a different branch for only fmax if you don't like it :)
Post Reply