Simulink Function Blocks cannot be autocoded in a multi-instance component.
36 views (last 30 days)
Show older comments
I am trying to autocode a multi instance component but run into a issue generating code concerning the scope of Simulink function blocks. The code won't generate because the model contains a global simulink block, but it also won't generate if the Simulink block is scoped. Any details on what might be to leading this or the use case on how to have Simulink function blocks in a multi-instance component would be greatly beneficial.
Error when function is scoped:
Model 'RegenvCurrLimChk', which is not an Export Function model, may not generate reusable code because it contains scoped Simulink function 'SplyCurrCalcn' which generates reusable code. Ensure that the model 'RegenvCurrLimChk' is an Export Function model to generate reusable code or Consider setting the model configuration parameter 'Code interface packaging' to 'Nonreusable function' and 'Total number of instances allowed per top model' to 'One'.
Note: The top level is defined as an Export Function Model.
Error when function is global:
Model 'RegenvCurrLimChk' may not generate reusable or C++ class code because it contains a global Simulink function defined in 'RegenvCurrLimChk/SplyCurrCaln'.
Consider setting the option 'Code interface packaging' to 'Nonreusable function'.
0 Comments
Answers (1)
Sreeram
on 11 Dec 2024 at 11:12
Hi Mark,
The Embedded Coder documentation states that code generation for a C++ class interface supports scoped Simulink functions only. This might explain why the code could not be generated when the model contains a global Simulink function block.
It also states that to generate code from a model that includes scoped Simulink functions, the model must be an export-function model. However, the first error message indicates that the model 'RegenvCurrLimChk' is not an export-function model. You might want to consider double checking whether the top-level model indeed satisfy the requirements for an export-function model given in the following documentation:
More information on limitations of Simulink Function blocks with Embedded coder is present in the “Limitations” section of the following documentation:
I hope it helps!
0 Comments
See Also
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!