Model Reference without adding "Target Configuration Block"

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

Model Reference without adding "Target Configuration Block"

跳至解决方案
1,271 次查看
cpatel
Contributor I

Hello NXP MBDT Team, 

I am using "NXP's Model-Based Design Toolbox for S32K1xx Toolbox" version 4.1.0 with MATLAB R2019a. 

In my project, I am using model references (model within a model) to manage complexity. While generating code, using one of the example file (flexcan_s32k11x) without any modification, code generation works fine. When I add model reference (Convert flexcan_s32k11x/Rx_Complete/Switch Case Action Subsystem ID 0x3FE/Chart in Model Reference), code generation gives following error:

Error: Index exceeds the number of array elements (0).

After adding "MBD_S32K11x_Config_Information" block to model reference, error goes away. That makes me believe that it is much to add "MBD_S32K11x_Config_Information" block to each model reference at top level. However, in documentation, it suggests otherwise (it seems that adding this block to model is optional) 

If set System Target File Manually, above error comes back. 

In documentation: 

Block Miscellaneous Details:

  • Required System Target File is set automatically by adding Target Configuration Block into the model. If no Target Configuration Block in the model then System Target File should be set manually.

Any suggestion or workaround on how to avoid adding "Target Configuration Block" to each model reference? Is it possible? 

-Chirag

标签 (1)
0 项奖励
回复
1 解答
1,126 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello cpatel@mathworks.com‌,

Thank you for reporting this behaviour. This might be caused by one of our callbacks. I have attached a file that must be replaced under {src\mbdtbx_s32k\mscripts\model}.

Please replace it and test the "Propagate Configuration" button.

Hope this helps,

Marius

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,126 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello cpatel@mathworks.com‌,

The Config block must be added in all the referenced models. Besides the .tlc file, there are other changes that the Config block performs on the model.

If you need to change something in the Config Block, just change in the main model and just press the "Propagate configuration" button. It will automatically apply the changes to all Config Blocks from the referenced models. 

pastedImage_1.png

Hope this helps,

Marius

0 项奖励
回复
1,126 次查看
cpatel
Contributor I

Hi mariuslucianandrei

Thank you for your reply. 

When I double click on "Propagate Configuration" as you mentioned above, it also changes some of the model configuration parameters. For example, it changes support for non-finite numbers and complex numbers, among other things. This is reproducible everytime. 

Is there a way to avoid this? 

Also, with Model References, it is recommended to use Configuration References. "Propagate Configuration" doesn't work in that case.  

pastedImage_1.png

0 项奖励
回复
1,127 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello cpatel@mathworks.com‌,

Thank you for reporting this behaviour. This might be caused by one of our callbacks. I have attached a file that must be replaced under {src\mbdtbx_s32k\mscripts\model}.

Please replace it and test the "Propagate Configuration" button.

Hope this helps,

Marius

0 项奖励
回复