Main Content

Combine output and update methods for code generation and simulation

Option to require same execution order for simulation and generated code

Model Configuration Pane: Diagnostics

Description

This parameter specifies whether Simulink® requires that simulation and generated code have the same execution order when output and update code are combined in the same function. For certain modeling patterns, enabling this parameter prevents a potential mismatch between simulation results and results obtained using generated code. If your model requires enabling this parameter, Simulink issues a warning that indicates a potential mismatch between simulation and code generation results. You might see this warning for models that meet these conditions:

  • A referenced model has a single function for output and update code, uses function prototype control, or generates C++ code.

  • A referenced model input port connects only to blocks that do not have direct feedthrough, such as Delay and Integrator blocks and is not associated with a function-call subsystem port in the referenced model. Blocks that do not have direct feedthrough do not use the block input values for the current time step to calculate the block output values for the current time step.

  • The referenced model uses a shared global resource such as a global data store.

Settings

off (default) | on

Enabling this parameter can create artificial algebraic loops. Enable this parameter only if you plan to generate code from your model and you see a warning about a potential mismatch between simulation and code generation.

off

Simulink does not force simulation and code generation to use the same execution order. For certain modeling patterns, the simulation execution order can differ from the execution order in generated code. If the execution order is different, the results you obtain in simulation might not match results you obtain from the generated code.

on

Simulink forces simulation and code generation to use the same execution order when output and update code are combined in a single function.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: ForceCombineOutputUpdateInSim
Type: string | character vector
Values: 'on' | 'off'
Default: 'off'

Version History

Introduced in R2017b