Lesson 10: Interfaces as Definitions
The "Wire" has a Blueprint
In systems engineering, the connection between two elements is rarely just a decorative line on a diagram. A physical charging cable, for instance, has resistance, length, latency, shielding, and safety constraints. SysML v2 provides a highly rigorous structural mechanism to model this medium: the interface def.
The Evolution: Connectors in SysML v1 vs. SysML v2
To understand the power of interfaces in SysML v2, it helps to look at how connections were managed in SysML v1.
In SysML v1, basic connections were modeled using connectors drawn between ports or parts. If a systems engineer needed that connector to possess physical properties (like mass or resistance) or internal structure, they had to type the connector using an Association Block. An Association Block was a specialized construct that acted as both a relationship (an association) and a structural element (a block), relying on Participant Properties to link the ends. While powerful, this required modelers to manage a dual-nature construct alongside standard blocks.
SysML v2 streamlines this by unifying the underlying mathematics. In SysML v2, every connection definition (connection def) is inherently a specialized kind of part definition (part def). Because a connection is natively a structural part in the abstract syntax, it can directly own its own attributes, states, and internal components without requiring a separate "association block" construct.
An interface def is simply a strict specialization of a connection def where the connection ends are restricted exclusively to ports.
Under the Hood: The Interface Definition
Because an interface def is mathematically a part, it fundamentally shifts how we think about connections. It acts as a reusable blueprint for a connection medium.
Here is exactly what an interface def provides:
- Strict End Typing: It specifies exactly what kinds of ports are permitted at each end of the connection. By declaring the expected port types (often pairing a standard port with its conjugated
~counterpart), the interface guarantees compatibility. - Native Properties: It can natively hold engineering properties (attributes) that apply to the connection itself, rather than forcing those properties onto the connected components.
- Internal Flows: It can define the specific routing of item flows between the endpoints.
Textual Code Example: The EV Charging Cable
Let's model the EV charging scenario. We want to connect a Charger to a Vehicle, but we also need to account for the electrical resistance of the cable connecting them.
Here is how you leverage interface def in SysML v2 textual syntax to define the connection as a first-class structural element:
package ChargingInterfaces {
// 1. Import the endpoint (from our previous lesson)
private import ChargingSystem::ChargingPort;
// 2. Define the Interface (The Cable Blueprint)
interface def ChargingCable {
// Enforce the allowable port types at each end
end chargerSide : ChargingPort;
end vehicleSide : ~ChargingPort;
// Declare properties that belong specifically to the connection
attribute resistance :> ISQ::resistance;
attribute maxCurrent :> ISQ::electricCurrent;
}
// 3. Apply the definitions to parts
part def SuperCharger {
port plug : ChargingPort;
}
part def ElectricVehicle {
port socket : ~ChargingPort;
}
// 4. Connect the parts using the interface definition
part def ChargingStation {
part charger : SuperCharger;
part vehicle : ElectricVehicle;
// Create an interface usage typed by our connection blueprint
interface activeConnection : ChargingCable
connect charger.plug to vehicle.socket;
}
}Graphical Notation

Deep Dive: The Interface is a System
- First-Class Structure: Notice that
interface deflooks exactly likepart def. It has curly braces{ }. It has attributes. It has internal structure. This means a connection in SysML v2 can be as detailed as a component. You can model the "copper inside the wire" by defining internal parts within the interface structure. - Enforcing Compatibility: By defining the ends (
chargerSidevsvehicleSide), theinterface defcreates a contract. You cannot use thisChargingCableto connect two Vehicles (~ChargingPortto~ChargingPort). The definition demands one "Normal" and one "Conjugate." If you try to connect distinct types, compliant tools can flag a warning or error. - Interface Usage: The interface usage binds the actual physical ports (
charger.plugandvehicle.socket) to the abstract ends (chargerSideandvehicleSide) defined in theChargingCableinterface definition.
V1 vs. V2 Cheat Sheet
| Concept | SysML v1 | SysML v2 |
|---|---|---|
| Endpoint Definition | Modeled using an InterfaceBlock typing a ProxyPort. | Modeled using a port def containing directed features. |
| Endpoint Inversion | Handled via the ~InterfaceBlock stereotype or the deprecated isConjugated property. | Handled via the native ~ (conjugation) operator applied to the port type. |
| Connection Properties | Required typing the connector with an AssociationBlock. | Handled natively by connection def or interface def, which are specialized part definitions capable of holding their own properties. |
Next Lesson
In the next lesson, we will take an in-depth look at explicit connections with connect, where the parts, ports, and interface definition come together to create the actual system topology.