Resolver Initialization - Code Generation and Optimization in the Model Based Software

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

Resolver Initialization - Code Generation and Optimization in the Model Based Software

2,166 次查看
edenli
Contributor V

Hi daniel,

My destination is initialize the resolver of AD2S1205,the right of the below picture is the program of initialization.And the left of picture is the simulink model equal to the right. 

 

183147_183147.pngpastedImage_1.png

but,the result of the Code generation is below

183148_183148.pngpastedImage_2.png

and the result is right ,but that is tedious,is not advantageous to optimize program,can you give me some advise?

the attachement is the model.

Original Attachment has been moved to: Reslover.zip

3 回复数

1,737 次查看
Daniel_Popa
NXP Employee
NXP Employee

Hi Eden Li, 

There are a few easy things to modify the code generation in order to be more easy to read and a bit faster:

1.JPG

#1: use boolean constants instead of performing necessary conversions

This will remove extra RAM for holding data type conversion and an additional assignment instruction

2.JPG

#2: remove the S-function input arguments

This will remove extra RAM by avoiding loading unnecessary structures;

4.JPG

#3: even this is not absolutely needed - i prefer to use atomic system for each of the steps needed for resolver initialization 

#4: use priorities (see https://community.nxp.com/thread/449904#comment-899761 ) to ensure the proper calling sequence of each step

The final model should look like this (this is a personal preference)

5.JPG

For more complex model you can also deploy Code Generation Objectives to get better performance/code size/debuggin.

6.JPG

Hope this helps!

Best regards,
Daniel

PS: Attached is a modified version i used to capture the screenshots

1,736 次查看
edenli
Contributor V

Hi daniel,

Thanks for your reply!

Best Regards!

Eden Li 

1,737 次查看
Daniel_Popa
NXP Employee
NXP Employee

Hi Eden Li, 

I branched your reply in a separate topic not to mixed up the things. I'll have a look and try to suggest some potential approaches. Stay tuned.

Best regards,

Daniel

0 项奖励
回复