Why is the "Remove internal data zero initialization" option removed when the code generation interface is specified to a C++ class?
조회 수: 7 (최근 30일)
이전 댓글 표시
I am attempting to code a simulink model using a C++ class as the code interface package. I have so far been able to generate the code, compile, and test it, however I have noticed some runtime issues.
I am using low pass filters in my model and noticed that early on in the program's execution the initial state of the internal delay blocks are not zero. Instead, they start with a random number associated with whatever was in memory at that time. I attempted to de-select the "Remove internal data zero initialization" option in the configuration parameters window to set their initial state to zero, however this option is greyed out.
Interestingly, if I change the initial state of the delay blocks to something non-zero, this creates initialization code which sets that value. This seems like an uneccessary limitation, as I cannot guarantee that the initial value of the variables is zero. Is there any work around to this which does not involve modifying the generated code?
댓글 수: 0
답변 (1개)
Jasvin
2023년 3월 9일
편집: Jasvin
2023년 3월 9일
Unfortunately, if the "Remove internal data zero initialization" option is greyed out in the Simulink configuration parameters window, it means that this option is not available for your current configuration. This may be because you are using a C++ class as the code interface package, as certain options may not be compatible with this type of setup.
And there doesn't seem to be any workaround for this other than modifying the generated code to either add an initialization step or explicitly initialize the delay block.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!