Main Content

PLC Coder:Interface

Interface Overview

The PLC Code Generation > Interface category includes parameters for configuring the interface of the generated code.

See Also

Generate Structured Text from the Model Window

Generate Logging Code

With this option, you can generate code with logging instrumentation to collect run-time data on supported PLC targets. The PLC target IDEs must have support for inout variables. For Rockwell Automation® targets, you can set up an Open Platform Communications (OPC) server and use the Simulation Data Inspector (SDI) in Simulink® to visualize and monitor the logging data.

This option is available on the PLC Code Generation > Interface pane in the Configuration Parameters dialog box.

Settings

Default: off

On

Generate Function block logging code for supported targets.

Off

No logging instrumentation is included in the generated code.

Command-Line Information

Parameter: PLC_GenerateLoggingCode
Type: string
Value: 'on' | 'off'
Default: 'off'

See Also

Generate Structured Text from the Model Window

Keep Top-Level ssmethod Name the Same as the Non-Top Level Name

Prevent renaming the SS_OUTPUT type to SS_STEP type from the top-level subsystem argument interface. When you select this option, the software emits the same ssMethod type in the code generation for both top and non-top level blocks.

This option is available on the PLC Code Generation > Interface pane in the Configuration Parameters dialog box.

Settings

Default: off

On

Generated code for top-level block does not contain the SS_STEP type in generated code.

Off

Generated code contains SS_STEP AND SS_OUTPUT type function blocks.

Command-Line Information

Parameter: PLC_RemoveSSStep
Type: string
Value: 'on' | 'off'
Default: 'off'

See Also

Remove Top-level Subsystem Ssmethod Type

Use this option to remove the ssmethod type from the top-level subsystem argument interface. When this option is enabled, the software removes the ssmethod type and converts the subsystem initialization code from switch case statement to conditional if statement. As a result, the generated code has the same interface as the model subsystem.

This option is available on the PLC Code Generation > Interface pane in the Configuration Parameters dialog box.

Settings

Default: off

On

Remove top level function block ssmethod type in generated code.

Off

Generated code contains ssmethod type Function block and switch case statements.

Command-Line Information

Parameter: PLC_RemoveTopFBSSMethodType
Type: string
Value: 'on' | 'off'
Default: 'off'

See Also

Generate Structured Text from the Model Window

Remove Initialization Statements for Externally Defined State Variables

Use this option to remove initialization assignment statements for variables that have storage class ImportedExtern and ExportedGlobal from the generated code.

Mark ExportedGlobal variables as externally defined. For more information, see Externally Defined Identifiers

Settings

Default: off

On

Remove from the generated code initialization assignment statements for variables that have storage class ImportedExtern and ExportedGlobal.

Off

Generated code contains initialization assignment statements for variables that have storage class ImportedExtern and ExportedGlobal.

Command-Line Information

Parameter: PLC_PreventExternalVarInitialization
Type: string
Value: 'on' | 'off'
Default: 'off'

See Also

Absolute-Time Temporal Logic

Use this option to specify if the generated code uses the target timer or a target-independent counter for Stateflow® absolute-time temporal logic semantics implementation.

Settings

Default: Target Timer

Target Timer

Generated code uses the target timer to implement Stateflow absolute-time temporal logic semantics.

Target-independent Counter

Generated code contains a target-independent integer counter to implement Stateflow absolute-time temporal logic semantics.

Command-Line Information

Parameter: PLC_AbsTimeTemporalLogic
Type: character vector
Value: 'timer' | 'counter'
Default: 'timer'

Limitations

  • Absolute-time temporal logic does not support stateflow chart using global clocks.

  • Testbench code verification can fail for absolute-time temporal logic using floating-point comparison operations.

Exclude block definitions as Functions

Use this option to enter a list of full paths to model components whose definitions you want to exclude from the generated code.

Settings

Default: empty path

Suppresses the definition of model components in the generated code. When you import the generated code into the PLC IDE, you must provide definitions for the excluded modules, which are generated as functions. Specify the full paths to the model components that you want to exclude as a list of comma-separated values.

Limitations

  • The model components that you exclude must be:

    • Subsystem blocks

    • MATLAB® Function blocks

    • Stateflow charts

  • Top-level subsystems marked as external are not allowed.

  • The same block must not be included in the Exclude block definitions as function blocks.

  • The model components that are marked for exclusion, must not:

    • Have cell array data types as inputs or outputs.

    • Contain virtual bus components.

    • Have any input or output ports that use array data types.

  • The data types used in the model components to be excluded must be of only type numeric or struct.

  • Model subsystem blocks that have a single output which is of struct or array data type cannot be marked for exclusion.

Command-Line Information

Parameter: PLC_ExcludeBlocksAsFunction
Type: string
Value: string
Default: ''

Exclude block definitions as Function blocks

Use this option to enter a list of full paths to model components whose definitions you want to exclude from the generated code.

Settings

Default: empty path

Suppresses the definition of model components in the generated code. When you import the generated code into the PLC IDE, you must provide definitions for the excluded modules, which are generated as function blocks. Specify the full paths to the model components you want to exclude as a list of comma-separated values.

Limitations

  • The model components that you exclude must be:

    • Subsystem blocks

    • MATLAB Function blocks

    • Stateflow charts

  • Top-level subsystems marked as external are not allowed.

  • The same block must not be included in the Exclude block definitions as functions.

  • The model components that are marked for exclusion, must not:

    • Have cell array data types as inputs or outputs.

    • Contain virtual bus components.

  • The data types used in the model components to be excluded must be of only type numeric or struct.

Command-Line Information

Parameter: PLC_ExcludeBlocksAsFunctionBlock
Type: string
Value: string
Default: ''

Use output argument syntax in function and function block calls

Enable this parameter to generate code that uses the => syntax for function block outputs.

Settings

Default: off

On

Generated code contains the => syntax for function block outputs.

Off

Generated code does not contain the => syntax for function block outputs.

Limitations

  • If you currently use the fUseCallOutputArgSyntax plugin Simulink PLC Coder™ recommends enabling this parameter instead. The fUseCallOutputArgSyntax plugin option will be removed in a future release.

  • Do not use this option when the Target IDE parameter is set to Selectron. The Selectron IDE uses the fSimplifyFunctionCallExpr that changes the call expressions from name:=value assignments to a simple call like function(value1,value2) as it does not support assignments in function call expressions. Since assignments are not supported by the Selectron IDE, output assignments do not work.

Command-Line Information

Parameter: PLC_UseCallOutputArgSyntax
Type: string
Value: 'on' | 'off'
Default: 'off'