AeroCoder
Open the tools

DO-178C HANDBOOK · CONTENTS

DO-178C HANDBOOK

/

Model-Based Development (DO-331)

Traceability Through Models

Linking requirements, model elements, generated code and tests — at the right granularity.

Desk summary

  • 01Traceability on a model-based project is the same bidirectional chain DO-178C always demanded — system requirement → high-level requirement → low-level requirement/architecture → source code → executable — except that one or more of those layers is now a model.
  • 02The link from a requirement to a model is made to a model element (a subsystem, chart, state, transition or block), not to a page or paragraph, so the granularity you choose decides how useful — and how expensive — the trace is.
  • 03Generated code carries its own trace back to the model (comments and a code-generation traceability report); that trace must be checked, not just trusted, unless a qualified tool does the checking.
  • 04Tests trace to requirements, not to model blocks; model and code coverage then reveal model elements and code that no requirement-based test reached.
  • 05Auditors find the same gaps on almost every MBD program: unlinked model elements, derived model logic with no derived requirement, stale links after refactoring, and generated low-level tests that trace to nothing.

Intuition

Think of it like a family tree with photographs

Classic traceability is a family tree drawn as a list of names. With models, the middle generations are photographs instead of names: you can see every detail of a person, but the tree is only useful if every photo is labelled with who its parents and children are. A link from a requirement to a model element is that label. Without it, a beautiful model is just a picture of somebody — you cannot prove it is the person the requirement asked for, or that nobody extra sneaked into the photo.

The trace chain on a model-based project

DO-178C requires bidirectional trace between system requirements allocated to software and the high-level requirements (HLRs), between HLRs and low-level requirements (LLRs), and between LLRs and source code, plus trace from requirements to the test cases that verify them (see Traceability). DO-331 keeps every one of those obligations and adds a twist: when a layer is expressed as a model, the trace endpoints become model elements, and DO-331 asks you to identify model elements that do not contribute to any requirement or to the architecture — comments, annotations, test points, layout helpers — so they are not mistaken for unintended function.

What each link proves and what normally records it

LinkDirection it must supportWhat it provesTypical record
System requirement ↔ HLRBothEvery allocated system requirement is refined; every HLR has a parent or is flagged derivedRequirements-tool links (e.g. “refined by” / “refines”)
HLR ↔ model elementBothEvery HLR is implemented somewhere in the model; every model element serves an HLR, a derived requirement, or is identified as non-contributingRequirement links stored in or beside the model (link files keyed by element ID)
Model element ↔ source codeBothEvery line of code came from the model; every model element produced (or legitimately optimised away) codeGenerator comments plus a code-generation traceability report; or a qualified source-to-model checker
Requirement ↔ test caseBothEvery requirement is tested, including robustness; every test exists for a reasonTest-management links from each test case to the requirements it verifies
Test case ↔ resultForwardEach case was run on a known configuration and passedTest reports carrying model/code checksums and tool versions
Code ↔ object codeBoth (Level A: analysis of untraceable object code)The executable is what was reviewed and testedBuild logs, SCI, and for Level A an object-to-source analysis

The biggest practical decision is where in the model hierarchy you attach requirement links. Link too high (only the root of the model) and the trace proves nothing — the auditor cannot tell which part of the model implements which requirement, and model coverage gaps cannot be tied back to a requirement. Link too low (every Gain, Sum and Unit Delay) and you build a maintenance nightmare, with thousands of links that break whenever someone tidies the diagram.

Practitioner tip

A good default: the lowest meaningful container

Partition the model so that each lowest-level subsystem, Stateflow subchart or function block corresponds to a small, nameable set of requirements, then link at that level. A PID loop subsystem links to the actuator-loop requirement; a mid-value selector subsystem links to the triple-sensor voting requirement. Individual primitive blocks inside inherit the link from their container. Reusable library blocks and referenced models carry links to their own requirements at their root, while each instance is linked to the requirement that motivated using it there.

