필터 지우기
필터 지우기

PLC Coder settings: Generate reusable code

조회 수: 3 (최근 30일)
Sindre Møller
Sindre Møller 2021년 9월 14일
편집: Infinite_king 2024년 5월 6일
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!

답변 (1개)

Infinite_king
Infinite_king 2024년 5월 6일
편집: Infinite_king 2024년 5월 6일
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.

카테고리

Help CenterFile Exchange에서 Simulink PLC Coder에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by