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
| Link | Direction it must support | What it proves | Typical record |
|---|---|---|---|
| System requirement ↔ HLR | Both | Every allocated system requirement is refined; every HLR has a parent or is flagged derived | Requirements-tool links (e.g. “refined by” / “refines”) |
| HLR ↔ model element | Both | Every HLR is implemented somewhere in the model; every model element serves an HLR, a derived requirement, or is identified as non-contributing | Requirement links stored in or beside the model (link files keyed by element ID) |
| Model element ↔ source code | Both | Every line of code came from the model; every model element produced (or legitimately optimised away) code | Generator comments plus a code-generation traceability report; or a qualified source-to-model checker |
| Requirement ↔ test case | Both | Every requirement is tested, including robustness; every test exists for a reason | Test-management links from each test case to the requirements it verifies |
| Test case ↔ result | Forward | Each case was run on a known configuration and passed | Test reports carrying model/code checksums and tool versions |
| Code ↔ object code | Both (Level A: analysis of untraceable object code) | The executable is what was reviewed and tested | Build logs, SCI, and for Level A an object-to-source analysis |
Choosing the granularity of requirement links
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 level | Pros | Cons | When it fits |
|---|---|---|---|
| Model root only | Cheap | Proves almost nothing; auditors reject it for LLR trace | Never as the only level |
| Lowest subsystem / subchart | Readable, stable, maps cleanly to coverage | Requires deliberate model partitioning | Default for control-law and logic models |
| Individual states and transitions | Precise for mode logic | Many links; breaks when charts are refactored | Mode/state machines where each transition realises a requirement |
| Every primitive block | Maximum precision | Unmaintainable; 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
Qualified source-to-model verification
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
| Observation | Likely trace problem | Resolution |
|---|---|---|
| Element linked to an HLR, never exercised | Requirement-based tests incomplete | Add test cases for that HLR (normal and robustness) |
| Element not linked, never exercised | Unintended function or unflagged derived logic | Delete it, or write and flag a derived requirement and test it |
| Element can never be reached under declared input ranges | Dead logic (e.g. a saturation that cannot saturate) | Remove, or justify why it is retained (defensive) and document |
| Element only reached by generated tests | Missing requirement or missing requirement-based test | Analyse; do not close the gap with the generated test alone |
| Code exercised but model element not | Code 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
| Finding | Why it happens | Prevention |
|---|---|---|
| Model elements with no requirement link | Helper blocks, bus selectors, muxes, constants left unlinked | Link at container level; tag non-contributing elements explicitly; run an “unlinked elements” check every build |
| One HLR linked to the whole model | Requirements 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 refactoring | Elements copied, deleted or renamed; links duplicated on copy | Use stable element IDs; configure copy behaviour; re-run link checks after every change |
| Derived logic not flagged | Designers add filters, latches, limiters to make the model work | Model review checklist item; derived requirements sent to safety |
| Library blocks with no requirements | Shared libraries treated as tooling rather than software | Give each library block its own requirements, tests and coverage |
| Tests linked to the model, not to requirements | Test harness built from the model interface | Test template that forces a requirement link per case |
| Results not tied to a configuration | Reports regenerated after the model changed | Stamp 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?