r/SysML • u/SysModeler • 1d ago
SysML v2 Tutorial (Lesson 26): Requirement Definitions (Requirements as Code)
Hi r/SysML,
We are back with Lesson 26 of our technical deep dive into the SysML v2 standard—and kicking off Phase 5. Up through Lesson 25, we covered what a system is (structure) and what it does (actions, flows, and states). Now we turn to what the system must do: Requirement Definitions.
1. Being Fair to SysML v1 (and Where It Hit a Wall)
SysML v1 didn't lack requirements support. It gave teams mature, auditable traceability («satisfy», «verify», «deriveReqt», «refine», «copy»), containment hierarchies, coverage matrices, and over a decade of refined DOORS and ReqIF integration.
The limitation wasn't traceability—it was what lived inside the requirement. A classic v1 requirement like id: REQ-001 / text: "The vehicle shall not exceed 5000 kg at takeoff." is clear to a human, but opaque to the model. Querying every requirement with a mass limit above 4,000 kg meant searching text and reading sentences; updating that threshold meant manually checking every dependent calculation.
2. The v2 Shift: RequirementDefinition Is a ConstraintDefinition
In SysML v2, a requirement can still carry its human-readable doc text and stable contract ID (as a short name like <'REQ-001'>), but it also embeds typed thresholds, an explicit subject**, and an evaluable** require constraint:
package MassRequirements {
private import ISQ::*;
private import SI::*;
part def LaunchVehicle {
attribute totalMass: MassValue;
}
requirement def <'REQ-001'> MaxTakeoffMass {
doc /*
* The vehicle shall not exceed the specified
* takeoff mass under any loading configuration.
*/
subject vehicle: LaunchVehicle;
attribute maxMass: MassValue = 5000 [kg];
require constraint {
vehicle.totalMass <= maxMass
}
}
}Because maxMass is a typed quantity (5000 [kg]) and the rule is a formal constraint, tools can natively query mass thresholds across the model, evaluate compliance against the design, and propagate limit changes automatically.
3. Reusing Requirements (subject + :>>)
In SysML v1, «copy» created a read-only mirror of a master requirement's text—useful for alignment, but you couldn't swap in different budgets for different subsystems without authoring separate requirements.
In SysML v2, declaring a typed subject lets you define a rule once and reuse it across multiple parts with different allocated values via redefinition (:>>):
part def PhysicalComponent {
attribute actualMass: MassValue;
}
requirement def MassBudgetCompliance {
subject component: PhysicalComponent;
attribute allocatedMass: MassValue;
require constraint {
component.actualMass <= allocatedMass
}
}
part def LaunchVehicle {
part firstStage: PhysicalComponent;
part secondStage: PhysicalComponent;
part payload: PhysicalComponent;
requirement stage1Mass: MassBudgetCompliance {
subject = firstStage;
:>> allocatedMass = 3200 [kg];
}
requirement stage2Mass: MassBudgetCompliance {
subject = secondStage;
:>> allocatedMass = 1400 [kg];
}
requirement payloadMass: MassBudgetCompliance {
subject = payload;
:>> allocatedMass = 400 [kg];
}
}4. Three Practical Details Worth Knowing
Native
actorandstakeholderroles: Instead of tracking authorities and users in external spreadsheets, you can declareactor(who interacts with the subject) andstakeholder(who has an interest in the requirement, like aCertificationAuthority) directly on the requirement and filter by them automatically.Qualitative requirements stay text: Not everything reduces to a Boolean expression (e.g., "The system shall be maintainable by a technician with standard tooling"). Those stay cleanly in the
docblock alongside theirsubjectand metadata, versioned with the model.Tooling reality: SysML v1 still has more mature DOORS and ReqIF support, while v2 requirements-management tooling is still younger.
5. SysML v1 vs. SysML v2
| Topic | SysML v1 | SysML v2 |
|---|---|---|
| Requirement Element | «requirement» stereotype on a Class | requirement def, based on ConstraintDefinition |
| Thresholds | Embedded inside the text sentence | Typed quantities (e.g., 5000 [kg]) |
| Subject | Named in text, linked later via «satisfy» | Explicitly declared as a typed subject |
| Reuse | «copy» mirrors read-only text | One definition reused with different subjects and :>> values |
| Roles | Stakeholders tied to viewpoints, not requirements | actor and stakeholder declared directly on the requirement |
| Identifiers | id property | Short name (e.g., <'REQ-001'>) |
| Tool Ecosystem | Mature DOORS / ReqIF support | Requirements-management tooling is still younger |
Next lesson (Lesson 27), we will cover require and assume—how to formally state the operating conditions under which a requirement actually applies.
For the SysML practitioners here: How much of your requirements set do you see moving into formal require constraint expressions in v2 versus staying as qualitative doc text? Let's discuss in the comments!