Bug: Simulink will not autocode/build models with model-referenced integrator blocks

25 views (last 30 days)
MATLAB 2016b
When I attempt to build a Simulink model that contains an integrator block inside of a model reference, for C++ autocoding purposes, the build aborts due to the following error:
The code interface packaging option 'C++ class' cannot be selected for model 'TEST' because it does not combine its output and update functions when generating code for model reference targets
Is there a known fix for this error?
Thanks in advance
EDIT: There is a known bug listed here:
Note: the way this bug report reads, they have not implemented an error message, such as the one I am receiving. However, this is likely the culprit.
I don't understand the 1st workaround. The 2nd workaround works:
set_param(cs, 'CodeInterfacePackaging', 'Nonreusable function')
My attempt at the 3rd workaround does not seem to fix. I uploaded an image of my 3rd workaround for reference.

Accepted Answer

Hari Desanur
Hari Desanur on 17 Apr 2017
Edited: Hari Desanur on 17 Apr 2017
The bug report which you have mentioned is specific to an issue where there is simulation and code generation mismatch.
The conditions under which the above issue occurs seems to be related to your model but the error which you are getting is due to the following limitation -
When building a referenced model that is configured to generate a C++ class interface: Do not use a C++ class interface in cases when a referenced model cannot have a combined output/update function. Cases include a model that has a continuous sample time or saves states.
Refer to the following documentation page which mentions other limitations with regard to the C++ Class Interfaces - http://www.mathworks.com/help/ecoder/ug/c-encapsulation-interface-control_brre9ro-1.html#brre9yi-1
I work for MathWorks and I have forwarded this feedback to the appropriate product team.

More Answers (0)

Categories

Find more on Simulink Coder 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!