@

Hi,Guys,

Iwanna use the GMCLIB_DecouplingPMSM in MCLIB for MPC564xL to PMSM contorl ,But,the Parameter s32Kd,s32Kq of the GMCLIB_DecouplingPMSM block in Simulink，I don't know how to caculate the s32Kd and s32Kq.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I caculated the parameter of the f16Kd and f16kq,but the result is not 0.625 as the file "MPC564XLMCLUG.pdf" shows.I caculate the result is f16Kd=40,f16kq=20;

My caculation equation:

and ,the do we not using the equation?

Thank you very much!

Hi Eden Li,

Back in the dark ages when operations on floating point were very costly most of the DSP programming was done on integers and one of the most used representation was Q15 format used for 16bit native MCU/DSP.

In this format all number are scaled from -1 to 0.9999.

You calculations are correct but you stopped in the middle - you got only the real number for kq and kd coefficients.

Since the computations are carried on fixed point, you need to scale these 2 factors in the range of [-1:1)

This scaling is done in 2 stages.

1: first compute the scaling coefficients: it is basically a shift left proper value

kd_shift = ceil(log(kd)/log(2))

kq_shift = ceil(log(kq)/log(2))

2: compute the scaled quantities for the coefficients

kdf = kd*2^(-kd_shift)

kqf = kq*2^(-kq_shift)

Using this mathematical trick you ensure the higher computational precision. Basically you can represent a real number as real = (fraction)<<(fraction_shift)

You can get details about floating point/fixed point mathematics here.

For your convenience i made a small m script to compute the factors that you need to use for math computations using the NXP toolbox. Please find it attached: