Trace Stateflow Elements in Generated Code - MATLAB & Simulink (original) (raw)

Main Content

To verify the generated code for your Stateflow® elements, you can trace Stateflow elements in your model to the generated code by using these types of navigation:

Inline Traceability for Stateflow Elements

Inline traceability refers to the line-level traceability available in the generated code. You can click the hyperlinked line numbers to trace the corresponding Stateflow elements.

This example shows how to use hyperlinks for tracing code-to-Stateflow elements:

  1. Open the exampleAirportConveyorBeltControlSystemExample.
    openExample('plccoder/AirportConveyorBeltControlSystemExample')
  2. Open the app. Click the tab.
  3. Click Settings and navigate to the Code Generation pane.
  4. To enable report generation, select > .
  5. Click OK.
  6. Click to initiate code and report generation. The code generation report for the top model opens in an HTML Viewer window.
  7. In the left navigation pane, select theplcdemo_airport_conveyor.exp file.
  8. Click the hyperlink on line 65. In the Stateflow chart, the correspondingStop_F1 state is highlighted.
    Click on the hyperlink to highlight the associated state in the Stateflow chart.

Trace States and Transitions to Code

This example shows how to trace Stateflow states and transitions to the generated code:

  1. Open the exampleAirportConveyorBeltControlSystemExample.
    openExample('plccoder/AirportConveyorBeltControlSystemExample')
  2. Open the app. Click the tab.
  3. Click Settings and navigate to the Code Generation pane.
  4. To enable report generation, select > .
  5. Click OK.
  6. Click to initiate code and report generation. The code generation report for the top model opens in an HTML Viewer window.
  7. In the Controller subsystem, Control block, select the Run_F1 state. In the HTML code generation report, the generated code for the state is highlighted.
    Click on highlighted state and corresponding lines are highlighted in the generated code.

See Also

Topics