Top Model with model References for Code Generation

I have a top model with several referenced models in it. The output of certain reference models are used as input to other referenced models. For example, Interface_1 is the output of Component_A and input of Component_B. (Both 1ms runnable).
I am using the generated code for some of the application components to replace it with the existing handcode. For this reason, I need to have consistent Interface names. I am currently working on two possible approaches.
1st Approach: All the components are seperate models which generates code and the Genreated files are replaced in the Build Folder using mscript. After configuring Identifier names in the Code Mapping interface, the Build is successful when integrating with the existing code.
2nd Approach: Using Top Model with referenced models. Initially i used delay blocks to resolve the algebric loop error. But now after using the Schedule Editor, the model is compiling even without delay blocks. But the problem occurs when the same identifier name is used. Taking the previous example, In Component_A, the identifier name is Interface_1 and in Component_B, the identifier name is Interface_1_new (Same name throws a error).
Questions:
  1. Is there a workaround to resolve the issue with identifier names in Approach 2?
  2. Currently Embedded Coder is used for Code Generation, But future plan includes the conversion into a AUTOSAR Complient Software. Going Forward which shall be the preffered approach?
  3. Currently Approach1 is working seamlessly, Is it worth it to change it to Approach 2 considering the scenario which is explained above.

2 Comments

answering to your questions by number:
  1. Can you please show the error of approach 2 with same interface name.
  2. AUTOSAR won't have this problem, you just have to creat an interface and do the right code mappings, as a sender in SWC A and as receiver in SWC B.
  3. I hope you are doing fine using approach 1 with signal objects. What is the reason for approach 2.
I would like to address your comments by number.
1.Error due to the same identifier name.
Identifier Name : eng_Lv_Vol_Sts
Model1: Appl_PPIM_Operation
Model2: Appl_PPIM_Fault
2. I understand.
3. I am not using the signal object, The inputs are mapped as Imported Extern Storage Class, and the outputs are mapped as Exported Global Storage Class and with correct Identifier names, the generated code is inline with the existing hand code.The reason for approach 2 is to have a ARXML with only one Application Component in it. I understand its not a genuine reason.
Thank you for the response.

Sign in to comment.

Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Release

R2021b

Asked:

on 3 Jan 2023

Commented:

on 4 Jan 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!