OMBackend.jl is one component of the new OpenModelica Compiler infrastructure for Julia. It is able to transform a given Hybrid DAE and simulate it using DifferentialEquations.jl.
- Julia 1.7
- ExportAll.jl
- MetaModelica.jl
- Setfield.jl
- OMCompiler.jl
- DifferentialEquations.jl
And more..
Install dependencies with:
julia> import Pkg
julia> Pkg.build("OMBackend")
or:
julia> include("deps/build.jl")
Then precompile with:
(v1.7) pkg> activate .
julia> using OMBackend
In the folder containing OMBackend:
julia> activate .
Then run:
(OMBackend) pkg> test
As an alternative assuming you have activated OMBackend:
julia> include("test/runtests.jl")
Assuming you use DAE.jl and a suitable frontend you can use OMBackend to simulate your Modelica models.
model BouncingBallReals
parameter Real e=0.7;
parameter Real g=9.81;
Real h(start=1);
Real v;
equation
der(h) = v;
der(v) = -g;
when h <= 0 then
reinit(v, -e*pre(v));
end when;
end BouncingBallReals;
Simply pass the given DAE or FlatModelica to the function translate.
julia> OMBackend.translate(BouncingBallReals)
julia> OMBackend.simulate("BouncingBallReals", tspan = (0.0, 2.5))