@
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!
BTW, this method for scaling floating-fixed can be applicable to many other computations as well. Another typical example might be PI/PID controllers.
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:
Hi dumitru-daniel.popa,
First,Thank you for your reply,and according to what you said,i built a model using the GMCLIB_DecouplingPMSM for the PMSM SVPWM control,As shown in the below,and i upload the attachment.
but the result comparing is the same,i write my analysis is as below,i thought the reason is,but i am not sure,the parameter kdf & kqf.
the caculation of the two parameter,requring the I_Max ,W_MAX,but i don't know how to confrim the two parameter in the Permanent Magnet Synchronous Machine Block in the simulink,i don't know the pararmeter is right or not,
Can you help me analyze the reason?yesterday ,the model has bothered me for a day!
Hi Eden Li,
I would love to help you with this model, but unfortunately i do not have the power_lib toolbox license.
Can you create a standalone model of the Decoupling bloc + the one you plan to design with all the parameters included (flux, Ld, Lq) so that i can run it on my computer for checking ? (like you have done it in the past)
Best regards,
Daniel
Eden Li,
Your model contains blocks from SimPowerSystems toolbox which i do not have a license for - therefore i can't simulate the block so i do not know what results you are expecting for.
Please create a simple model for and highlight the differences you need clarification on.
Ideally would be to have something like the model attached below - if you could modify it to include the variables and the input parameters.
Hi Daniel,
Ha,ha,that's my problem complicating the question.Now,i rebuilt a model,shown as below.the Parameter of the PMSM in the attachment.
In the model ,the same input the model,but the result is Completely different.
As mentioned above,i thought the problem is here,as the picture shown,
I think the value for parameter of the I_MAX and W_MAX is the reason. I don't know that how to caculate the value of the Parameter according the parameter of P,Ld,Lq,flux,Udc.
Best Regards!
Eden Li
Hi Eden Li,
I guess you are trying to avoid using the NXP Math library and implement the same equations by using Simulink Standard block.
Your Model3.zip have at least 2 caveats that prevents you for getting the same result as the NXP library:
#1: you are passing wrong arguments to the NXP library: you should pass the inductance LQ/LD
#2: you are implementing a slightly different equations than the one used in the NXP decoupling library
Disclaimer: Just to be clear for everyone that might read this topic in the future and also trying to avoid a custom model only - i revert the models to be generic and in sync with the NXP library examples (to have a reference to compare with.
Therefore, please find attached to models: one in floating point and the other one in fixed point with scaling [-1, 1) 32b Simulink implementation to address this issue.
The Decoupling_FLT is a simple one implemented in floating point:
You should get these results when running with default inputs shown in the UserGuide:
The Decoupling_F32 is more complex since it is using scaling and math operations on 32bits
Running for the same inputs you should get the following results:
Hope this clarify all the concerns related with this topic.
Best regards,
Daniel