2020/09/07 07:50:03
mrvanx
Hi All,
      Im working through AN1078 and porting the FOC code across to some already existing firmware for the dsPIC30F6010A. We have a board currently in development which incorporates the three phase current measurments and voltage monitoring at the phase outputs. The intention is to stick closely to AN1078 so we will use the current observer for the back emf estimation for angle and RPM and use the first two phase currents for the clarke/park transforms etc...The board will be running the dsPIC at 30MIPS to maximise our available processing time each loop.
 
Looking at the RPM calculations there is a constant used in the calculation:
resultA = __builtin_mpy(AccumTheta,Q15((float)(SPEED_CONSTANT/2.0)),0,0,0,0,0,0);

// Q15(Omega) * PWM Frequency * 60
    // Speed RPMs = -----------------------------------------------------------
    // Q15(Speed Constant) * Cycler per Speed Calc * Motor Poles
    // For example:
    // Omega = .5
    // PWM Frequency = 8,000
    // Speed Constant = 1.5625
    // Cycles per Speed Calc = 8
    // Motor Poles (pole pairs * 2) = 4
    // Then:
    // Speed in RPMs is 4,800 RPMs

 // FilteredOmega = FilteredOmega + FilterCoeff * (s->Omega-FilteredOmega)

 
SPEED_CONSTANT is defined in smcpos.h as 1.5625 which seems coincidentally very close to pi/2??
 
The code and examples dont seem to explain where this value is derived from, nor if it changes depending on the motor params?
 
I found a couple of threads which get close to this question but not quite there, I didnt want to necropost either :)
https://www.microchip.com/forums/m394625.aspx
https://www.microchip.com/forums/m534531.aspx
 
Any pointers would be appreciated,
 
Cheers,
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account