Repository navigation
Deriving and writing safety requirements
How a safety requirement gets from a hazard to a test in LionDriver, and how to write one that a reviewer, a tester and a formal tool all read the same way. This page explains and links. The requirements themselves, their ASILs and their status live in the records it points to; nothing here is a requirement.
New to all of this? From hazard to test follows one requirement chain from the item to the tests, with animations.
Every safety requirement has a parent above it and a test below it. A requirement without either is an orphan, and the trace checks report it.
flowchart LR
H["Hazardous event<br/>HARA"] --> SG["Safety goal<br/>SG-nn"]
SG --> FSR["Functional safety<br/>requirement<br/>FSR-nn.nn"]
FSR --> TSR["Technical safety<br/>requirement<br/>TSR-nnn"]
TSR --> SW["Software / hardware<br/>requirement<br/>SWSR / HWSR"]
SW --> V["Verification<br/>unit, HIL, vehicle test"]
| Level | What it says | Owned by |
|---|---|---|
| Safety goal | What must not happen, with its ASIL, FTTI and safe state | WP-C-03 HARA v0.12.1 |
| FSR | What the item must do to meet the goal, without saying how | WP-C-04 FSC v0.32.0 |
| TSR | How the system does it: which element, which signal, which number | WP-S-02 TSC v0.70.0 |
| SWSR / HWSR | What one software unit or hardware part must do | WP-W-02 v0.56.0, WP-H-01 v0.11.0 |
| Verification | The test that shows it, and its result | Trace map |
No single analysis finds every requirement. LionDriver runs several on the same safety goal, compares what they produce, and only then trusts the result. Five routes derive requirements; the sixth, traceability, confirms that the chain is complete and derives nothing.
The requirement-routes page walks each route in full, with one generated figure per route and every record it cites quoted from its file.
New to fault trees? Building a fault tree walks route 1 from the item diagram, with the traps to avoid.
| # | Route | Shape | Strongest at | Watch out for | In this repository |
|---|---|---|---|---|---|
| 1 | Fault tree (FTA) | Top-down from the violated goal | Finding combinations of faults; quantifying | Gives logic, not behaviour | WP-A-04 v1.22.0, cut sets |
| 2 | FMEA | Bottom-up from each part's failure modes | Single-point failures and the controls they need | Weak on interactions | System, SW and HW FMEAs |
| 3 | STPA | The control loop | Software, timing and feedback hazards | Needs a control model | WP-A-05 v0.15.0 |
| 4 | Guidewords | A fixed word set (NO, MORE, LESS, LATE…) on every function | Systematic completeness | Laborious | HARA guideword scenes |
| 5 | Scenarios | The operating envelope and the timing budget | Making a time limit measurable | Finds no new failure modes | FSC FTTI scenes, WP-S-04 v0.31.0, simulation |
| 6 | Traceability | Synthesis | Completeness, allocation, change impact | Derives nothing itself | Trace map |
Two checks run on top, and neither earns evidence credit:
- Executable fault model. fmdtools injects every combination of up to four faults and compares the result with the hand-written tree.
- Formalisation. FRET rewrites a requirement in a structured language. An ambiguity that a reader skims past becomes a field that will not fill.
Safety goal SG-02: no loss of lateral control without a take-over warning within 1 s. The specimen is FSR-02.05, the warning that does not depend on the openpilot computer, and its technical requirement TSR-516, the panda siren. Each route reaches it from a different side:
| Route | How it lands on the siren |
|---|---|
| FTA | In the SG-02 tree, every cause of lost steering is ANDed with a failed warning. The siren is the branch that does not depend on the computer that failed. |
| FMEA | The row for "openpilot computer stalls" has the siren in its needed control column, because the computer cannot warn about its own stall. |
| STPA | The unsafe control action "warning not provided when the panda revokes steering" becomes a constraint, then the requirement. |
| Guidewords | NO and LATE applied to "warn the driver" give the trigger list and the time bound. |
| Scenarios | The plant runs (silent stall, engaged mismatch) show what the 0.5 s buys: the driver corrects about a second earlier. |
| Trace | SG-02 → FSR-02.05 → TSR-516 → SWSR-516 → panda tests and a HIL case. |
The executable model and FRET then checked it from two more sides. The model shows the siren covering ten sets of the SG-02 tree within the 1 s budget. FRET found that the text set no minimum length or loudness for the siren (see section 3).
A well-formed safety requirement has six parts. Each maps to a field of FRET's structured language, so the same breakdown serves a reviewer, a tester and the formal check.
| Part | Asks | FRET field | TSR-307(a) |
|---|---|---|---|
| Trigger | When does it apply? | scope and condition | when the SoC heartbeat has reported "not engaged" continuously for 0.3 s while authority is granted |
| Agent | Who acts? | component | the envelope (panda safety code) |
| Modal | Is it required? | shall | shall |
| Action | What does it do? | response | revoke |
| Object | To what? | response | authority |
| Constraint | How fast, how much, how long? | timing | within the same safety-task tick once the 0.3 s is reached |
The same six parts, built one at a time on TSR-307(a), and the clause the FRET pilot found missing. Rendered at each
sync by tools/wiki/animations.py from the TSC row and this page.
Every requirement also carries attributes that are not part of the sentence: its ASIL, its parent (FSR or safety goal), its allocation (software, hardware, or both, and which element), and its verification method. The TSC table has a column for each.
- One requirement, one shall. Split "detect and warn" into two if they can fail separately.
- Every trigger is a state the code can check. "While engaged" names a signal; "when appropriate" does not.
- Every constraint has a number, a unit and a clock. Say from what event the time runs: fault onset, detection, or the first frame.
- Say how long a condition must hold. "Reports X" and "has reported X continuously for t" are different requirements.
- Bound the output too. A warning needs a minimum duration and a level, not only a start time.
- Write what the safe direction allows. If moving toward zero is safe, do not forbid it.
- One reading only. If two engineers could implement it differently and both pass, it is not finished.
The rules applied: a vague warning grows into TSR-516 one question at a time. Colours match the anatomy above
(trigger blue, agent violet, modal teal, action orange, object amber, constraint magenta). Rendered at each sync by
tools/wiki/animations.py, which fails the build if a drawn clause leaves the TSC.
The pills at the end are the nine characteristics of a single requirement in the INCOSE Guide to Writing Requirements (C1–C9). Rewording can make a requirement Unambiguous, Complete, Singular, Verifiable and Conforming. It cannot make it Necessary, Appropriate, Feasible or Correct: those come from the trace to its parent and from review.
The FRET pilot rewrote six panda requirements and compared each with the code. The fixes were text-only, made by the requirements owner (WP-S-02 v0.53):
| Rule | Before | After |
|---|---|---|
| 4: how long it must hold | TSR-307(a): revoke when the heartbeat reports "not engaged" | ...has reported "not engaged" continuously for 0.3 s; an "engaged" heartbeat restarts the count |
| 5: bound the output | TSR-516: sound a warning within 0.5 s | ...for at least 3 s, or as long as its condition holds, at a level audible over the cabin noise (set by WP-S-04 M-05) |
| 3: one clock | TSR-516: within 0.5 s of detection, and for an EPS fault a persistence of up to 0.7 s | for an EPS fault, the 0.7 s clause replaces the 0.5 s bound, so the two can no longer contradict each other |
| 6: safe direction | TSR-103: reject a torque decrease larger than Δ_down | any change toward zero is accepted; only a rise, or a crossing of zero, beyond the limit is rejected |
| 3: one clock | TSR-516(c): siren when cruise is still on more than 0.5 s later | ...still on 0.5 s (within one 10 ms task period) later, matching what the code does |
Details are in the FRET findings (FF-01 to FF-06) and the WP-S-02 version history.
- It names its parent and at least one verification.
- All six parts are present, and the constraint has a number, a unit and a clock.
- At least two derivation routes reach it, or the record says why one is enough.
- Its ASIL is no lower than the ASIL its parent allocates to it.
- Allocation is explicit: software, hardware or both, and which element.
- It can be read only one way: try writing it in FRETish.
- The trace check passes with it in place.
Mirrored from wiki/ on liondriver-dev at 5320ba8, 2026-11-27. Pages are reviewed by pull request; the wiki is not edited in place. This wiki explains and links; safety claims and evidence live in the assurance record. Work-product versions: the change ledger, row 614 (5320ba83, 2026-11-26) (all versions).
Problem statement
LionDriver wiki
- Home
- Roadmap and status
- How LionDriver works
- How the repository is organized
- How decisions are made
- Glossary
- What is a safety case?
- Reading the Living Safety Case
- Standards at a glance
- From hazard to test
- Deriving and writing safety requirements
- ASIL decomposition
- Building a fault tree
- Hardware safety and interference
- After release (ISO 26262 Part 7)
- SOTIF and ISO 26262
- Cybersecurity and ISO/SAE 21434
- AI safety and ISO/PAS 8800
- ASPICE: is the process capable?
- Integrated standards: one system, not five
- For the assessor
- Work product versions
- Reference vehicle
- CAN, CAN FD and end-to-end protection
- Contributor guide
- Reporting a safety concern
- Session log
- FAQ
Repository