Skip to content
Beta.arxml@modelscript/autosar 15 diagnostic rules
Parser WASM GLR
Diagnostics 15 rules
DAE Arena Lowering
Simulation Native Solvers
Projections Modelica, SysML v2
Live ExampleTorqueVectoringComposition.arxml

AUTOSAR R4.x Torque Vectoring SWC & Virtual Function Bus

AUTOSAR Classic XML defining Sensor, Controller, and Inverter Actuator Software Components connected across Sender-Receiver ports.

Playground
Source (29 lines)
1<?xml version="1.0" encoding="UTF-8"?>
2<AUTOSAR xmlns="http://autosar.org/schema/r4.0">
3  <AR-PACKAGES>
4    <AR-PACKAGE>
5      <SHORT-NAME>ChassisControl</SHORT-NAME>
6      <ELEMENTS>
7        <SENSOR-ACTUATOR-SW-COMPONENT-TYPE>
8          <SHORT-NAME>YawRateSensorSwc</SHORT-NAME>
9          <PORTS>
10            <P-PORT-PROTOTYPE><SHORT-NAME>YawRateOut</SHORT-NAME></P-PORT-PROTOTYPE>
11          </PORTS>
12        </SENSOR-ACTUATOR-SW-COMPONENT-TYPE>
13        <APPLICATION-SW-COMPONENT-TYPE>
14          <SHORT-NAME>TorqueVectoringSwc</SHORT-NAME>
15          <PORTS>
16            <R-PORT-PROTOTYPE><SHORT-NAME>YawRateIn</SHORT-NAME></R-PORT-PROTOTYPE>
17            <P-PORT-PROTOTYPE><SHORT-NAME>RearTorqueSplitOut</SHORT-NAME></P-PORT-PROTOTYPE>
18          </PORTS>
19        </APPLICATION-SW-COMPONENT-TYPE>
20        <SENSOR-ACTUATOR-SW-COMPONENT-TYPE>
21          <SHORT-NAME>DualInverterActuatorSwc</SHORT-NAME>
22          <PORTS>
23            <R-PORT-PROTOTYPE><SHORT-NAME>RearTorqueSplitIn</SHORT-NAME></R-PORT-PROTOTYPE>
24          </PORTS>
25        </SENSOR-ACTUATOR-SW-COMPONENT-TYPE>
26      </ELEMENTS>
27    </AR-PACKAGE>
28  </AR-PACKAGES>
29</AUTOSAR>
AUTOSAR SWC Composition & Port Topology
YawRate_deg_s TorqueSplit_Nm «sensor-actuator-sw-component-type» YawRateSensorSwc «ports» P: YawRateOut «application-sw-component-type» TorqueVectoringSwc «ports» R: YawRateIn P: RearTorqueSplitOut «sensor-actuator-sw-component-type» DualInverterActuatorSwc «ports» R: RearTorqueSplitIn
Drag to pan · Click % to reset

AUTOSAR Classic & Adaptive Architecture ​

ModelScript delivers native, high-performance compiler support for AUTOSAR (.arxml), the international standard for automotive electronic control unit (ECU) software architectures. Engineers can parse, validate, simulate event-triggered and periodic runnables, and bridge automotive software components (SWCs) directly into continuous plant models and SysML v2 systems requirements.


Capabilities & Supported Formats ​

FormatExtensionDescription
AUTOSAR ARXML Document.arxml, .xmlXML schema defining packages, software component types (ApplicationSwComponentType, SensorActuatorSwComponentType), internal behaviors, runnables, timing events, interfaces, and ECU network topologies.

Key Architectural Pillars ​

  • High-Throughput ARXML Ingestion:
    • Robust XML extraction parsing software component definitions, client-server and sender-receiver interfaces, port prototypes, variable access definitions, runnable entities, and timing events via parseArxml().
  • In-Memory Virtual RTE Simulation Engine:
    • Implements an event-driven and periodic discrete scheduler (VirtualRte) reproducing AUTOSAR RTE semantics (Rte_Read, Rte_Write).
    • Routes signals across hierarchical assembly connectors (AssemblySwConnector) between provider P-ports and requester R-ports.
  • Automotive Static Linters (M7401–M7408):
    • Detects unconnected required ports, interface signature mismatches, Worst-Case Execution Time (WCET) budget overruns against event periods, overlapping signal allocations in CAN/LIN PDUs, and cyclic runnable dependencies.
  • Dual Architectural Projections:
    • Modelica Standard Blocks: Translates SWCs into acausal discrete blocks for Hardware-in-the-Loop (HIL) and Software-in-the-Loop (SIL) co-simulation with 1D vehicle plant dynamics.
    • SysML v2 Systems Architecture: Generates formal OMG SysML v2 part def hierarchies, connection usages, and port definitions for digital thread traceability.
  • Continuous/Discrete DAE Lowering:
    • Compiles SWC states, calibrated calibration parameters, and discrete runnable step functions into the DAEBuilder SoA linear memory arena.

