IEC 61508 Checks

IEC 61508 Checks Overview

IEC 61508 checks facilitate designing and troubleshooting Simulink models and subsystems and the code that you generate from it for applications that need to comply with IEC 61508-3.

Tip

If your model uses model referencing, run the IEC 61508 checks on all referenced models before running them on the top-level model.

See Also

Display model metrics and complexity

Display model metrics and complexity information.

Description

The IEC 61508 standard recommends the usage of size and complexity metrics to assess the software under development. This check provides model metrics information for the model. The provided information can be used to inspect whether the size or complexity of the model or subsystem exceeds given limits. The check displays:

See IEC 61508-3, Table A.9 (5) – Software complexity metrics.

Results and Recommended Actions

ConditionRecommended Action
N/A This summary is provided for your information. No action is required.

See Also

Check for unconnected objects

Identify unconnected lines, input ports, and output ports in the model.

Description

Unconnected objects are likely to cause problems propagating signal attributes such as data, type, sample time, and dimensions.

Ports connected to Ground or Terminator blocks pass this check.

See IEC 61508-3, Table A.3 (3) — Language subset.

Results and Recommended Actions

ConditionRecommended Action
There are unconnected lines, input ports, or output ports in the model or subsystem.
  • Double-click an element in the list of unconnected items to locate the item in the model diagram.

  • Properly connect the objects identified in the results.

See Also

Working with Signals in the Simulink documentation

Check for fully defined interface

Identify root model Inport blocks that do not have fully defined attributes.

Description

Using root model Inport blocks that do not have fully define dimensions, sample time, or data type can lead to undesired simulation results. Simulink back-propagates dimensions, sample times, and data types from downstream blocks unless you explicitly assign these values.

See IEC 61508-3, Table B.9 (5) – Fully defined interface.

Results and Recommended Actions

ConditionRecommended Action
The model has root-level Inport blocks that have undefined attributes, such as an inherited sample time, data type, or port dimension.Explicitly define all root-level Inport block attributes identified in the results. Double-click an element from the list of underspecified items to locate the condition.

Tip

The following configurations pass this check:

See Also

Check for questionable blocks

Identify blocks not supported by code generation or not recommended for deployment.

Description

This check partially identifies model constructs that are not suited for code generation or not recommended for production code generation as identified in the Simulink Block Support tables for Real-Time Workshop and Real-Time Workshop Embedded Coder. If you are using blocks with support notes for code generation, review the information and follow the given advice.

See IEC 61508-3, Table A.3 (3) – Language subset.

Results and Recommended Actions

ConditionRecommended Action
The model or subsystem contains blocks that should not be used for code generation. Consider replacing the blocks listed in the results. Double-click an element from the list of questionable items to locate condition.
The model or subsystem contains blocks that should not be used for production code deployment. Consider replacing the blocks listed in the results. Double-click an element from the list of questionable items to locate condition.
The model or subsystem contains Gain blocks whose value equals 1. If you are using Gain blocks as buffers, consider replacing them with Signal Conversion blocks. Double-click an element from the list of questionable items to locate condition.

Limitation

This check might not identify all instances of noncompliance with the Real-Time Workshop and Real-Time Workshop Embedded Coder Simulink Block Support tables.

See Also

Check usage of Stateflow

Identify usage of Stateflow that can impact safety.

Description

This check identifies instances of Stateflow software being used in a way that can impact an application's safety, including

See

Results and Recommended Actions

ConditionRecommended Action
A Stateflow chart is not configured for strong data typing on boundaries between a Simulink model and theStateflow chart.Enable the option Use Strong Data Typing with Simulink I/O for the Stateflow chart. When you enable this option, the Stateflow chart accepts input signals of any data type that Simulink models support, provided that the type of the input signal matches the type of the corresponding Stateflow input data object.
Signals have names that differ from those of their corresponding Stateflow ports.
  • Check whether the ports are connected properly and, if not, correct the connections.

  • Change the names of the signals or the Stateflow ports so that the names match.

Events are not defined in the Stateflow hierarchy at the chart level or below.Define events at the chart level or below.
Local data is not defined in the Stateflow hierarchy at the chart level or below.Define local data at the chart level or below.

A new line is missing from a state action after

  • An entry (en), during (du), or exit (ex) statement

  • The semicolon (;) at the end of an assignment statement

Add missing new lines.

See Also

See the following topics in the Stateflow documentation

Display configuration management data

Display model configuration and checksum information.

Description

This informer check displays the following information for the current model:

See IEC 61508-3, Table A.8 (5) – Software configuration management.

Results and Recommended Actions

ConditionRecommended Action
Could not retrieve model version and checksum information. This summary is provided for your information. No action is required.

See Also

Check usage of Simulink

Identify usage of Simulink blocks that can impact safety.

Description

Blocks that you use incorrectly can result in unreachable code, incorrect or unpredictable results, infinite loops, and unpredictable execution times in generated code.

This check inspects your model for proper usage of:

See

Results and Recommended Actions

ConditionRecommended Action
The model or subsystem contains an Abs block that is operating on a Boolean or an unsigned input data type. This condition results in unreachable simulation pathways through the model and might result in unreachable code.
  • Change the input of the Abs block to a signed input type.

  • Remove the Absfrom the model.

The model or subsystem contains an Abs block that is operating on a signed integer value, and the Saturate on integer overflow check box is cleared. For signed data types, the absolute value of the most negative value is problematic since it is not representable by the data type. This condition results in an overflow in the generated code. Select the Saturate on integer overflow check box of the specified Abs blocks.
The model or subsystem contains a block computing a relational operator that is operating on different data types. The condition can lead to unpredictable results in the generated code. For the specified blocks, use common data types as inputs.
The model or subsystem contains a block computing a relational operator that is not generating Boolean data as its output. This condition violates strong data typing rules and can lead to unpredictable results in the generated code. Set the Output data type to boolean in the Block Parameters > Signal Attributes pane for the specified blocks.
The model or subsystem contains a block computing a relational operator that uses the == or ~= operator to compare floating-point signals. The use of these operators on floating-point signals is unreliable and unpredictable because of floating-point precision issues, and can lead to unpredictable results in the generated code.

For the specified blocks, do one of the following:

  • Change the signal data type.

  • Rework the model to eliminate the need to use == or ~= operators on floating-point signals.

The model or subsystem contains a While Iterator block that has unlimited iterations. This condition can lead to infinite loops in the generated code.

For the specified While Iterator blocks:

  • Set the Maximum number of iterations (-1 for unlimited) parameter to a positive integer value.

  • Consider selecting the Show iteration number port check box and observe the iteration value during simulation.

The model or subsystem contains a For Iterator block that has variable iterations. This condition can lead to unpredictable execution times or infinite loops in the generated code.

For the specified For Iterator blocks, do one of the following:

  • Set the Iteration limit source parameter to internal.

  • If the Iteration limit source parameter must be external, use a Constant, Probe, or Width block as the source.

  • Clear the Set next i (iteration variable) externally check box.

  • Consider selecting the Show iteration variable check box and observe the iteration value during simulation.

See Also

Descriptions of the following blocks in the Simulink reference documentation:

  


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