Main Content

Add Stateflow Chart Behavior to Architecture Component

A state chart diagram demonstrates the state-dependent behavior of a component throughout its state lifecycle and the events that can trigger a transition between states. Add Stateflow® Chart behavior to describe a System Composer™ architectural component using state machines.

State charts consist of a finite set of states with transitions between them to capture the modes of operation for the component. Charts allow design for different modes, internal states, and event-based logic of a system. You can also use charts as stubs to mock a complex component implementation during top-down integration testing. A Stateflow license is required to use this functionality. For more information, see Stateflow.

Add State Chart Behavior to a Component

A System Composer component with stereotypes, interfaces, requirement links, and ports, is preserved when you add Stateflow Chart (Stateflow) behavior.

  1. This example uses the architecture model for an unmanned aerial vehicle (UAV) to add state chart behavior to a component. Enter the following command:

    scExampleSmallUAV

  2. Double-click the Airframe component. Select the LandingGear component on the System Composer composition editor.

  3. Select the Brake port. Open the Interface Editor from the toolstrip Design > Interface Editor. Right-click the interface operatorCmds and select Assign to Selected Port(s).

  4. Right-click the LandingGear component and select Create Stateflow Chart Behavior. Alternatively, on the toolstrip, under Component, click Create Stateflow Chart Behavior.

    View of menu option for the landing gear component to create Stateflow chart behavior.

  5. Double-click LandingGear, which has the Stateflow icon. In the Modeling menu, select Design Data, then click Symbols Pane to view the Stateflow symbols. The input port Brake appears as input data in the Symbols pane.

    Note

    Some Stateflow objects remain local to Stateflow Charts. Input and output event ports are not supported in System Composer. Only local events are supported.

    The Stateflow canvas in the landing gear component. The port Brake is displayed in the symbols pane.

    Since Stateflow ports show up as input and output data objects, they must follow Stateflow naming conventions. Ports are automatically renamed to follow Stateflow naming conventions. For more information, see Guidelines for Naming Stateflow Objects (Stateflow).

  6. Select the Brake input and view the interface in the Property Inspector. The interface can be accessed like a Simulink® bus signal. For information on how to use bus signals in Stateflow, see Index and Assign Values to Stateflow Structures (Stateflow).

    The interface named operator commands is shown as a bus.

  7. You can populate the Stateflow canvas to represent the internal states of the LandingGear.

    Stateflow canvas showing the states Deployed and Stowed.

A Stateflow Chart behavior added to a component is part of the same System Composer architecture model that contains the component.

Inline Stateflow Chart Behavior

You can inline a component with a Stateflow Chart behavior to delete the contents inside the Stateflow Chart while preserving interfaces.

  1. Right-click on the LandingGear component and select Inline Behavior.

    The Inline Stateflow Chart behavior menu for a component Landing Gear.

  2. To confirm the operation to delete all the content inside the Stateflow Chart behavior, click OK.

  3. The Stateflow Chart behavior on the component is removed and the component is inlined with interfaces.

    Inlined landing gear component with no Stateflow Chart behavior component badge.

See Also

|

Related Topics