Consulting the using about the GMCLIB_DecouplingPMSM in MCLIB for MPC564xL Simulink Block

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Consulting the using about the GMCLIB_DecouplingPMSM in MCLIB for MPC564xL Simulink Block

1,471 Views
edenli
Contributor V

@

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.

pastedImage_1.png

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

pastedImage_2.png

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:

pastedImage_3.png

and ,the do we not using the equation?

Thank you very much!

10 Replies

1,238 Views
dumitru-daniel_
NXP Employee
NXP Employee

BTW, this method for scaling floating-fixed can be applicable to many other computations as well. Another typical example might be PI/PID controllers.  

0 Kudos

1,238 Views
dumitru-daniel_
NXP Employee
NXP Employee

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:

1,238 Views
edenli
Contributor V

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.

pastedImage_6.png

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.

pastedImage_7.png

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,

pastedImage_8.png

Can you help me analyze the reason?yesterday ,the model has bothered me for a day!

0 Kudos

1,238 Views
edenli
Contributor V

I am sorry,the attatchment is below.

0 Kudos

1,238 Views
dumitru-daniel_
NXP Employee
NXP Employee

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

0 Kudos

1,238 Views
edenli
Contributor V

Hi Daniel,

I am sorry,i am not very clear about what you said, i thought you wanna express the content,as the attachment .if not right please reply for me.

BTW,How to check the model if you don't have the power_lib toolbox license?

Best regards,

Eden Li

0 Kudos

1,238 Views
dumitru-daniel_
NXP Employee
NXP Employee

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.

Capture.JPG

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.

0 Kudos

1,238 Views
edenli
Contributor V

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.

pastedImage_1.png

As mentioned above,i thought the problem is here,as the picture shown,

pastedImage_3.png

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

0 Kudos

1,238 Views
edenli
Contributor V

Hi Daniel,

Help me to solve the question ,if you have the time.haha,Thank you very much!

My friend best regard for you!

0 Kudos

1,238 Views
dumitru-daniel_
NXP Employee
NXP Employee

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

1.JPG

#2: you are implementing a slightly different equations than the one used in the NXP decoupling library 

pastedImage_2.png

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:

3.JPG

You should get these results when running with default inputs shown in the UserGuide:

4.JPG

The Decoupling_F32 is more complex since it is using scaling and math operations on 32bits

6.JPG

Running for the same inputs you should get the following results:

7.JPG

Hope this clarify all the concerns related with this topic.

Best regards,
Daniel

0 Kudos