Stateflow Previous page   Next Page

Define the Stateflow Interface

Now that you have defined events and data in your Stateflow diagram as Input from Simulink, you must now make connections in the Simulink model between other blocks and the Stateflow block to provide sources for the events and data. This model has the following final appearance:

To construct this model in Simulink using your existing chart, do the following:

  1. Add two Manual Switch blocks (located in the Simulink Sources block library).
  2. Label the top switch Switch Events, and the bottom switch temp value.
  3. Place four Constant blocks (located in the Simulink Sources block library) to the left of the switches.
  4. Connect two Constant blocks to each switch to provide pole inputs.
  5. Double-click each Constant block to set its Constant value parameter as shown in the previous diagram.
  6. Connect the output of the temp value switch to the temp data input port on the Stateflow block.
  7. Place a Mux block (located in the Simulink Sinks block library) on the output side of the Switch Events switch.
  8. Double-click the Mux block to set its Number of inputs parameter to 2.
  9. Connect the output of the Switch Events switch in parallel to both of the Mux input ports.
  10. Connect the single output port of the Mux to the trigger input port of the Stateflow Chart block On-Off.


Previous page  Define Input Data Define Simulink Parameters Next page

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