Granularity options

Link levelProsConsWhen it fits
Model root onlyCheapProves almost nothing; auditors reject it for LLR traceNever as the only level
Lowest subsystem / subchartReadable, stable, maps cleanly to coverageRequires deliberate model partitioningDefault for control-law and logic models
Individual states and transitionsPrecise for mode logicMany links; breaks when charts are refactoredMode/state machines where each transition realises a requirement
Every primitive blockMaximum precisionUnmaintainable; links outnumber requirements by 10×Only for small, safety-critical pieces (e.g. a voter)

Model-based development

Virtual subsystems vanish in the code

Purely graphical (virtual) subsystems are flattened during code generation, so a requirement link placed on one does not appear as a function boundary in the code. That is fine as long as the code-generation traceability report still maps the generated statements back to the blocks inside the virtual subsystem. Make sure the reviewers know where to look.

Link hygiene rules worth writing into the model standard

  • —Store links outside the model file (a separate link file) so a requirements-only change does not churn the model’s checksum, and keep that file under the same configuration control as the model.
  • —Never create bidirectional “navigation” objects inside the master requirements document; they modify the requirement baseline. Use one-way links plus a generated reverse view (a surrogate module or report).
  • —Agree requirement-tool settings across the whole team before anyone links anything — mixed settings produce links that resolve on one machine and dangle on another.
  • —When a requirement changes: change the requirement first, then the model, then replace the stale links, then regenerate the reverse view and clean flagged obsolete links.
  • —Flag every derived requirement in the model (or in the requirements tool) and send it to the system safety process — derived model logic is still derived requirements.

Trace from model to generated code

Code generators for certifiable work typically do two things for traceability. First, they annotate the generated source with comments naming the model element each statement came from (for example a block path or a stable element identifier). Second, they emit a traceability report that lists, for each model element, the code lines it produced — and lists elements that produced no code because they were virtual, constant-folded or optimised away. Together these give the model ↔ code link required for the A-5 trace objective (source code is traceable to LLRs).

Two ways to close the model ↔ code trace

Review the generated trace

▸Engineers sample or fully review code against the model using the generator’s comments and trace report
▸The generator is unqualified, so its trace output is just a reviewer aid
▸Every untraced code fragment and every element with no code must be explained
▸Cost scales with code size; repeated on every regeneration

Qualified source-to-model verification

▸A qualified checker independently matches every code construct to a model element and vice versa
▸Its report becomes the evidence for code-to-LLR compliance and trace (A-5)
▸Any mismatch, unsupported block or untraceable code is reported automatically
▸Requires models built only from blocks/settings the checker supports

Pitfall

Trusting comments as proof

Generator comments are produced by the same tool whose output you are trying to verify. If the generator is not qualified and no independent check is done, its trace comments are not evidence — they are claims. Either review them, or use a qualified source-to-model checker. See Code Generation & Code Verification.

Trace from requirements to tests and results

Tests trace to requirements, never to blocks. A test case on a model-based project should name the HLR (or LLR) it verifies, carry its expected results derived from that requirement, and be runnable on more than one platform: model simulation, software-in-the-loop (host-compiled generated code), processor-in-the-loop (generated code on the target processor) and the final hardware/software integration rig. Each result must record which configuration it ran against — model checksum, code version, compiler and tool versions — so the evidence can be tied to the configuration in the SCI.

Worked example

One test, three platforms (from the case study)

In the helicopter reference project the AHRS voter’s three requirement-based test cases (mid-value, average and single-sensor voting) each link to two HLRs — the voting requirement for that sensor count and the validity-check requirement. The same test file is executed as a model simulation, then in software-in-the-loop mode against the generated code, and each report records both the referenced-model and top-model checksums of the model it ran against. See Case Study: Helicopter Flight Control.

Pitfall

Generated tests with no parent

