Top Model with model References for Code Generation
Show older comments
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:
- Is there a workaround to resolve the issue with identifier names in Approach 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?
- Currently Approach1 is working seamlessly, Is it worth it to change it to Approach 2 considering the scenario which is explained above.
2 Comments
Noufal Thangal Rahim
on 4 Jan 2023
answering to your questions by number:
- Can you please show the error of approach 2 with same interface name.
- 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.
- I hope you are doing fine using approach 1 with signal objects. What is the reason for approach 2.
Sanjiv Raj
on 4 Jan 2023
Answers (0)
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!