MBSE-AI-Lab is a development laboratory and tutorial repository designed to teach and demonstrate how to leverage Large Language Models (LLMs) and agentic AI tools to automate systems engineering workflows, generate compliant SysMLv2 models, and interact with the CATIA Magic / Cameo Systems Modeler APIs.
The repository provides hands-on exercises (labs) and supporting utilities to guide engineers and AI agents in automating model construction and validation.
- Model Generation: Programmatic creation of packages, requirements, part definitions, usages, value properties, and relationships (such as satisfaction) using the MagicDraw/Cameo Open API.
- Interactive GUIs: Construction of custom Swing-based interactive dialogs (e.g., a Satisfy Matrix) directly within the Cameo user interface.
- Test Harness Execution: Execution and validation of Groovy scripts inside a running Cameo instance using a local REST test harness.
- Systems Engineering Workflows: Creation of INCOSE-compliant discovery documents to capture stakeholder needs, measures of effectiveness (MOEs), and safety protocols.
- MagicGrid Architecture: Generation of fully compliant SysMLv2 text models adhering to the MagicGrid structure (Stakeholders, Requirements, System Context, Logical Architecture, and Physical Architecture).
- Advanced Language Features: Implementation of state machines, variant modeling, action modeling (swimlanes), and weight/power rollup calculations.
- Multi-Stage Validation: Parsing and compiling SysMLv2 models using a local validator and loading them into Cameo via a dedicated REST validation harness.
Labs/: Contains the prompt files and requirements for the five hands-on labs.LLM_skills/: Contains guides and instruction sets (e.g.,requirements_writing_skill.md) to establish best practices for systems engineering requirement generation.Out/: Contains logs, versioned Groovy scripts, presentation slides, and screenshots from reference runs.TutorialOne/: Focuses on the Swimming Robot model generation.TutorialTwo/: Focuses on the interactive Satisfy Matrix Swing GUI.
LabOutputs/&outputSysML/: Directories where generated artifacts (INCOSE documents, SysMLv2 models, and test logs) are stored, organized by lab and version.Example Automation Plugin Config file/: Contains a sampleplugin.xmlfile demonstrating how to configure the CATIA Magic/Cameo Automation plugin to reference an external Groovy installation.Antigravity/: Holds the VS Code workspace configuration (MBSE-AI-Lab.code-workspace).VerificationPrompt.md: The environment check prompt used to validate local tools and run the initial verification test.
- Objective: Write a Groovy script using the Cameo Open API to create a "Swimming Robot" package, a requirement (REQ-1), a part definition, a part usage with a cost attribute, and a satisfy relationship.
- Focus: Basic model creation, session management transaction handling, and test harness execution.
- Instructions: promptSwimmingRobotModel.md
- Objective: Create a Groovy script that renders a Swing GUI dialog inside Cameo displaying a Satisfy Matrix with direct and implied relationships.
- Focus: Safe UI thread handling (AWT Event Dispatch Thread), custom component painting (rendering relationship arrows at a 45-degree angle), and exception logging.
- Instructions: promptSatisfyMatrix.md
- Objective: Write an INCOSE discovery document and generate a compliant SysMLv2 model (
toaster.sysml) for a standard 2-slot toaster. - Focus: MagicGrid package structure, framing stakeholder concerns in requirements, and local/Cameo validation loops.
- Instructions: MinimalistToasterPrompt.md
- Objective: Generate a SysMLv2 model (
bug_drone.sysml) for a solar-powered autonomous insect-hunting drone. - Focus: State machines (patrolling, targeting, firing, charging), custom tabular views (Concerns, Stakeholders, States, Parts), and system-level power/weight rollups.
- Instructions: BugHuntingDronePrompt.md
- Objective: Develop an advanced, simulation-ready SysMLv2 model (
super_toaster.sysml) for an IoT-connected toaster. - Focus: System of Systems (SoS) context, multi-level traceability (Concept vs. Logical vs. Physical), action modeling (swimlane behavior allocation), variant modeling (Induction vs. Nichrome Heating), and mass/cost/MTBF rollups.
- Instructions: SuperToasterPrompt.md
To run the labs, several local test harnesses and tools must be running. You can check the readiness of your environment by executing the steps outlined in VerificationPrompt.md.
- Groovy Test Harness: Runs at
http://localhost:8765/run. This endpoint accepts a JSON payload with ascriptPathpointing to a Groovy file and executes it within the running Cameo/MagicDraw application via the automation plugin. - Python Test Harness: Runs at
http://localhost:8764/run. - SysMLv2 Language Test Harness: Runs at
http://localhost:8770/load-sysml. This service validates and compiles.sysmlfiles, loading them directly into Cameo.
Because the embedded Groovy compiler in Cameo does not support some modern language features, you must configure the automation plugin to reference a local Groovy installation. A template configuration is provided in plugin.xml.
When developing Groovy scripts for the Cameo Open API, adhere to the following rules:
- Transaction Management: Always wrap model modifications within a
SessionManagertransaction. - UI Thread Safety: Methods executing on the AWT Event Dispatch Thread (
actionPerformed,paintComponent, etc.) must wrap their entire body in atry-catch (Throwable t)block and log errors to a dedicated file using theSysMLv2Loggerutility to avoid silent failures or application lockups. - Element Ownership: Define element ownership explicitly. Standard elements should be owned by their parent package, properties by their containing usage block, and satisfy relationships by their respective usage features.
- Data Types: Use
LiteralRationalinstead ofLiteralRealfor default attribute values to prevent type mismatch errors in the Cameo compiler. - No GStrings: Avoid using Groovy GStrings (e.g.,
"${variable}"); use standard Java string concatenation or.toString()to maintain compatibility. - Script Versioning: To prevent overwriting work, always inspect the target output directory, identify the highest existing version (e.g.,
version2), increment it (e.g.,version3), and save your new scripts in that new directory.