Test-generation tools can create tests that reach the model coverage gaps the requirement-based tests missed. Those tests trace to a coverage objective, not to a requirement, and their expected outputs come from the model itself. They are useful for showing the code behaves like the model, but each gap they fill must still be analysed: is it a missing requirement, a missing test, derived logic needing a derived requirement, or dead logic to remove?

Using coverage to audit the trace

Coverage is the trace audit that cannot be faked. If every model element is linked to a requirement and every requirement is tested, then running the requirement-based tests should exercise every model element. When model coverage shows an element that was never exercised, one of four things is true: a requirement exists but its tests are incomplete; the element implements something no requirement asks for (unintended function, or an unflagged derived requirement); the element is unreachable given the input ranges (dead logic); or it is deactivated by design and must be justified. Code coverage then repeats the audit one level down, on the generated code — see Structural Coverage.

Reading a coverage gap as a trace finding

ObservationLikely trace problemResolution
Element linked to an HLR, never exercisedRequirement-based tests incompleteAdd test cases for that HLR (normal and robustness)
Element not linked, never exercisedUnintended function or unflagged derived logicDelete it, or write and flag a derived requirement and test it
Element can never be reached under declared input rangesDead logic (e.g. a saturation that cannot saturate)Remove, or justify why it is retained (defensive) and document
Element only reached by generated testsMissing requirement or missing requirement-based testAnalyse; do not close the gap with the generated test alone
Code exercised but model element notCode not traceable to the model (generator or hand-code)Investigate; at Level A may require object-code analysis

Trace gaps auditors find

What the auditor looks for

What a reviewer will try at SOI 2 and SOI 3

Pick an HLR and ask to be walked down to the model element, the generated code lines and the test that verifies it. Then pick a random model subsystem and walk up. Then pick a generated test and ask which requirement it verifies. Expect questions on every root-level or helper element that is reported as “not linked to requirements”, on any library block used without its own requirements, and on whether the link data is under the same baseline as the model.

Common trace findings on MBD programs

FindingWhy it happensPrevention
Model elements with no requirement linkHelper blocks, bus selectors, muxes, constants left unlinkedLink at container level; tag non-contributing elements explicitly; run an “unlinked elements” check every build
One HLR linked to the whole modelRequirements written after the model (“the software shall implement the model”)Write HLRs first; reject models whose only parent is a single requirement
Stale links after refactoringElements copied, deleted or renamed; links duplicated on copyUse stable element IDs; configure copy behaviour; re-run link checks after every change
Derived logic not flaggedDesigners add filters, latches, limiters to make the model workModel review checklist item; derived requirements sent to safety
Library blocks with no requirementsShared libraries treated as tooling rather than softwareGive each library block its own requirements, tests and coverage
Tests linked to the model, not to requirementsTest harness built from the model interfaceTest template that forces a requirement link per case
Results not tied to a configurationReports regenerated after the model changedStamp checksums/versions into every result; review before acceptance

Model-based traceability self-check

0/8

Self-check

Model coverage shows a subsystem that no requirement-based test exercises, and the subsystem has no requirement link. What is the correct first conclusion?

Sources & further reading

  • DO-178C §5.5 (trace activities), §6.5 (verification of trace), Annex A Tables A-3 to A-7
  • DO-331 §MB.5.5, §MB.6.7 (model coverage), Annex MB.A Table MB.A-2 (identification of non-contributing model elements)
  • Rierson, Developing Safety-Critical Software (2013), ch. 14 (traceability risk with models)
  • MathWorks DO-178C/DO-331 case study project (helicopter FCC): requirement-linking guidance and requirement-based test reports
  • MathWorks — DO Qualification Kit (DO-178C/DO-331) ↗

← Previous

Code Generation & Code Verification

Model-Based Development (DO-331)

Next →

An End-to-End MBD Workflow

Model-Based Development (DO-331)

On this page

The trace chain on a model-based projectChoosing the granularity of requirement linksTrace from model to generated codeTrace from requirements to tests and resultsUsing coverage to audit the traceTrace gaps auditors find