Skip to content
Stable.sysml@modelscript/sysml2 48 diagnostic rules
Parser WASM GLR
Diagnostics 48 rules
DAE Arena AST Only
Simulation Native Solvers
Projections Modelica, ReqIF
Live ExampleElectricPowertrain.sysml

EV High-Voltage Powertrain Architecture & Requirements

SysML v2 package defining battery, SiC traction inverter, and e-axle motor blocks with typed power ports and safety requirements.

Playground
Source (34 lines)
1package ElectricPowertrain {
2  port def DcBusPort {
3    attribute voltage : Real;
4    attribute current : Real;
5  }
6 
7  part def BatteryPack {
8    attribute capacityKwh : Real = 82.0;
9    attribute nominalVoltage : Real = 800.0;
10    port dcOut : DcBusPort;
11  }
12 
13  part def TractionInverter {
14    attribute efficiency : Real = 0.985;
15    port dcIn : ~DcBusPort;
16    port acOut : DcBusPort;
17  }
18 
19  part def EAxleMotor {
20    attribute peakTorqueNm : Real = 420.0;
21    attribute maxRpm : Real = 18000.0;
22    port acIn : ~DcBusPort;
23  }
24 
25  part def ElectricVehicle {
26    part pack : BatteryPack;
27    part inverter : TractionInverter;
28    part motor : EAxleMotor;
29  }
30 
31  requirement def ThermalSafetyReq {
32    doc /* Pack cell temperature shall remain below 333.15 K under peak load. */
33  }
34}
SysML v2 Architecture Diagram (BDD)
«package» ElectricPowertrain «partdefinition» BatteryPack «attributes» capacityKwh : Real nominalVoltage : Real «partdefinition» TractionInverter «attributes» efficiency : Real «partdefinition» EAxleMotor «attributes» peakTorqueNm : Real maxRpm : Real «part def» ElectricVehicle «requirement def» ThermalSafetyReq
Drag to pan · Click % to reset

SysML v2 & KerML (.sysml, .sysml2, .kerml) ​

@modelscript/sysml2 (languages/sysml2) implements the OMG Systems Modeling Language v2 (SysML v2) and Kernel Modeling Language (KerML) textual notation, pairing a bundled KerML/SysML v2 standard library snapshot with a suite of formal verification, safety analysis, direct DAE compilation, and enterprise synchronization engines.


Supported Extensions ​

ExtensionDescription
.sysml, .sysml2OMG SysML v2 textual architecture, requirement, state, action, and verification models
.kermlOMG Kernel Modeling Language (KerML) metamodel & library definitions

Supported SysML v2 Constructs ​

  • Structural Modeling: package, part def, part, attribute def, attribute, item def, item, port def, port, connection def, connection, interface def, interface, flow, allocation def, allocate
  • Behavioral & State Modeling: action def, action, state def, state, transition, First / then succession flows, fork, join, decide, merge, calc def, calc
  • Requirements & Verification: requirement def, requirement, satisfy, verify, verification def, concern, stakeholder, view, viewpoint, constraint def, constraint, assume, require

Formal Verification & Safety Analysis Engines ​

