Lesson 11: Explicit Connections
Wiring the Topology
In SysML v1, the Internal Block Diagram (IBD) captures the internal structure of a block in terms of properties and the connectors between them. Connectors link parts or ports to specify interactions.
SysML v2 preserves the core engineering intent of connectors but drastically changes their underlying abstract syntax by grounding them in the Kernel Modeling Language (KerML). Instead of relying on specific diagrams to give connectors context, SysML v2 formalizes them directly in the textual and structural semantics. This makes the system architecture readable, diff-able, and searchable without ever opening a diagram.
The Concept: Topology as Code
We have the Parts (Lesson 6), the Ports (Lesson 8/9), and the Interface Definition (Lesson 10). Now, we instantiate the "wire" that links them. We have two primary ways to do this:
- The Shorthand Connect Statement (Option A): A simple declarative statement (e.g.,
connect A to B) asserting that two endpoints are linked. By default, this creates a generic binary connection. However, theconnectkeyword can also be used to instantiate specific connection definitions that carry properties. - Typed Connections and Interfaces (Option B): We instantiate a
connection deforinterface defto create a specific connection entity. This enforces strict typing and allows the connection to carry properties (like resistance). Aninterfaceis a specific kind of connection where the endpoints must be Ports.
Textual Code: Plugging the Car in
Let's bring together the SuperCharger, the ElectricVehicle, and the ChargingCable.
package ChargingSystemContext {
import ChargingSystem::*; // From Lesson 9 (Ports)
import ChargingInterfaces::*; // From Lesson 10 (Cable)
// A context to hold the connected parts (e.g., a Charging Station)
part def ChargingStation {
// 1. Define the Parts (The Usage)
part charger : SuperCharger;
part myTesla : ElectricVehicle;
// 2. The Connection (The Usage)
// We establish the link between the specific ports of these parts.
// OPTION A: Simple Connection (Generic)
// This asserts simple connectivity (a generic link) without
// instantiating the specific 'ChargingCable' definition.
connect charger.plug to myTesla.socket;
// OPTION B1: Typed Interface (Explicit Mapping)
// Here we create a specific usage of 'ChargingCable'.
// This enforces properties (like resistance) and strict typing.
interface chargingSession : ChargingCable {
// Use reference subsetting (::>) to map the ends.
// This says: "charger.plug" plays the role of "chargerSide" here.
end chargerSide ::> charger.plug;
end carSide ::> myTesla.socket;
}
// OPTION B2: Typed Interface (Shorthand)
// This achieves the exact same result as B1 but in one line.
interface chargingSessionShort : ChargingCable connect charger.plug to myTesla.socket;
}
}Graphical Notation

Deep Dive: The Semantics of Connection
- Interface Usage: The code
interface chargingSession : ChargingCablecreates an Interface Usage (an instance of the definition). It is not just a generic link; it is a structural entity that can have its own internal state exactly as defined in theinterface def. - Dot Notation Navigation: Notice
charger.plug. We rely on feature chains (dot notation) to drill down from the parent part (charger) to its port (plug). This allows you to wire up deeply nested subsystems without creating complex "delegation ports" at every single level of the hierarchy. - Validation: If you try to connect
charger.plugtocharger.plug, compliant tools may flag a warning/error based on end typing. Why? BecauseChargingCable(from Lesson 10) requires one end to be~(conjugated). Two plugs are both unconjugated, so they don't fit the definition.
V1 vs. V2 Cheat Sheet
| Concept | SysML v1 | SysML v2 |
|---|---|---|
| Topology expression | Often drawn as connector lines on Internal Block Diagrams. | Declared textually with connect and connection/interface usages. |
| Connector typing | Often assigned through diagram/tool properties. | Expressed directly with a typed usage such as interface chargingSession : ChargingCable. |
| Nested endpoints | Often traced visually through nested parts and ports. | Addressed directly with feature chains such as charger.plug or myCar.socket. |
Next Lesson
We will look at Item Definitions (Data Flow). We have connected the ports, but what actually flows through the pipe? In v2, we replace "Flow Specifications" with first-class item defs to model fuel, data, and electricity.