MagniV MCAT data Type Question

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MagniV MCAT data Type Question

3,185 次查看
SW_Park
Contributor II

Nmax = 8000rpm at MCAT
When Speed Required = 8000 is input, the following error occurs.
The data type doesn't seem right. Please check how to set it up.

SW_Park_0-1641987568588.png

 

0 项奖励
回复
6 回复数

3,112 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

the question is now more FreeMASTERr oriented. Because of this I would like to suggest you to continue at Freemaster specialized forum where specialist for FreeMASTER are able to provide answer.

https://community.nxp.com/t5/FreeMASTER/bd-p/freemaster

Best regards,

Ladislav

0 项奖励
回复

3,149 次查看
tomasfedor
NXP Employee
NXP Employee

Hi SW_Park, 

Could you please specify in which example the issue occurred? 

Here are 3 items you can verify:

1) Freemaster variable limit. 

open freemaster variable and check limit in tab modifying.

(You can find more about variables in Freemaster documentation section 4.2 Variables)

tomasfedor_0-1642403885805.png

2) is proper elf flashed in MCU: 
in order to be able to translate value to raw format fmScale.speed_n_m must exist in project. 

tomasfedor_1-1642404045657.png

tomasfedor_2-1642404281492.png

3) if you want to apply a change in MCAT tab "Parameters" the project needs to be compiled and flashed. 

ïn Mcat click "store data"' button 

tomasfedor_6-1642406284433.png

generate output file 

tomasfedor_4-1642405918744.png

compile and flash project from CW. 

Generated constants (PMSM_appconfig.h)

are initialized in stateReset and stateInit

Freemaster scale constants are initialized in stateReset 

tomasfedor_5-1642406148090.png

 

Best regards,

Tomas Fedor 

System Application Engineer

 

0 项奖励
回复

3,141 次查看
SW_Park
Contributor II

Thank you for answer. Once the problem has been resolved.
In addition, please inquire about variable setting.

SW_Park_0-1642471075002.png

1) I do not understand the reason for setting " x2: 1000 " even if I look at the manual.
2) y2: fmScale.speed_n_m = Nmax X 1000
-> Why? Multiply by 1000?

0 项奖励
回复

3,127 次查看
tomasfedor
NXP Employee
NXP Employee

Hi SW_Park, 

When you define Freemaster variable, Freemaster can do a service of "further post-processing numeric
transformation". In other words some formula can be applied before a variable is written to a microprocessor and it is also applied in the reverse direction when the variable is read from microcontroller. 

In case of the ManiV mc example Freemaster variable Speed Required is linked with microprocessor variable drvFOC.pospeControl.wRotElReq. This variable is in fraction format Q0.15 <-1,1). From the GUI perspective it is better to see  Speed Required in physical dimension RPM. This is where we can use "Real Type transformation" feature of Freemaster. 

tomasfedor_0-1642493987249.png

Linear transformation is the type useful for this usecase and we can pick out of 2 forms: 

"Linear ax + b" or "Lin: two points"  because in coordinate geometry of a straight line the line can be defined:

1) by gradient and offset "Linear ax + b"

2) by 2 points 

in case of Speed Required:

point 1 X=0, Y=0

point 2 X=1000, Y=fmScale.speed_n_m

Best regards, 

Tomas Fedor

System Application Engineer

 

 

   

0 项奖励
回复

3,123 次查看
SW_Park
Contributor II

Hi...
Nmax = 8000 [rpm]  -> Application scale
Speed Required = 4000 [rpm]  -> Freemaster variable

SW_Park_0-1642502321290.png

Then,
microprocessor variable   
drvFOC.pospeControl.wRotElReq  =  FRAC16(0.4999847412);

Is that right?

If yes, does "Lin: two points" mean coordinates to convert to a float variable?
So, is the multiplication by 1000 for the compensation of decimal arithmetic?

then
point 1 X=0, Y=0
I think " point 2 X=0, Y=fmScale.speed_n_m = 8000 " can also be used.

 

 

 

0 项奖励
回复

3,114 次查看
tomasfedor
NXP Employee
NXP Employee

Hi SW_Park,

Here is process of Freemaster variable Speed Required from MagniV MC example:

Linear transformation:

tomasfedor_0-1642510010210.png

X1= 0 , Y1 = 0
X2= 1000, Y2 =fmScale.speed_n_m = FM_SPEED_RPM_MEC_SCALE = 4500 000

means y = x*4500 where y is what we see in the GUI (Speed Required) and X is output from the transformation.
In other words it is transformation between range <-1,1) and <-4500,4500)

Variable settings:

tomasfedor_1-1642510035478.png

Variable is set as signed fraction format Q0.15 so it takes output from the transformation "range <-1,1)" and recalculates it to correct binary form of Q0.15.
Note: if output from transformation is out of range Q0.15 (for example 1.5) you get an error.


Best regards,

Tomas Fedor

System Application Engineer

0 项奖励
回复