Main Content

Structured Text Code Generation for Subsystem Reference Blocks

This example shows how to autogenerate structured text code for subsystem reference blocks.

Open Simulink Model

To open the Simulink test bench model, use the following command.

open_system('mSubSysRefSystemIntegration')

Generate Code for the Subsystem

To generate code for the subsystem use plcgeneratecode

generatedfiles = plcgeneratecode('mSubSysRefSystemIntegration/TopSystem');
### Generating PLC code for 'mSubSysRefSystemIntegration/TopSystem'.
### Using <a href="matlab:configset.showParameterGroup('mSubSysRefSystemIntegration', { 'PLC Code Generation' } )">model settings</a> from 'mSubSysRefSystemIntegration' for PLC code generation parameters.
### Begin code generation for IDE <a href="matlab:configset.showParameterGroup('mSubSysRefSystemIntegration', { 'PLC Code Generation' } )">codesys23</a>.
### Emit PLC code to file.
### Creating PLC code generation report <a href="matlab:web('/tmp/Bdoc21a_1606923_165636/tp459455fe/ex94427949/plcsrc/html/mSubSysRefSystemIntegration/mSubSysRefSystemIntegration_codegen_rpt.html')">mSubSysRefSystemIntegration_codegen_rpt.html</a>.
### PLC code generation successful for 'mSubSysRefSystemIntegration/TopSystem'.
### Generated files:
<a href="matlab: edit('plcsrc/mSubSysRefSystemIntegration.exp')">plcsrc/mSubSysRefSystemIntegration.exp</a>

Related Topics