Modular Modeling with Imports and Libraries

Estimated reading: 3 minutes

As your system architectures grow, managing everything in a single file becomes impractical. Professional systems engineering requires a modular approach where components are defined in separate files and reused across the project. This tutorial will teach you how to use the AI SysML v2 editor to handle multi-file projects and leverage the standard SysML v2 (KerML) libraries for maximum rigor.

Objective

By the end of this tutorial, you will have created a modular project consisting of two files: one for “Interfaces” and one for the “Main System,” connected via imports within this stable SysML v2 tool.

Step 1: Set Up Your Modular Project

  1. Launch the web-based SysML v2 editor.
  2. In the Navigator (Cloud Explorer), create a new folder named ModularProject.
  3. Inside this folder, create two new files:
    • Common.sysml (This will hold shared definitions).
    • Main.sysml (This will hold your system assembly).

Step 2: Define Shared Elements in Common.sysml

We will start by defining a shared port type and a standard unit in our common file.

  1. Open Common.sysml.
  2. Type the following code:
package Common {
    port def PowerPort;
    attribute def Voltage;
}
    

Notice the precise syntax highlighting on the package name. This SysML v2 software ensures that your namespace definitions are clear and readable.

Step 3: Import Definitions in Main.sysml

Now, we will use the import statement to bring those shared definitions into our main system model.

  1. Open Main.sysml in the Tabbed Editor.
  2. Type the following code at the top of the file:
package Main {
    import Common::*;
    
    part def SmartController {
        port pIn : PowerPort;
        attribute v : Voltage;
    }
}
    

As you type PowerPort, notice how the AI SysML tool’s IntelliSense correctly suggests it, even though it is defined in a different file. This cross-file symbol resolution is a hallmark of a stable SysML v2 tool.

Step 4: Leveraging the Standard SysML v2 Library

SysML v2 comes with a rich set of built-in libraries (like ScalarValues, ISQ, and SI). This SysML v2 software provides easy access to these through the Library Pane on the left.

  1. In your Main.sysml file, add another import to bring in standard units:
    import ISQ::*; import SI::*;
  2. Update your SmartController to use a standard unit for voltage:
    attribute v : Voltage :> SI::V;

Step 5: Navigate Your Modular Hierarchy

With multiple files, navigation becomes critical. This AI SysML v2 software keeps you oriented:

  • Go to Definition: In Main.sysml, right-click on PowerPort and select Go to Definition (or press F12). The editor will automatically open Common.sysml and highlight the definition for you.
  • Tabbed Editing: Use the tabs at the top of the workspace to quickly switch between your shared library and your system assembly.
  • Model Tree: The Model Tree in the left pane will show the structure of your active file, helping you understand the local context of each module in the SysML editor.

Step 6: Verify the Modular Diagram

The automated diagram engine in this web-based SysML editor can resolve imported types to ensure visual accuracy.

  1. While Main.sysml is active, check the Diagram Viewer.
  2. You will see the SmartController with its port pIn. If you hover over the port in the diagram (if supported) or the code, you will see its full path: Common::PowerPort.

Summary and Next Steps

Congratulations! You have successfully built a modular SysML v2 project. You’ve learned how to use packages, imports, and cross-file symbol resolution to manage complexity. You’ve also seen how to integrate standard SysML v2 libraries into your models using this professional AI SysML tool.

In the next tutorial, “Customizing and Exporting System Diagrams,” we will focus on the visual presentation of your modular designs and how to prepare them for professional documentation.


Share this Doc

Modular Modeling with Imports and Libraries

Or copy link

CONTENTS
Scroll to Top