MATLAB Examples

Develop a Model that Complies with the IEC 61508 Standard

This example shows how to use Model Advisor checks for the IEC 61508 standard to develop a model and code that comply with the standard.

The IEC 61508 checks identify issues with a model that impede deployment in safety-related applications or limit traceability.


Understanding the Model

According to the functional requirements, a model shall be created that checks whether the 1-norm distance between points (x1,x2) and (y1,y2) is less than or equal to a given threshold thr. For two points (x1,x2) and (y1,y2), the 1-norm distance is given as:

$$ \sum_{i=1}^{2} | x_i -y_i | $$

The rtwdemo_iec61508 model implements the preceding requirement. Open and get familiar with the model.


Apply the IEC 61508 Modeling Standard Checks

To deploy the model in a safety-related software component that must comply with the IEC 61508 safety standard, check the model for issues that might impede deployment in such an environment or limit traceability between the model and generated source code.

To identify possible compliance issues with the model:

  1. Start the Model Advisor by selecting Analysis > Model Advisor or by entering modeladvisor('rtwdemo_IEC61508') at the MATLAB command line.
  2. In the Task Hierarchy, expand By Task > Modeling Standards for IEC 61508.
  3. Select the checks within the group.
  4. Select Show report after run to generate an HTML report that shows the check results.
  5. Click Run Selected Checks. Model Advisor processes the IEC 61508 checks and displays the results.

To review the check results and make changes:

  1. Review the Summary in the Report section of the right pane.
  2. In the Task Hierarchy, select a check that did not pass. Review the results that appear in the right pane for that check. For more information on the check and on how to resolve reported issues, with the check selected, click Help.
  3. Click the Generate Code Using Embedded Coder button in the model to inspect the generated code and the traceability report.
  4. Resolve the reported issues and rerun the checks.
  5. Review the generated HTML report of the check results by clicking the link in the Report box.
  6. Print the generated HTML report. You can use the report as evidence in the IEC 61508 compliance example process.

See Also

  • For more information on using Model Advisor, see Run Model Checks in the Simulink documentation.