Installation
OM.jl is a multi-package project: the compiler stages live in sibling sub-packages (OMFrontend.jl, OMBackend.jl, OMParser.jl, …) that the top-level OM package references through Project.toml [sources] paths. Those sub-packages are git submodules, so they must be checked out.
Requirements
- Julia 1.13 (the project's
[compat]pinsjulia = "1.13"). - Git.
Clone with submodules
git clone --recurse-submodules https://github.com/JKRT/OM.jl.git
cd OM.jlIf you already cloned without --recurse-submodules:
git submodule update --init --recursiveInstantiate
OM.jl depends on packages registered in the General registry and in the OpenModelica registry, so add both before instantiating. Nothing is built: the C library of OMRuntimeExternalC is an artifact, installed by Pkg.instantiate.
julia --project -e '
import Pkg
Pkg.Registry.add("General")
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/OpenModelica/OpenModelicaRegistry.git"))
Pkg.instantiate()
Pkg.precompile()'Their package manager cannot update a registry it added by URL (a shallow clone), so new versions of the OM.jl packages stay invisible. Re-add the registry to get them (fixed in JuliaLang/Pkg.jl#4823, in later 1.13 releases):
import Pkg
Pkg.Registry.rm("OpenModelica")
Pkg.Registry.add(url = "https://github.com/OpenModelica/OpenModelicaRegistry.git")
Pkg.update()First run
using OM
sol = OM.simulate("Modelica.Mechanics.MultiBody.Examples.Elementary.Pendulum";
MSL_Version = "MSL:3.2.3", stopTime = 1.0)The first call compiles a large dependency tree (ModelingToolkit, DifferentialEquations); subsequent runs in the same session are fast.
Keep a warm Julia session
For both regular use and development, start Julia in the project environment (julia --project=. from this repository) and keep that REPL running. Repeated translation and simulation calls then reuse compiled compiler and SciML code.
During development, install Revise in your default Julia environment and load it before OM:
using Revise
using OMRevise applies most source edits without a restart. Run Revise.revise() when needed, and call OM.clearCaches!() after changes that can invalidate generated models or backend caches.
Other MSL versions and third-party libraries
MSL_Version selects the bundled MSL (3.2.3 or 4.1.0). Other versions and other libraries are installed ones (OM.jl's ~/OMJL/libraries, where installLibrary puts a library cloned from its git repository, or OpenModelica's ~/.openmodelica/libraries), loaded and passed by their key:
OM.installLibrary("ExternData"; version = "3.2.0", url = "https://github.com/modelica-3rdparty/ExternData")
key = OM.loadInstalledLibrary("ExternData")
(fm, _) = OM.flatten("ExternData.Examples.CSVTest"; libraries = [key])Where libraries come from, how to install one, and what happens when one is missing: Libraries.