Compilation error of simulink model, that calls a reference model twice

8 views (last 30 days)
Hi,
I have one simulink model for Cpp code generation, which is referenced twice in a simulation model. While compiling the latter, I encounter the following issue.
Cannot generate reusable model reference target in the presence of machine parented data, events or exported graphical functions. Consider updating the 'Total number of instances allowed per top model' parameter, in the Model Referencing tab of the Simulation parameters (Configuration) dialog to "one".
Although a hint is given in the error message, after having set the field 'Total number of instances allowed per top model' to "one", the compiler again asks to set it back to "Multiple".
I have been looking around for hints without success, and trying to localize the issue. It somehow links to a matlab function block (in simulink) in the referenced model. Could you please give me hints to resolve the above issue?
Thanks in advance!
Regards,
Anh

Answers (1)

Harsh
Harsh on 7 May 2025
Embedded Coder does not support machine-parented data for code generation. Ther referenced model should also not uses any exported Stateflow graphical functions. Please check your referenced model for these cases. For more information on requirements and limitations of the model reference, please refer to the following documentation - https://www.mathworks.com/help/simulink/ug/model-referencing-limitations.html
1. If your referenced model has machine parented data, you can -
  • Run the "Upgrade Advisor" on your referenced model
  • Manually delete machine parented data symbols from each Stateflow chart and use Data Store Memory instead.
2. If your referenced model exports Stateflow graphical functions, you can -
  • Refactor them into chart-scoped functions
  • Remove the export option for the Stateflow graphical funciton. Please note that removing export will break references in other charts or blocks. Ensure that dependent components are updated accordingly.
Hope this resolves your query !

Categories

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

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!