Set up general information about generating Structured Text code to download to target PLC IDEs.
To enable the Simulink® PLC Coder™ options pane, you must:
Create a model.
Add either an Atomic Subsystem block, or a Subsystem block for which you have selected the Treat as atomic unit check box.
Right-click the subsystem block and select PLC Code > Options.
In addition to configuring parameters for the Simulink PLC Coder model, you can also use this dialog box to generate Structured Text code and test bench code for the Subsystem block.
Certain options are target-specific and are displayed based on the selection for Target IDE.
Select the target IDE for which you want to generate code. This option is available in the Configuration Parameters dialog box, PLC Code Generation pane.
The default Target IDE list shows the full set of supported targets. See Show Full Target List.
To see a reduced subset of targets, clear the option Show full target
list. To customize this list and specify IDEs that you use more
frequently, use the plccoderpref
function.
For version numbers of supported IDEs, see Supported IDE Platforms.
Default:
3S CoDeSys 2.3
3S CoDeSys 2.3
Generates Structured Text (IEC 61131-3) code for 3S-Smart Software Solutions CoDeSys Version 2.3.
3S CoDeSys 3.3
Generates Structured Text code in PLCopen XML for 3S-Smart Software Solutions CoDeSys Version 3.3.
3S CoDeSys 3.5
Generates Structured Text code in PLCopen XML for 3S-Smart Software Solutions CoDeSys Version 3.5.
B&R Automation Studio 3.0
Generates Structured Text code for B&R Automation Studio® 3.0.
B&R Automation Studio 4.0
Generates Structured Text code for B&R Automation Studio 4.0.
Beckhoff TwinCAT 2.11
Generates Structured Text code for Beckhoff® TwinCAT® 2.11 software.
Beckhoff TwinCAT 3
Generates Structured Text code for Beckhoff TwinCAT 3 software.
KW-Software MULTIPROG 5.0
Generates Structured Text code in PLCopen XML for PHOENIX CONTACT (previously KW) Software MULTIPROG® 5.0 or 5.50.
Phoenix Contact PC WORX 6.0
Generates Structured Text code in PLCopen XML for Phoenix Contact® PC WORX™ 6.0.
Rockwell RSLogix 5000: AOI
Generates Structured Text code for Rockwell Automation® RSLogix™ 5000 using Add-On Instruction (AOI) constructs.
Rockwell RSLogix 5000: Routine
Generates Structured Text code for Rockwell Automation RSLogix 5000 routine constructs.
Rockwell Studio 5000: AOI
Generates Structured Text code for Rockwell Automation Studio 5000 Logix Designer using Add-On Instruction (AOI) constructs.
Rockwell Studio 5000: Routine
Generates Structured Text code for Rockwell Automation Studio 5000 Logix Designer routine constructs.
Siemens SIMATIC Step 7
Generates Structured Text code for Siemens® SIMATIC® STEP® 7.
Siemens TIA Portal
Generates Structured Text code for Siemens TIA Portal.
Siemens TIA Portal: Double Precision
Generates Structured Text code for Siemens TIA Portal. The code uses LREAL
type for double
data type in the model and can be
used on Siemens PLC devices that support the LREAL
type.
Generic
Generates a pure Structured Text file. If the target IDE that you want is not available for the Simulink PLC Coder product, consider generating and downloading a generic Structured Text file.
PLCopen XML
Generates Structured Text code formatted using PLCopen XML standard.
Rexroth Indraworks
Generates Structured Text code for Rexroth IndraWorks version 13V12 IDE.
OMRON Sysmac Studio
Generates Structured Text code for OMRON® Sysmac® Studio Version 1.04, 1.05, or 1.09.
Selectron CAP1131
Generates Structured Text code for Selectron CAP1131 v 11 IDE.
Rockwell Automation RSLogix 5000 routines represent the model hierarchy using hierarchical user-defined types (UDTs). UDT types preserve model hierarchy in the generated code.
The coder generates code for reusable subsystems as separate routine instances. These subsystems access instance data in program tag fields.
Parameter:
PLC_TargetIDE |
Type: string |
Value:
'codesys23' | 'codesys33' |
'codesys35' | 'rslogix5000' |
'rslogix5000_routine' |
'studio5000' |
'studio5000_routine' |
'brautomation30' |
'brautomation40' | 'multiprog50' |
'pcworx60' | 'step7' |
'plcopen' | 'twincat211' |
'twincat3' | 'generic' |
'indraworks' | 'omron' |
'tiaportal' |
'tiaportal_double' |
Default:
'codesys23' |
View the full list of supported target IDEs in the Target IDE drop-down list. For more information, seeTarget IDE. This option is available on the PLC Code Generation pane in the Configuration Parameters dialog box.
Default: On
The Target IDE list displays the full set of supported IDEs. For more information, see Supported IDE Platforms.
The Target IDE list displays only the more commonly used IDEs. The default subset contains the following IDEs:
codesys23
— 3S-Smart
Software Solutions CoDeSys Version 2.3 (default) target
IDE
studio5000
— Rockwell
Automation Studio 5000 Logix Designer target IDE for
AOI format
step7
— Siemens
SIMATIC
STEP 7 target IDE
omron
— OMRON®
Sysmac® Studio
plcopen
— PLCopen XML target
IDE
You can customize the entries in the reduced Target
IDE list by using the plccoderpref
function.
Parameter:
PLC_ShowFullTargetList |
Type: string |
Value:
'on' | 'off' |
Default:
'on' |
You can change the contents of the reduced Target IDE
list using the plccoderpref
function. See plccoderpref
.
Specify the target IDE installation path. The path already specified is the default installation path for the target IDE. Change this path if your IDE is installed in a different location. This option is available on the PLC Code Generation pane in the Configuration Parameters dialog box.
Default:
C:\Program Files\3S Software
C:\Program Files\3S Software
Default installation path for 3S-Smart Software Solutions CoDeSys software Version 2.3.
C:\Program Files\3S CoDeSys
Default installation path for 3S-Smart Software Solutions CoDeSys software Version 3.3 and 3.5.
C:\Program Files\BrAutomation
Default installation path for B&R Automation Studio 3.0 and 4.0 software.
C:\TwinCAT
Default installation path for Beckhoff TwinCAT 2.11 and 3 software.
C:\Program Files\KW-Software\MULTIPROG 5.0
Default installation path for PHOENIX CONTACT (previously KW) Software MULTIPROG 5.0 software. For MULTIPROG 5.50, the installation path may be different, change accordingly.
C:\Program Files\Phoenix Contact\Software Suite
150
Default installation path for Phoenix Contact PC WORX 6.0 software.
C:\Program Files\Rockwell Software
Default installation path for Rockwell Automation RSLogix 5000 software.
C:\Program Files\Siemens
Default installation path for Siemens SIMATIC STEP 7 5.4 software.
C:\Program Files\Siemens\Automation
Default installation path for Siemens TIA Portal software.
When you change the Target IDE value, the value of this parameter changes.
If you right-click the Subsystem block, the PLC Code > Generate and Import Code for Subsystem command uses this value to import generated code.
If your target IDE installation is standard, do not edit this parameter. Leave it as the default value.
If your target IDE installation is nonstandard, edit this value to specify the actual installation path.
If you change the path and click Apply, the changed path remains for that target IDE for other models and between MATLAB® sessions. To reinstate the factory default, use the command:
plccoderpref('plctargetidepaths','default')
See plccoderpref
.
Enter a path to the target folder into which code is generated. This option is available on the PLC Code Generation pane in the Configuration Parameters dialog box.
Default:
plcsrc
subfolder in your working folder
Parameter:
PLC_OutputDir |
Type: string |
Value:
string |
Default:
'plcsrc' |
If the target folder path is empty, a default value of
./plcsrc
is used as the Code Output
Directory.
If, you want to generate code in the current folder use
.
as the output directory.
The Code Output Directory can have the same name as your current working folder.
Specify the generation of test bench code for the subsystem. This option is available on the PLC Code Generation pane in the Configuration Parameters dialog box.
Default: off
Enables generation of test bench code for subsystem.
Disables generation of test bench code for subsystems.
Parameter:
PLC_GenerateTestbench |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |
Specify the generation of test bench code with additional diagnostic information that will help you identify output variables causing test bench failures. This option is available on the PLC Code Generation pane in the Configuration Parameters dialog box. To enable this parameter, you must select the Generate testbench for subsystem option
Default: off
Enables generation of test bench code with additional diagnostic information.
Disables generation of test bench code with additional diagnostic information.
Parameter:
PLC_GenerateTestbenchDiagCode |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |
Use this option to control whether the generated Structured Text code contains
Function
instead of Function Block
. This
option is available for only the Phoenix
Contact
PC WORX or the PHOENIX CONTACT (previously KW) Software MULTIPROG target. There are certain cases where you may not be able to generate
code with Function
instead of Function Block
.
For example, if your Simulink subsystem or MATLAB Function block has internal state or persistent variables. In such
cases, the software issues a diagnostic warning.
This option is available on the PLC Code Generation pane in
the Configuration Parameters dialog box, when the Target IDE is
set to Phoenix Contact PC WORX 6.0
or
KW-Software MULTIPROG 5.0
.
Default: off
The generated Structured Text code contains
Function
instead of Function
Block
where possible.
Switch to the default behavior of the software.
Parameter:
PLC_EmitAsPureFunctions |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |
Emit a function with no inputs as a function instead of a function block. This option is available for only the Phoenix Contact PC WORX or the PHOENIX CONTACT (previously KW) Software MULTIPROG target.
When the Target IDE is set to Phoenix Contact PC
WORX 6.0
or KW-Software MULTIPROG 5.0
,
in the Configuration parameters dialog box, PLC Code Generation
pane, this option is available.
Default: off
The generated Structured Text code contains
Function
instead of Function
Blocks
when there is a function with no inputs.
The generated Structured Text code contains function blocks and no functions.
Parameter:
PLC_PureFunctionNoInputs |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |
Use this option to control whether the generated Structured Text code contains auto-generated data types for array types. This option is available for only the Phoenix Contact PC WORX or the PHOENIX CONTACT (previously KW) Software MULTIPROG target.
This option is available on the PLC Code Generation pane in
the Configuration Parameters dialog box, when the Target IDE is
set to Phoenix Contact PC WORX 6.0
or
KW-Software MULTIPROG 5.0
.
Default: off
The software automatically generates named types for array types in your Simulink model.
Switch to the default behavior of the software.
Parameter:
PLC_SuppressAutoGenType |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |
Use this option to control whether datatypeWorksheet
tags are
represented in code generated for Phoenix
Contact
PC WORX target. This option allows you to have finer control and generate
multiple datatypeWorksheet
definitions.
This option is available on the PLC Code Generation pane in
the Configuration Parameters dialog box, when the Target IDE is
set to Phoenix Contact PC WORX 6.0
.
Default: off
The datatypeWorksheet tags are marked as separate tags in the generated code.
No separate datatypeWorksheet tags are in the generated code.
Parameter:
PLC_EmitDatatypeWorkSheet |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |
Using this option, you can control inlining of Structured Text function calls for Rockwell Automation targets. By default, the software attempts to inline only math functions where possible. With this option, the software aggressively inlines all function calls so that the generated code has less number of Function blocks.
This option is available on the PLC Code Generation pane in
the Configuration Parameters dialog box, when the Target IDE is
set to Rockwell
Automation targets such as Rockwell Studio 5000: AOI
,
Rockwell Studio 5000: Routine
, Rockwell
RSLogix 5000: AOI
, or Rockwell RSLogix 5000:
Routine
.
Default: off
Aggressively inlines Structured Text function calls for RSLogix IDE.
Reverts to its default behavior and inlines only math function calls in the generated code.
Parameter:PLC_EnableAggressiveInlining |
Type: string |
Value:
'on' | 'off' |
Default:
'off' |