Main Content

Fold temporary variable using function block instance output variable

Optimize output variables by using expression folding

Since R2022b

Model Configuration Pane: PLC Code Generation / Optimization

Description

The Fold temporary variable using Function Block instance output variable parameter optimizes the code for the output variables of function blocks generated from reusable Simulink® subsystems, Stateflow® charts, or MATLAB® Function blocks by removing temporary variable assignments that are not required.

Settings

off (default) | on

Default: off

On

Generates optimized code for output variables of function blocks by folding temporary variables into a single expression.

Off

The generated code for function block instance output variables uses temporary variable assignments.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Programmatic Use

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

Limitations

This option is not supported for the Rockwell Automation® Studio 5000 and OMRON Sysmac® Studio target IDEs.

Do not use this option when you have enabled the PLC_UseCallOutputArgSyntax parameter. If you enable PLC_UseCallOutputArgSyntax, Simulink PLC Coder™ throws a warning during code generation and sets PLC_UseCallOutputArgSyntax to 'off'.

You cannot select this parameter when the Target IDE parameter is set to Schneider Electric - EcoStruxure Control Expert. When you set the Target IDE parameter to Schneider Electric - EcoStruxure Control Expert, Simulink PLC Coder sets this parameter to "off".

Version History

Introduced in R2022b