Generate PLC Code (STEP7) of a Fuzzy System
Show older comments
Hello,
i was trying to generate a PLC Code (STEP7) from a fuzzy system i made with the Fuzzy Logic designer (3 Inputs, 1 Output).
I implemented it in Simulink in a Atomic Subsystem. Everytime i want to generate it, the following alarm comes.
"Code generation subsystem 'untitled/Fuzzy_PFO2' must not be specified in PLC Code Generation > Interface > Externally Defined Blocks."
I don't find the parameter "Externally Defined Blocks" under the Settings "Interface" in the "PLC Code Generation".
I made the Fuzzy System Block inside an Atomic Subsystem. I Attached pictures of everything.
Can someone help me?
Thanks and Best Regards Daniel
1 Comment
Answers (1)
Kishen Mahadevan
on 19 Feb 2026 at 23:00
0 votes
The error indicates that the model contains a subsystem 'untitled/Fuzzy_PFO2' that Simulink PLC Coder will generate code for (a code‑generation/atomic subsystem), but the same subsystem is also configured as externally defined (i.e. configured to supress the definition of model components). PLC Coder forbids a subsystem from being both generated and declared as externally provided, and hence you see this error.
To resolve this error, set the UseExternalDefinition PLC block parameter to 'Off'.
You can do this by first right clicking on the subsystem 'untitled/Fuzzy_PFO2' and selecting PLC Code -> PLC Block Properties to open the PLC Property Inspector, and then by setting 'UseExternalDefinition' parameter to 'Off'.

Please refer to the following documentation page for additional information on PLC Block Properties:
Thanks!
Categories
Find more on Simulink PLC Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!