Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Verification and Validation   

Including Requirements Information with Generated Code

After you simulate your model and verify its performance against the requirements, you can generate code from the model for an embedded real-time application.

The Real-Time Workshop® Embedded Coder™ software generates code for Embedded Real-Time (ERT) targets. If the model has any links to requirements, while generating the code, the software also inserts hyperlinks to any linked requirements documents in the code comments.

For example, if a block has a requirement, the Real-Time Workshop Embedded Coder software generates code for that block. In the code comments for that block, the software inserts a hyperlink to the requirements document that contains the requirement associated with that block.

Generated code includes requirements descriptions and hyperlinks to the requirements documents in the following locations.

Model Object

Requirements Location

Model

In the main header file, <model>.h

Nonvirtual subsystems

At the call site for the subsystem

Virtual subsystems

At the call site of the closest nonvirtual parent subsystem. If a virtual subsystem does not have a nonvirtual parent, requirement descriptions appear in the main header file for the model, <model>.h.

Nonsubsystem blocks

In the generated code for the block

To specify that generated code of an ERT target include requirements:

  1. Open the rtwdemo_requirements demo model.

  2. Select Simulation > Configuration Parameters.

  3. In the Configuration Parameters dialog box, on the Select pane, select the Real-Time Workshop node.

    The currently configured system target must be an ERT target.

  4. Under Real-Time Workshop, select Comments.

  5. In the Custom comments section on the right, select the Requirements in block comments check box.

  6. Under Real-Time Workshop, select Report.

  7. On the Report pane, select:

    • Create code generation report

    • Launch report automatically

  8. On the Real-Time Workshop pane, click Build.

  9. In the code-generation report, open rtwdemo_requirements.c.

  10. Scroll to the code for the Pulse Generator block, clock, for the hyperlink to the requirement linked to that block.

  11. Click the link to open the requirements document.

      Note   When you click a requirements link in the code, the software opens the application for the requirements document, except in DOORS software. To view a DOORS requirement document, start the DOORS software and log in before clicking the hyperlink in the code.

  


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