Documentation Center

  • Trial Software
  • Product Updates

Conditional Subsystem Output Initialization

Why Initialize Conditional Subsystem Output with Explicit Values?

By default, Simulink® uses values from the inputs to a conditional subsystem during simulation. Alternatively, you can explicitly set the initial values, which can be useful for:

  • Specifying initial behaviors that meet your modeling goals, such as testing a model

  • Setting initial values that reduce simulation time by reaching steady state faster

  • Making the model behavior easier to understand without having to trace input signals to determine the initial values

For details, see Specify or Inherit Conditional Subsystem Initial Values.

Initialization Mode

Initialization mode controls how Simulink handles the initialization values for conditionally executed subsystems.

The initialization mode also specifies how Simulink handles the initial values for Merge blocks, subsystem elapsed time, and Discrete-Time Integrator blocks. Usually the main impact of the initialization mode for Merge blocks and Discrete-Time Integrator blocks is in the context of those blocks being used with a conditional subsystem.

The default initialization mode is Simplified. Classic mode was the only way that Simulink handled initial conditions prior to R2008b. Simplified mode uses enhanced processing, which can improve consistency of simulation results compared to Classic mode. For examples of some of the issues that simplified mode addresses, see Address Classic Mode Issues by Using Simplified Mode.

    Note:   When saving a new model configuration set as a Simulink.ConfigSet object, the parameter Configuration Parameters > Diagnostics > UnderspecifiedInitializationDetection is set to Classic.

To help you choose which initialization mode to use, see:

For details about setting initialization mode, see Set Initialization Mode to Simplified or Classic.

When to Use Simplified Initialization

In general, using simplified initialization mode helps you to:

  • Attain the same simulation results with the same inputs when using the same blocks in a different model.

  • Avoid unexpected changes to simulation results as you modify a model.

Use simplified initialization mode for models that contain one or more of the following blocks:

  • Conditional subsystem

  • Merge block

  • Discrete-Time Integrator block

Use simplified mode if your model uses features that require simplified initialization mode, such as:

  • Specify a structure to initialize a bus.

  • Branch merged signals inside a conditional subsystem.

Determine whether using simplified mode meets your modeling requirements. For details, see Simplified Mode Behavior and Requirements.

Simplified Mode Behavior and Requirements

Simplified mode affects the output of the conditional subsystem and the behavior of some blocks. Also, simplified mode has some model configuration requirements.

Output

  • The output signal of a conditional subsystem is stored in separate memory that is not shared by with any other Outport block. The initialization behavior of the memory is fully specified at the start of simulation.

  • Conditional subsystem output ports can either explicitly specify an initial condition value or inherit that value from the block within the subsystem that is connected to the Outport block input port.

  • Simplified mode always uses the initial value as both the initial and reset value for output for a Discrete-Time Integrator block.

Outport Blocks

Simplified mode has the following behavior with Outport blocks:

  • If the Source of initial output value parameter is set to Input signal, in simplified mode Simulink assumes the Initial output value is derived from the input signal. This can result in initialization behavior that is different from classic mode. However, the initialization behavior in simplified mode is generally more robust.

  • The Outport block can inherit the initial output value from a limited number of blocks. If it inherits from outside this limited list of blocks, then the Outport block uses the default initial value of the output data type. For details, see Specify or Inherit Conditional Subsystem Initial Values.

You cannot use a Simulink.Signal object to specify the Initial output value.

Merge Blocks

  • If a root Merge block has an empty matrix ([]) for it initial output value, Simulink uses the default ground value of the output data type. A root Merge block is any Merge block with an output port that does not connect to another Merge block.

  • You cannot use single-input Merge blocks.

Discrete-Time Integrator Blocks

Discrete-Time Integrator block behaves differently in simplified mode than it does in classic mode. The changes for simplified mode promote more robust and consistent model behavior. For details, see Behavior When Using Simplified Initialization Mode in the Discrete-Time Integrator block reference documentation.

Library Blocks

Simulink creates a library assuming that classic mode is in effect. If you use a library block that is affected by simplified mode in a model that uses simplified mode, then use the Model Advisor to identify changes you need to make so that the library block works with simplified mode.

When to Use Classic Initialization

Simplified initialization mode offers many benefits, compared to classic mode. Classic mode was the default initialization mode for Simulink models created in R2013b or before. You can continue to use classic mode on those models if:

Was this topic helpful?