Main Content

Environment Controller

(Removed) Create branches of block diagram that apply only to simulation or only to code generation

Environment Controller block has been removed. Use the Variant Source block instead. For more information, see Compatibility Considerations.

  • Environment Controller block

Libraries:
Simulink / Signal Routing

Description

The Environment Controller 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. This table describes various scenarios where either the Sim or Coder port applies.

ScenarioOutput
Normal mode simulationSim
Accelerator mode simulationSim
Rapid accelerator mode simulationSim
Simulation of a referenced model in normal or accelerator modesSim
Simulation of a referenced model in processor-in-the-loop (PIL) modeCoder
(uses the same code generated for a referenced model)
External mode simulationCoder
Standard code generationCoder
Code generation of a referenced modelCoder

Simulink® Coder™ software does not generate code for blocks connected to the Sim port if these conditions hold:

  • On the Code Generation > Optimization pane of the Configuration Parameters dialog box, you set Default parameter behavior to Inlined.

  • 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 more information, see Block reduction.

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.

Ports

Input

expand all

Simulation input values, specified as a scalar, vector, or matrix. Input signal must have the same width as the input to the Coder port.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus

Code generation input values, specified as a scalar, vector, or matrix. Input signal must have the same width as the input to the Sim port.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus

Output

expand all

Values from the Sim or Coder input port, depending on the current environment. For more information on what the block outputs in various simulation and code generation modes, see Description.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus

Block Characteristics

Data Types

Boolean | bus | double | enumerated | fixed point | half | integer | single

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced before R2006a

expand all