@modelscript/sysml2 includes seven specialized formal verification modules in languages/sysml2/src/:

  1. Activity Control-Flow & Petri-Net Soundness (activity-cfa.ts, activity-soundness.ts, activity-verifier.ts):
    • Lowers SysML v2 action def successions (first A then B), fork/join, and decide/merge nodes into Workflow Nets (1-safe Petri nets).
    • Verifies Option to Complete, Proper Completion, No Dead Transitions, Lack of Synchronization (parallel branches converging into a merge instead of a join), and Deadlock at Join (exclusive decide branches converging into a join).
  2. Decision Table Completeness & Disjointness (decision-table-verifier.ts):
    • Analyzes guarded decide branches and requirement tables via interval covering and SMT/constraint checking to detect Missing Cases (uncovered input domain gaps) and Overlapping Rules (non-deterministic guard collisions).
    • Exposed via CLI: npx msx verify-decisions architecture.sysml.
  3. Assume-Guarantee Contract Verification (contract-verifier.ts, multidomain-contract-bridge.ts):
    • Extracts assume constraint { ... } and require constraint { ... } blocks from requirement def and part def hierarchies.
    • Verifies Contract Compatibility (⋀Aenv≠⊥) and Refinement Soundness across composite sub-parts (Aparent⇒Achild and ⋀Gchildren⇒Gparent), bridging directly into the Multi-Domain Theory Coordinator.
  4. Hierarchical State Machine Verifier (state-machine-verifier.ts):
    • Checks state def machines for Unreachable States, Deadlock / Trap States (non-final states with no outgoing transitions), Non-Deterministic Transitions (overlapping guards on the same trigger event), and Missing Initial States.
  5. Hybrid Automaton Flowpipe Bridge (hybrid-flowpipe-bridge.ts):
    • Couples discrete SysML v2 state def mode transitions with continuous Modelica DAE dynamics to compute Taylor-model / interval reachability flowpipes and verify that unsafe states are unreachable over time horizon [0,T].
  6. Fault Tree & Physics-Informed Safety Analyzer (safety-analyzer.ts, physics-safety-bridge.ts):
    • Synthesizes Fault Trees from SysML v2 failure modes and interconnections, computes Minimal Cut Sets (MCS) via MOCUS/top-down boolean reduction, evaluates top-event failure probabilities, and cross-checks physical failure thresholds against simulated Modelica/FEA/CFD peak stresses and temperatures.
  7. Boundary-Value & MC/DC Test Vector Synthesizer (boundary-test-synthesizer.ts):
    • Automatically generates boundary-value (x=c−ϵ,c,c+ϵ) and Modified Condition/Decision Coverage (MC/DC) test vectors for every requirement def and calc def constraint.
    • Exposed via CLI: npx msx generate-tests architecture.sysml.

Direct SysML v2 → DAE Lowering & Enterprise Interchange ​

  • Direct Arena DAE Lowering (sysml2-dae-lowerer.ts): Compiles SysML v2 calc def, constraint def, attribute bindings, and flow connections directly into @modelscript/runtime's DAEBuilder without requiring an intermediate Modelica code-generation pass.
  • .sysmlx JSON-LD & Container Export (sysmlx-interchange.ts, sysml2-container-exporter.ts): Serializes and imports OMG SysML v2 REST/JSON-LD payloads (.sysmlx) and multi-artifact engineering containers.
  • Enterprise MBSE Gateway (enterprise-sync-gateway.ts): Synchronizes SysML v2 packages, elements, and cross-domain traceability links with Dassault Cameo Teamwork Cloud (TWC), OpenMBEE MMS, and standard OMG SysML v2 REST API repositories (npx msx sysml sync).

Polyglot TGG Rules (22 Cross-Domain Mappings) ​

@modelscript/sysml2 defines 22 bidirectional Triple Graph Grammar (TGG) rules in languages/sysml2/src/language.ts spanning Modelica (14 rules), OWL2 (5 rules), and STEP (3 rules):

Target LanguageRule Names
modelica (14 rules)SysML2PartDefToModelicaModel, SysML2AttributeDefToModelicaType, SysML2PortDefToModelicaConnector, SysML2ConnectionDefToModelicaModel, SysML2ActionDefToModelicaBlock, SysML2ConstraintDefToModelicaBlock, SysML2RequirementDefToModelicaBlock, SysML2PartToModelicaComponent, SysML2AttributeToModelicaParameter, SysML2PortToModelicaConnector, SysML2ConnectionToModelicaConnect, SysML2FlowToModelicaConnect, SysML2StateToModelicaBlock, SysML2TransitionToModelicaWhen
owl2 (5 rules)SysML2PartDefToOWL2Class, SysML2AttributeUsageToOWL2DataProperty, SysML2PortUsageToOWL2ObjectProperty, SysML2PartUsageToOWL2Individual, SysML2RequirementToOWL2Class
step (3 rules)SysML2PartDefToStepProduct, SysML2PartUsageToStepAssemblyUsage, SysML2AttributeToStepProperty

Diagnostic Rules ​

48 rules33 error10 warning5 info Run with msx lint

