Defining System Structure with Parts and Ports
In the previous tutorial, you created your first project and a basic block definition. Now, we will explore the “core” of systems engineering: modeling the internal structure of a system. This tutorial will teach you how to use the AI SysML v2 editor to define composite parts, create interfaces through ports, and establish connections between them.
Objective
By the end of this tutorial, you will have modeled a simplified “Power Supply System” consisting of a Battery and a Controller, connected via a power interface, all within a stable SysML v2 tool environment.
Step 1: Open Your Project
- Launch the web-based SysML v2 editor.
- Open the
Basics.sysmlfile you created in the previous tutorial, or create a new file namedStructure.sysmlin yourMyFirstSystemfolder.
Step 2: Define the Composite System
In SysML v2, we use the part def keyword to define the “blueprint” of a system. We will start by defining our main system and its sub-components.
- Clear any existing code in the editor.
- Type the following code to define the system and its parts:
package 'System Structure' {
part def Battery;
part def Controller;
part def PowerSystem {
part b1 : Battery;
part c1 : Controller;
}
}
Notice how the SysML v2 editor uses stable syntax highlighting to distinguish between the definition (part def) and the usage (part). This clarity is vital when managing dozens of interconnected components in a professional SysML tool.
Step 3: Defining Ports (Interfaces)
To allow parts to communicate or share energy, we must define ports. Ports represent the points of interaction on the boundary of a part.
- Update your
BatteryandControllerdefinitions to include ports:
part def Battery {
port pOut;
}
part def Controller {
port pIn;
}
As you type, use Ctrl + Space to trigger the AI SysML tool’s auto-completion. This ensures you are using the correct SysML v2 keywords without memorizing the entire specification.
Step 4: Connecting the Parts
Now that our parts have ports, we can connect them inside the PowerSystem. We use the connect keyword to establish a relationship between the ports of the sub-parts.
- Update the
PowerSystemdefinition to include the connection:
part def PowerSystem {
part b1 : Battery;
part c1 : Controller;
connect b1.pOut to c1.pIn;
}
The SysML v2 software will automatically validate this connection. If you attempt to connect a port that doesn’t exist, the LSP worker will immediately flag it with a red underline, ensuring your model remains mathematically sound.
Step 5: Visualize the Connectivity
This is where the zero-effort diagramming of our web-based SysML editor shines.
- Observe the Diagram Viewer. You should now see an Internal Block Diagram (IBD) representation.
- The diagram will show the
PowerSystemboundary containingb1andc1, with a line connecting their respective ports. - Toggle Multiplicities: If you want to see how many batteries or controllers are allowed, you can add
[1]after the part names (e.g.,part b1 : Battery[1]) and use the Diagram Menu to “Show Multiplicities.”
Step 6: Use the Model Tree for Navigation
With a composite system, the Model Tree becomes very useful.
- Open the Model Tree in the left pane.
- Expand
PowerSystem. You will seeb1,c1, and theconnectionlisted as child nodes. - Click on
b1in the tree, and the SysML v2 editor will highlight the linepart b1 : Battery;in your code.
Summary and Next Steps
You have successfully modeled a composite system with internal parts and connectivity! You’ve leveraged ports for interfaces and connections to link them, all while using the precise syntax highlighting and automated visualization of this AI SysML v2 software.
In the next tutorial, “Modeling Requirements and Traceability,” you will learn how to add engineering constraints to your system and link them to your physical parts.