| Simulink® | ![]() |
Create branches of block diagram that apply only to simulation or only to code generation
Signal Routing

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 RTW port only if code is being generated from the model. This allows you to create branches of a model's block diagram that apply only to simulation or only to code generation. The table below describes various scenarios where either the Sim or RTW port applies.
| Scenario | Output |
|---|---|
| Normal mode simulation | Sim |
| Accelerator mode simulation | Sim |
| Rapid Accelerator mode simulation | RTW |
| Simulation of a referenced model | Sim |
| External mode simulation | RTW |
| Standard code generation | RTW |
| Code generation of a referenced model | RTW |
| Processor-in-the-loop target code generation | Sim |
Real-Time Workshop® does not generate code for blocks connected to the Sim port. If you enable block reduction optimization (see Block reduction in the online Simulink® documentation), Simulink software eliminates blocks in the branch connected to the block's RTW port when compiling the model for simulation.
Note Real-Time Workshop eliminates the blocks connected to the Sim branch only if the Sim branch has the same signal dimensions as the RTW branch. Regardless of whether it eliminates the Sim branch, Real-Time Workshop uses the sample times on the Sim branch as well as the RTW branch to determine the fundamental sample time of the generated code and may, 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 numeric or data type. It outputs the type at its input.

Multidimensionalized | Yes |
![]() | Enabled Subsystem | Extract Bits | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |