Stateflow User's Guide Previous page   Next Page

Adding Sensor Data

You can simulate sensors in Simulink with a sensor value and a time interval for which the sensor reports its value. In Adding a Sensor Event, you added an event to simulate the reporting time for a sensor. Now you need to add a data value to the Stateflow block to simulate the value of the sensor in the following steps:

  1. In the Stateflow diagram editor, from the Add menu, select Data and add a data named temp with scope Input from Simulink.
  1. A port appears on the left side of the Controller block in the Simulink model for the new data temp as shown.

  1. Right-click the bottom Constant block and drag-copy a new Constant block under the Sine Wave block.
  2. Connect the output of the new Constant block to the input port for the data temp on the left side of the Controller block as shown.

  1. The source for the value of the data temp is the value of the Constant block. You can change this value during simulation by double-clicking the Constant block and entering a new value in the Constant value field in the resulting Block Parameters dialog and clicking Apply.

  1. Save the model (as SFcontrol3.mdl).

Previous page  Adding a Sensor Event Adding a Junction for Flow Control Next page

© 1994-2005 The MathWorks, Inc.