CodeRuleSeverityMessage
S1001parse-errorerrorParse error: <detail>.
S1002parse-missingerrorExpected token missing: '<expected>'.
S1003definition-namingwarningDefinition '<name>' should start with an uppercase letter
S1004usage-namingwarningUsage '<name>' should start with a lowercase letter
S1005package-namingwarningPackage '<name>' should start with an uppercase letter
S2001duplicate-memberwarningDuplicate member '<name>' in '<scope>'
S2002symbol-not-founderrorSymbol '<name>' not found in scope.
S2003allocation-target-unresolvederrorAllocation target '<target>' could not be resolved
S2003unresolved-targeterrorAllocation target '<target>' could not be resolved
S2004allocation-source-unresolvederrorAllocation source '<source>' could not be resolved
S2004unresolved-sourceerrorAllocation source '<source>' could not be resolved
S2005unresolved-importerrorImport '<pkg>' could not be resolved.
S2006unresolved-transition-stateerrorTransition state '<stateName>' could not be resolved in enclosing state machine.
S3001type-mismatcherrorType mismatch: cannot assign value of type '<actualType>' to feature '<featureName>' with declared type '<declaredType>'.
S3002incompatible-port-connectionerrorIncompatible port connection between '<p1>' (<t1>) and '<p2>' (<t2>).
S3003dimensional-mismatcherrorDimensional mismatch: cannot assign value of dimension '<actualDim>' to feature '<featureName>' with declared dimension '<targetDim>'.
S3004invalid-multiplicity-boundserrorInvalid multiplicity bounds: lower bound (<lower>) cannot be greater than upper bound (<upper>).
S3005target-not-requirementerrorTarget '<target>' is not a Requirement
S3006verify-target-not-a-requirementerrorVerify target '<target>' is not a Requirement
S3007dimensional-connection-mismatcherrorDimensional mismatch in connection between '<sourceName>' (<sourceDim>) and '<targetName>' (<targetDim>).
S4001circular-specializationerrorCircular specialization: '<name>' transitively specializes itself
S4002circular-satisfactionerrorCircular satisfaction: '<name>' transitively satisfies itself
S4003empty-definitioninfoDefinition '<name>' has no members
S4004abstract-requirement-violationerrorCannot make an existing concrete requirement abstract.
S4005ontological-inconsistencyerrorOntological inconsistency detected in '<name>'<detail>
S4006missing-subjectinfoRequirement '<name>' should have a specified subject or satisfy relation
S4007empty-packageinfoPackage '<name>' has no members
S4008requirement-without-constraintinfoRequirement '<name>' has no constraints or textual documentation
S4009empty-verification-caseinfoVerification case '<name>' has no verify requirements or sub-actions
S4010missing-verification-objectivewarningVerification case '<name>' has no verification objective or verify statement
S4011unverified-requirementwarningRequirement '<name>' is not verified by any verification case in package '<pkgName>'
S5001constraint-violatederrorConstraint '<name>' evaluates to false
S5002requirement-failederrorRequirement '<name>' has constraint(s) that evaluate to false
S5003broken-interface-contracterrorBroken interface contract on '<name>': <reason>
S5003interface-contract-brokenerrorBroken interface contract on '<name>': <reason>
S5004activity-cfa-unreachablewarning<detail>
S5005activity-soundness-violationerror<detail>
S5006definite-assignment-violationerrorVariable '<name>' may be used before definite assignment
S5007statemachine-nondeterministicerrorNon-deterministic guards detected: <detail>
S5008statemachine-deadlockerrorDeadlock gap detected in transition guards: <detail>
S5009satisfying-violated-requirementerrorPart '<partName>' cannot satisfy requirement '<reqName>': <violations>
S5010conflicting-requirementserrorConflicting requirements in '<pkgName>': <conflictNames> cannot be simultaneously satisfied.<witnessStr>
S5011interprocedural-contract-violationerror<detail>
S5012loop-non-terminatingwarning<detail>
S5013decision-table-non-exhaustivewarningDecision node '<decideName>' is not exhaustive: <detail>
S5014decision-table-nondeterministicerrorDecision node '<decideName>' has overlapping branch guards: <detail>
S5015decision-table-dead-branchwarningDecision node '<decideName>' has dead branch(es): <detail>
S5016activity-safety-violationerror<detail>

Generated from languages/sysml2/src/errors.ts. All languages →

Open-Core under the GNU AGPL v3 License; Enterprise Edition (ee/) under the ModelScript Enterprise License. • Trademark Policy