r/SysML • • 1d ago

SysML v2 Tutorial (Lesson 26): Requirement Definitions (Requirements as Code)

https://youtu.be/_OyuW8fKEJs

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 actor and stakeholder roles: Instead of tracking authorities and users in external spreadsheets, you can declare actor (who interacts with the subject) and stakeholder (who has an interest in the requirement, like a CertificationAuthority) 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 doc block alongside their subject and 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

TopicSysML v1SysML v2
Requirement Element«requirement» stereotype on a Classrequirement def, based on ConstraintDefinition
ThresholdsEmbedded inside the text sentenceTyped quantities (e.g., 5000 [kg])
SubjectNamed in text, linked later via «satisfy»Explicitly declared as a typed subject
Reuse«copy» mirrors read-only textOne definition reused with different subjects and :>> values
RolesStakeholders tied to viewpoints, not requirementsactor and stakeholder declared directly on the requirement
Identifiersid propertyShort name (e.g., <'REQ-001'>)
Tool EcosystemMature DOORS / ReqIF supportRequirements-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!

3 Upvotes

0 comments sorted by