Create branches of block diagram that apply only to simulation or only to code generation
This block outputs the signal at its Sim port only if the model that contains it is being simulated. It outputs the signal at its Coder port only if code is being generated from the model. This option enables you to create branches of a block diagram that apply only to simulation or code generation. The table below describes various scenarios where either the Sim or Coder port applies.
|Normal mode simulation||Sim|
|Accelerator mode simulation||Sim|
|Rapid Accelerator mode simulation||Sim|
|Simulation of a referenced model (Normal or Accelerator modes)||Sim|
|Simulation of a referenced model (Processor-in-the-loop (PIL) mode)||Coder|
(uses the same code generated for a referenced model)
|External mode simulation||Coder|
|Standard code generation||Coder|
|Code generation of a referenced model||Coder|
Simulink® Coder™ software does not generate code for blocks connected to the Sim port if these conditions hold:
On the Optimization > Signals and Parameters pane
of the Configuration Parameters dialog box, you set Default
parameter behavior to
The blocks connected to the Sim port do not have external signals.
The Sim port input path does not contain an S-function or an Interpreted MATLAB Function block.
If you enable block reduction optimization, Simulink eliminates blocks in the branch connected to the Coder port when compiling the model for simulation. For information about block reduction, see Block reduction in the online Simulink documentation.
Note Simulink Coder code generation eliminates the blocks connected to the Sim branch only if the Sim branch has the same signal dimensions as the Coder branch. Regardless of whether it eliminates the Sim branch, Simulink Coder uses the sample times on the Sim branch as well as the Coder branch to determine the fundamental sample time of the generated code and might, in some cases, generate sample-time handling code that applies only to sample times specified on the Sim branch.
The Environment Controller block accepts signals of any data type that Simulink supports. The output uses the same data type as the input.
For more information, see Data Types Supported by Simulink in the Simulink documentation.
Double | Single | Boolean | Base Integer | Fixed-Point | Enumerated | Bus