Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 2.09 KB

File metadata and controls

57 lines (41 loc) · 2.09 KB

TestBaseModelica

Test coupling of Base Modelica export off OpenModelica and ModelingToolkit.jl.

For a Base Modelica file exported by OpenModelica parsing with BaseModelica.jl and simulating with OrdinaryDiffEq.jl is tested.

Dependencies

  • Julia
  • Julia packages

Precompilation

To speed up the execution of the test and reduce the TTFP-overhad of Julia there are two options:

  1. Precompile this package with PackageCompiler.jl and start a new Julia session for each test.

    julia> using PackageCompiler
    (@v1.11) pkg> activate .
    julia> create_sysimage(["TestBaseModelica"]; sysimage_path="TestBaseModelica.so", precompile_execution_file="precompile_skript.jl" )
    time julia --project=$(pwd) -e 'using TestBaseModelica; solver_settings=SolverSettings(start_time=0.0, stop_time=1.0, interval=0.02, tolerance=1e-6); test_settings=TestSettings(modelname="FirstOrder", output_directory="FirstOrder", solver_settings=solver_settings); run_test(joinpath("examples", "FirstOrder.bmo"); settings=test_settings)'
    
    time julia --sysimage=TestBaseModelica.so -e 'using .TestBaseModelica; solver_settings=SolverSettings(start_time=0.0, stop_time=1.0, interval=0.02, tolerance=1e-6); test_settings=TestSettings(modelname="FirstOrder", output_directory="FirstOrder", solver_settings=solver_settings); run_test(joinpath("examples", "FirstOrder.bmo"); settings=test_settings)'
  2. Keep a Julia daemon running in the background for all tests by using DaemonMode.jl

How to use

using TestBaseModelica

solver_settings = SolverSettings(
  start_time = 0.0,
  stop_time = 1.0,
  interval = 0.02,
  tolerance = 1e-6
)

test_settings = TestSettings(
  modelname = "FirstOrder",
  output_directory = "FirstOrder",
  solver_settings = solver_settings)

run_test(joinpath("examples", "FirstOrder.bmo"); settings = test_settings)