Skip to content

Latest commit

 

History

History
74 lines (57 loc) · 1.97 KB

File metadata and controls

74 lines (57 loc) · 1.97 KB

Julia

OpenSysML is a Julia client that calls the service using Connect-JSON over HTTP.jl. It provides model parsing, evaluation, execution, verification and typed query results without generated protobuf code.

Install

Julia 1.10 or later is required. The package is not in the Julia General registry; develop it from a checkout:

using Pkg
Pkg.develop(path = "client/julia/OpenSysML")

First model

Create a connection, parse the shared Demo model and check error diagnostics before evaluating the sedan's mass:

using OpenSysML

source = """
package Demo {
  part def Vehicle {
    attribute mass default = 1500.0;
  }
  part sedan : Vehicle {
    attribute :>> mass = 1800.0;
  }
}
"""

conn = connect()
try
    model = parse_source(conn, source; name="demo.sysml")
    if !isok(model)
        foreach(println, diagnostics(model))
        error("The model has errors.")
    end

    mass = evaluate(model, "mass"; subject="Demo::sedan")
    println(mass)
finally
    close(conn)
end
1800.0

Julia's API also includes multi-document parsing, model values, behavior and state execution, verification, analysis, editing, conversion and queries.

Service source

Julia starts a private service by default, but a missing binary does not trigger a release download unless version= or OPENSYSML_GRPC_VERSION explicitly requests one. See the service-binary reference for the available binary sources and release settings.

Parse errors are available from diagnostics(model); requests that cannot be completed raise typed client errors. The README documents the resolver's digest behavior and the service capabilities the client uses.

Next steps