Unexpected code generated when subsystem is changed to atomic

1 view (last 30 days)
In my model, I set two signals as test points. When I proceed to generate code, the code is as expected. When I change one of the subsystems in the model to 'Atomic', I seem to observe some extraneous code generated (see below). Why does this happen

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Sep 2021
Edited: MathWorks Support Team on 28 Sep 2021
The C-API generates code for all signals, not just test points. The reason you are seeing new signals appear is because when the subsystem is made atomic, some signals that were previously virtual become non-virtual and thus show up in the C-API. For more information on Virtual signals, please review the following documentation page: https://www.mathworks.com/help/simulink/ug/signal-types.html
However, these signals will not appear when generating code using Embedded Coder as it employs optimizations not available in Simulink Coder to make the generated code more efficient. Consider using Embedded Coder if the aim is to eliminate these extraneous signals. 

More Answers (0)

Categories

Find more on Test Model Components in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!