Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Action Port - Implement Action subsystems used by if and switch control flow statements in Simulink software

Library

Ports & Subsystems

Description

Action Port blocks implement Action subsystems used in if and switch control flow statements. The Action Port block is available in the If Action Subsystem and the Switch Case Action Subsystem.

Use Action Port blocks to create Action subsystems as follows:

  1. Place a subsystem in the system containing the If or Switch Case block.

    You can use an ordinary subsystem or an atomic subsystem. In either case, the resulting Action subsystem is atomic.

  2. Add an Action Port to the new subsystem.

    This block adds an input port named Action to the subsystem, which is now an Action subsystem.

Action subsystems execute their programming in response to the conditional outputs of an If or Switch Case block. Use Action subsystems as follows:

  1. Create an Action subsystem for each output port configured for an If or Switch Case block.

  2. Connect each output port to the Action port on an Action subsystem.

    • if, else, or elseif ports for the If block

    • case or default ports for the Switch Case block

    When you make a connection, the icon changes for the subsystem and the Action Port block it contains to the name of the output port for the If or Switch Case block (for example, if{ }, else{ }, elseif{ }, case{ }, or default{ }).

  3. Open the new subsystem and add the diagram that you want to execute in response to the condition this subsystem covers.

Data Type Support

There are no data inputs or outputs for Action Port blocks.

Parameters and Dialog Box

States when Simulink resumes execution

Specify how to handle internal states when a subsystem with an Action Port block reenables.

Settings

Default: held

held

When the subsystem reenables, retains the states of the Action subsystem with their previous values. Retains the previous values of states between calls even if calling other member Action subsystems of an if-else or switch control flow statement.

reset

Reinitializes the states of the Action subsystem to initial values when the subsystem reenables.

Reenablement of a subsystem occurs when called and the condition of the call is true after having been previously false. In the following example, the Action Port blocks for both Action subsystems A and B have the States when execution is resumed parameter set to reset.

If case[1] is true, call Action subsystem A. This result implies that the default condition is false. When later calling B for the default condition, its states are reset. In the same way, Action subsystem A states are reset when calling A right after calling Action subsystem B.

Repeated calls to the Action subsystem of a case does not reset its states. If calling A again right after a previous call to A, this action does not reset the states of A. This behavior is because the condition of case[1] was not previously false. The same applies to B.

Command-Line Information

Parameter: InitializeStates
Type: string
Value: 'held' | 'reset' |
Default: 'held'

Propagate sizes of variable-size signals

Specify when to propagate a variable-size signal.

Settings

Default: Only when execution is resumed

Only when execution is resumed

Propagates variable-size signals only when reenabling the subsystem containing the Action Port block.

During execution

Propagates variable-size signals at each time step.

Command-Line Information

Parameter: PropagateVarSize
Type: string
Value: 'Only when execution is resumed' | 'During execution'
Default: 'Only when execution is resumed'

Characteristics

Sample Time

Inherited from driving If or Switch Case block

See Also

If, If Action Subsystem, Switch Case, and Switch Case Action Subsystem blocks for examples using Action Port blocks

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS