Documentation menu

ArcLang and SysML v2

SysML v2 gave systems modeling a textual notation, formal semantics and a standard API. ArcLang shares the textual, tool-neutral idea, and applies it to a method: Arcadia. The two are complementary: ArcLang exports to SysML v2 and imports from it, so that a model is not locked in.

Export to SysML v2

$ arclang export examples/features/timing-constraints/timing_constraints.arc -f sys-ml -o lka.sysml
Exporting examples/features/timing-constraints/timing_constraints.arc to SysML format...
✓ Export successful
  Input: examples/features/timing-constraints/timing_constraints.arc
  Output: lka.sysml
  Format: SysML

The export is SysML v2 textual notation in an Arcadia profile: one package per Arcadia level, marked with a metadata definition of the ArcadiaProfile library the export declares (#OA, #SA, #LA, #PA, #EPBS). Every element is a usage, with its ArcLang id as short name and its name as written. Ports, sub-functions and sub-components are nested in their element, and typed quantities use the ISQ and SI libraries of the standard:

$ sed -n "/action <'SF-DET'>/,/^        }/p" lka.sysml
        action <'SF-DET'> 'Detect lane markings' : Types::'Periodic task' {
            attribute latency : DurationValue = 30 [ms];
            attribute :>> period = 33 [ms];
            attribute wcet : DurationValue = 0.035 [s];
            out item lane : Data::LaneModel;
        }

A functional chain is an action marked #Chain, whose steps specialize the functions they run, in order:

$ sed -n "/#Chain action <'FC-LKA'>/,/^        }/p" lka.sysml
        #Chain action <'FC-LKA'> 'Lane departure reaction' {
            attribute latency_budget : DurationValue = 80 [ms];
            action step1 :> 'SF-DET';
            then action step2 :> 'SF-EST';
            then action step3 :> 'SF-CMD';
        }

The only definitions are those ArcLang has: user-defined types, abstract, with their defaults and what an instance must provide:

$ sed -n "/abstract action def 'Periodic task'/,/^        }/p" lka.sysml
        abstract action def 'Periodic task' {
            doc /* instances must provide: wcet, latency */
            attribute period : DurationValue default = 20 [ms];
        }

What maps to what

ArcLang SysML v2
Arcadia level package marked #OA, #SA, #LA, #PA or #EPBS
Requirement requirement with its identifier and doc
Function, activity action usage with its in and out items, nested functions inside
Functional chain #Chain action whose steps specialize the functions, ordered with then; control nodes are fork, join, decide, merge
Actor, entity, component, node part usage (#Actor, #Entity, #Node, #Behavior, #Hardware when SysML cannot tell), nested parts and ports
Function allocated to a component perform of the function in the component
Port, interface port usage typed by a port def; #Interface connection
Exchange, physical link flow between ports, connection between components, #Link connection
Deployment allocate ... to ...
satisfies trace satisfy; any other trace is a #Trace dependency named by its kind
Test case verification with its objective and verify; an analysis asserts its constraints
Variation, variant, configuration variation part typed by a definition holding what it has of its own, variant part, #Configuration part with a dependency to each variant it selects
Tag, tagged diagram metadata def of a Tags package applied as @Tag;; view with expose and filter @Tag
State machine, mode state usage with its states, #Mode, entry; then and transitions
Scenario occurrence with one lifeline per participant, events and messages, state invariants
Constraint Asserted constraint expression
User-defined type, extends, redefinition Abstract definition, :> and :>>; a port def, connection def or allocation def when ports, exchanges or allocations take it
Class, exchange item, enumeration #Class item def, #ExchangeItem item def, enum def
Typed quantity Attribute typed by ISQ, with its SI unit: DurationValue = 30 [ms]
Multiplicity Multiplicity on the usage: [1..*]

The metamodel gives the SysML v2 construct of every element kind.

Known limit. SysML v2 has no hazard or FMEA construct. Hazards and FMEA entries are exported as requirements marked #Hazard and #Fmea, with their classification as attributes.

Import from SysML v2

arclang import -f sysml reads any text of the SysML v2 textual notation, with a complete KerML and SysML parser, and writes an ArcLang model that compiles. It also reads the JSON records of the Systems Modeling API.

$ arclang import -f sysml -o lka_back.arc lka.sysml
Importing from SysML: lka.sysml...
  1 component exchanges
  5 constraints
  2 deployments
  3 exchange items
  1 functional chains
  2 functional exchanges
  5 functions
  1 hazards
  2 logical components
  1 operational actors
  1 physical links
  2 physical nodes
  6 ports
  1 references by dependency
  1 requirements
  1 test cases
  2 traces
  4 types
✓ Import successful
  Input: lka.sysml
… (1 more lines)

An ArcLang model comes back whole: on every example of the repository, including the 1 600 declarations of the Eclipse Capella In-Flight Entertainment sample, the model imported from its own export has the same elements and the same relationships as the original. A model written by another tool comes back as far as Arcadia can hold it: the import counts what it wrote and names what it left out. The 95 examples of the OMG SysML v2 release import and compile.

A model written for SysML alone, without the Arcadia profile, is read as a SysML tool reads it:

SysML v2 ArcLang
part, nested parts logical components, nested
connect, interface, bind component exchanges between the ports named, along the path written (vehicle_b.engine.drivePwrPort)
perform a.b; the function written in the part that performs it, parent: naming the action it decomposes
flow between action parameters functional exchanges
message between parts or events of their ports a scenario, its lifelines the parts the messages go between
state def, exhibit state state machines
each configuration (a root part) and each part holding connections its interconnection view
each action tree its dataflow view, over the parts performing its leaves

| accept, send | functions; what an action accepts is its output | | flow between items of ports (h.outlet.air) | a component exchange between the ports, carrying the item's type | | view with expose and filter @Meta | a diagram of what it exposes | | port def holding ports, connect a.p.q to ... | ports that hold ports (port inout "p" { port inout "q" }), named Owner.p.q | | connect (a, b, c) | a component exchange of every end (ends: [...]), drawn through a junction | | entry; then s;, transition initial then s; | the initial state of the machine or region |

Names resolve as the specification says: public imports are followed (public import Definitions::* brings what Definitions imports publicly), as are ::** imports and features known by what they redefine or reference (perform providePower.generateTorque). They also resolve against the SysML v2 standard library (ISQ::mass, ScalarValues::Real, ShapeItems::Box, the start and done of every action): the parser reads the 94 files of the library, KerML ones included, and the compiler carries what their names designate.

A model in several files is one model: arclang import -f sysml models/ reads every .sysml and .kerml file under the directory, and names resolve across them. Each of the 22 example folders of the OMG release imports this way.

The playground does the same in the browser: it opens the Simple Vehicle Model of Annex A of the SysML v2 specification and imports it in the page, with its configurations, their connections, the dataflow of its action tree, its state machines and its sequences drawn as Arcadia diagrams. Its Import SysML v2… button opens .sysml files of yours the same way (select several for a model in several files), without sending them anywhere.

The cybersecurity analysis takes the profile too: security_scales is a #SecurityScales package of enumerations, each security_analysis a #Security package, each asset a #PrimaryAsset part and each threat a #Threat part, with what they name as dependencies. It comes back whole.

Validated by the OMG pilot implementation

An export that no SysML v2 tool can read would be worthless. The export of every example of the repository is parsed and accepted without error by the OMG SysML v2 pilot implementation, in a dedicated continuous-integration workflow (tools/validate_sysml_corpus.sh).

A second check goes further than "it parses". tools/check_sysml_abstract_syntax_corpus.sh compares, element by element, the abstract syntax ArcLang serves with the one the pilot derives from the same text: metaclass, names, ownership, direction, typing, specialization, connector ends and whole expression trees.

SysML v2 through the API

arclang serve exposes each model under two vocabularies, over the same commits:

  • /api/systems-modeling: element types are kinds of the ArcLang metamodel (LogicalComponent, Requirement).
  • /api/sysml-v2: element types are KerML and SysML v2 metaclasses (PartDefinition, ActionUsage, RequirementUsage, SatisfyRequirementUsage), with memberships, typing, specialization and expressions as elements.

The second view is not a separate mapping. It is the abstract syntax of the export above, read back from the text the pilot validates, so the API and the export cannot disagree. It is read-only, and it does not hold the content of standard-library elements or what KerML derives implicitly. See the HTTP API page.

arclang export -f sysml-json writes the same records to a file.

How the two compare

SysML v2 ArcLang
Nature A general-purpose modeling language, standardized by the OMG A language for one method, Arcadia
Method None imposed: you bring your own Built in: operational, system, logical, physical, EPBS, and the links between them
Core concepts Definitions and usages, specialization, KerML semantics Arcadia element kinds with typed attributes
Expressiveness Very broad: behavior, parametrics, variability, views Narrower, by design: architecture, traceability, timing, safety attributes
Learning curve The language, then a method to apply with it The method is the language
Checks Language validity; method rules are up to the tool or the team Arcadia rules and a production gate with a verdict
Diagrams Views defined by the standard, rendered by tools Arcadia viewpoints generated by the compiler
Capella Through third-party bridges Round-trip, byte-identical on the test model
Standard API Systems Modeling API Same resource model, plus git history as commits

Choose SysML v2 when you need a standard notation across many suppliers and tools, or modeling beyond architecture, such as detailed behavior and parametric analysis. Choose ArcLang when your team follows Arcadia and wants the method enforced by a compiler, in Git. Because ArcLang exports to SysML v2 and imports from it, starting with one does not close the door on the other.

Every ArcLang sample on this page is compiled, and every command is run, with the released compiler when the site is built.