how to disable Stateflow object eliminated by optimization while code generation?

186 views Asked by At

I have designed a state machine in stateflow. it consists of several variable and states. however, when I am generating code using embedded Coder, multiple states, variables and even transitions are missing from code. on clicking on that particlar state, Stateflow prompts "Stateflow object eliminated by optimization". kindly suggest how to ensure all states and variables are present in the final code as they are in state machine

I am not able to find solution even after trying multiple setting changes and checking online

1

There are 1 answers

0
Wolfie On

From the documentation, it looks like you want to disable the following setting:

[...] in the Configuration Parameters dialog box, select the Block reduction parameter. The Simulink software collapses certain groups of blocks into a single, more efficient block, or removes them entirely.

The docs also provide some context for why your blocks might be being removed in the first place, the code coverage analysis conducted during the build probably identifies that the blocks in question are impossible to reach with your implemented logic.

Here is the setting:

settings