Functions reuse in generated code
Ältere Kommentare anzeigen
I have a Simulink 2014a model that contains two identical subsystems from a user-defined library. For these subsystems, function packaging parameter is set to reusable. One of the subsystems inputs are fed by constant block, while the other subsystem inputs are fed by gain blocks. In the generated code (using embedded coder), the functions generated for the two subsystems aren't being reused. When comparing subsystem checksum, I noticed that "ReadsInputInStartFcn" identifier is different between the two subsystems. Note that, I am using a "MATLAB Function (fcn)" block in both subsystems. Could you please explain the root cause of this difference?
6 Kommentare
Birdman
am 13 Dez. 2017
Can you please share the model?(Export to r2017a)
Amr Nagaty
am 13 Dez. 2017
Birdman
am 14 Dez. 2017
But inside of subsystems are more important for this question. Can you also share them?
Amr Nagaty
am 14 Dez. 2017
Birdman
am 14 Dez. 2017
I still need to see what is written inside each MATLAB Function block for two subsystems respectively.
Walter Roberson
am 14 Dez. 2017
R2017a can open models created in R2014a, so if you could attach your model and associated .m files then we could explore them. Birdman would just have difficulty opening the files if they had happened to have been created with R2017b.
Antworten (1)
Juan Rafael Garcia Blanco
am 28 Aug. 2019
1 Stimme
I have the same problem. I have got around this problem by inserting a Signal Conversion block in between the Constant block and the atomic block. I have checked that it does not introduce any additional code, and this way, EC seems to understand that the two blocks are effectively the same and generates a single C function.
Kategorien
Mehr zu Subsystems finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!