PLC Coder settings: Generate reusable code
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I'm a bit confused regarding the PLC Coder settings, more specifically the "Generate reusable code" option in the Optimization tab.
From the documentation (https://se.mathworks.com/help/plccoder/ug/plc-coder-optimization.html): If the model contains multiple instances of the same subsystem and some instances have constant inputs, by default, the generated code contains separate function blocks for each instance.
However when testing the demo model plcdemo_simple_subsystem, and duplicating the subssytem (attached), I see no difference in the generated structured text when turning this setting on or off. From my understanding the structured text should contain two function blocks if this setting was turned off?
Does anybody have an example where the generated code differs based on this setting?
Thanks!
0 Kommentare
Antworten (1)
Infinite_king
am 6 Mai 2024
Bearbeitet: Infinite_king
am 6 Mai 2024
Hi Sindre Møller,
In the Simulink model 'plcdemo_simple_subsystem_modified.slx', the subsystem's perform very basic operations. Simulink PLC Coder usually optimizes the output to increase efficiency. Hence, the subsystems are merged into one single function block by the PLC Coder even when the 'Generate Reusable Code' option is not selected.
To see the effect of the 'generate reusable code' option, choose any example with a complex subsystem, duplicate it, and generate the code. You can find examples here :- https://www.mathworks.com/help/plccoder/examples.html
Hope this is helpful.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Simulink PLC Coder finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!