Command Line Interface (msx autosar) ​

ModelScript CLI provides turnkey subcommands for automotive ECU engineering:

bash
msx autosar <action> [files...] [options]
ActionDescriptionKey Options
inspectDumps package hierarchy, SWC components, runnable entities, timing events, and network PDUs.—
lintRuns pre-flight automotive semantic checks, interface compatibility, and scheduling analysis.—
to-modelicaGenerates Modelica standard blocks representing SWC interfaces and communication buses.--out=<file.mo>
to-sysmlProjects AUTOSAR composition architecture to formal OMG SysML v2 code.--out=<file.sysml>
to-daeLowers software architecture into ModelScript linear-memory DAE arena and prints statistics.—
simulate-rteExecutes the Virtual RTE discrete event scheduler over a configured time window.--duration=<sec>, --step=<sec>, --out=<file.json>

Examples ​

bash
# Inspect automotive software components and timing events
msx autosar inspect PowertrainArchitecture.arxml

# Lint for unconnected R-ports, timing budget overflows, or PDU collisions
msx autosar lint BrakeController.arxml

# Project software component architecture to SysML v2 part definitions
msx autosar to-sysml SteeringSystem.arxml --out=SteeringArchitecture.sysml

# Simulate periodic runnable execution and signal routing through Virtual RTE
msx autosar simulate-rte PowertrainSystem.arxml --duration=0.5 --step=0.01 --out=rte_log.json

Automotive Pre-Flight Linters & Diagnostic Rules ​

15 rules11 error3 warning1 info Run with msx autosar lint

CodeRuleSeverityMessage
M7401unconnected-mandatory-porterrorRequired port '<portName>' on component '<compName>' (<typeName>) is unconnected in composition '<compSwc>'.
M7402interface-mismatcherrorInterface mismatch in connector '<connName>': Provider port '<pPort>' provides '<pIf>' while requester port '<rPort>' requires '<rIf>'.
M7403data-element-type-mismatchwarningData element '<deName>' in interface '<ifName>' has no data type reference.
M7403invalid-runnable-perioderrorTiming event for runnable '<symbol>' defines non-positive period (<period> s).
M7404duplicate-short-nameerrorDuplicate SHORT-NAME '<name>' detected in package '<pkg>'.
M7405invalid-data-type-mappingerrorInvalid data type mapping for '<dtName>': <reason>.
M7405wcet-budget-overflowerrorExecution time WCET (<wcetMs> ms) of runnable '<runnableName>' exceeds its timing event period (<periodMs> ms).
M7406circular-composition-dependencyerrorCircular software component composition dependency detected: <path>.
M7406overlapping-pdu-bitserrorSignals '<sigA>' and '<sigB>' overlap bit index <bitIdx> in PDU '<pduName>'.
M7407missing-software-address-methodwarningVariable data prototype '<variable>' lacks a declared SwAddrMethod memory section mapping.
M7407pdu-exceeds-frame-capacityerrorPDU '<pduName>' length (<pduLen> bytes) exceeds CAN frame '<frameName>' payload capacity (<frameLen> bytes).
M7408cyclic-runnable-dependencyerrorCyclic data dependency detected between runnables: '<value>'.
M7408incompatible-port-interface-directionerrorPort '<portName>' interface direction violation: <reason>.
M7409missing-internal-behaviorwarningAtomic software component '<swcName>' lacks internal behavior definition.
M7410untriggered-runnableinfoRunnable entity '<rName>' in SWC '<swcName>' has no associated RTE trigger event.

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


Language Server Protocol & Registry Integration ​

AUTOSAR .arxml documents enjoy full language intelligence through @modelscript/lsp:

typescript
import { parseArxml, lintAutosarModel, VirtualRte, autosarToModelica, autosarToSysml } from "@modelscript/autosar";

// Parse ARXML text
const model = parseArxml(arxmlText);

// Pre-flight static checking
const diagnostics = lintAutosarModel(model);

// Virtual RTE Execution
const rte = new VirtualRte(model);
rte.registerRunnable("PedalSensor", "RE_ReadPedal", (ctx) => {
  ctx.write("PedalOut", "Pos", 0.75);
});
rte.registerRunnable("EngineECU", "RE_ComputeThrottle", (ctx) => {
  const pedal = Number(ctx.read("PedalIn", "Pos"));
  ctx.write("ThrottleOut", "Cmd", pedal * 0.9);
});

// Advance 50 ms in 10 ms steps
const executionLog = rte.runUntil(0.05, 0.01);

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