Giter VIP home page Giter VIP logo

thummeto / fmibuild.jl Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 2.0 62 KB

FMIBuild.jl holds dependencies that are required to compile and zip a Functional Mock-Up Unit (FMU) compliant to the FMI-standard (fmi-standard.org). Because this dependencies should not be part of the compiled FMU, they are out-sourced into this package. FMIBuild.jl provides the build-commands for the Julia package FMIExport.jl.

License: MIT License

Julia 89.78% C 10.22%
export fmi fmu julia

fmibuild.jl's Introduction

FMI.jl Logo

FMIBuild.jl

What is FMIBuild.jl?

FMIBuild.jl holds dependencies that are required to compile and zip a Functional Mock-Up Unit (FMU) compliant to the FMI-standard (fmi-standard.org). Because this dependencies should not be part of the compiled FMU, they are out-sourced into this package. FMIBuild.jl provides the build-commands for the Julia package FMIExport.jl.

Run Tests Run PkgEval Coverage

How can I use FMIBuild.jl?

Please note: FMIBuild.jl is not meant to be used as it is, but as part of FMI.jl and FMIExport.jl. However you can install FMIBuild.jl by following these steps.

1. Open a Julia-REPL, switch to package mode using ], activate your preferred environment.

2. Install FMIBuild.jl:

(@v1.x) pkg> add FMIBuild

(3). If you want to check that everything works correctly, you can run the tests bundled with FMIBuild.jl:

(@v1.x) pkg> test FMIBuild

What FMI.jl-Library should I use?

FMI.jl Family To keep dependencies nice and clean, the original package FMI.jl had been split into new packages:

  • FMI.jl: High level loading, manipulating, saving or building entire FMUs from scratch
  • FMIImport.jl: Importing FMUs into Julia
  • FMIExport.jl: Exporting stand-alone FMUs from Julia Code
  • FMIBase.jl: Common concepts for import and export of FMUs
  • FMICore.jl: C-code wrapper for the FMI-standard
  • FMISensitivity.jl: Static and dynamic sensitivities over FMUs
  • FMIBuild.jl: Compiler/Compilation dependencies for FMIExport.jl
  • FMIFlux.jl: Machine Learning with FMUs
  • FMIZoo.jl: A collection of testing and example FMUs

What Platforms are supported?

FMIBuild.jl is tested (and testing) under Julia Versions 1.6 LTS and latest on Windows latest and Ubuntu latest. x64 architectures are tested. Mac and x86-architectures might work, but are not tested.

How to cite?

Tobias Thummerer, Johannes Stoljar and Lars Mikelsons. 2022. NeuralFMU: presenting a workflow for integrating hybrid NeuralODEs into real-world applications. Electronics 11, 19, 3202. DOI: 10.3390/electronics11193202

Related publications?

Tobias Thummerer, Lars Mikelsons and Josef Kircher. 2021. NeuralFMU: towards structural integration of FMUs into neural networks. Martin Sjölund, Lena Buffoni, Adrian Pop and Lennart Ochel (Ed.). Proceedings of 14th Modelica Conference 2021, Linköping, Sweden, September 20-24, 2021. Linköping University Electronic Press, Linköping (Linköping Electronic Conference Proceedings ; 181), 297-306. DOI: 10.3384/ecp21181297

Tobias Thummerer, Johannes Tintenherr, Lars Mikelsons. 2021 Hybrid modeling of the human cardiovascular system using NeuralFMUs Journal of Physics: Conference Series 2090, 1, 012155. DOI: 10.1088/1742-6596/2090/1/012155

fmibuild.jl's People

Contributors

stoljarjo avatar thummeto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fmibuild.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Use of StaticCompiler.jl

Thanks for making this very cool package! Has thought been given to how StaticCompiler.jl may be leveraged for this package? I see that the resulting binaries now appear to link to libjulia and friends, and I wonder if StaticCompiler could yield smaller binaries and perhaps a simpler architecture.

Linux-compatible FMU generation

Hi there.
I've been trying to export the BouncingBall example in FmiExport.jl but this fails with the following error:

[ Info: Saving example files at: /tmp/fmibuildjl_test_pT3ZdP
[ Info: [Build FMU] Automatically determined build file at: `/home/cas/tmp/FMIExport.jl/example/FMI2/BouncingBall/src/BouncingBall.jl`.
[ Info: [Build FMU] Generating package ...
[ Info: [Build FMU] Source package is /home/cas/tmp/FMIExport.jl/example/FMI2/BouncingBall, deployed at /tmp/fmibuildjl_axGCIh/merged_BouncingBall
[ Info: [Build FMU] Relative src file path is src/BouncingBall.jl
[ Info: [Build FMU] ... reading FMU template file at /home/cas/.julia/packages/FMIBuild/y2TgX/src/../template/ME/FMU2/src/FMU2_content.jl
[ Info: [Build FMU] ... reading old FMU source file at /tmp/fmibuildjl_axGCIh/merged_BouncingBall/src/BouncingBall.jl
[ Info: [Build FMU] Removing `FMIBUILD_NO_EXPORT_*` blocks ...
[ Info: [Build FMU] ... removed `FMIBUILD_NO_EXPORT_*` blocks.
[ Info: [Build FMU] Adding/removing dependencies ...
  Activating project at `/tmp/fmibuildjl_axGCIh/merged_BouncingBall`
[ Info: [Build FMU]    > Most recent version of `FMIExport` already checked out, is `/home/cas/.julia/packages/FMIExport/Fq22B`.
   Resolving package versions...
    Updating `/tmp/fmibuildjl_axGCIh/merged_BouncingBall/Project.toml`
  [8af89139] + FMICore v0.17.2
  No Changes to `/tmp/fmibuildjl_axGCIh/merged_BouncingBall/Manifest.toml`
[ Info: [Build FMU]    > Added `FMICore`
    Updating `/tmp/fmibuildjl_axGCIh/merged_BouncingBall/Project.toml`
  [226f0e26] - FMIBuild v0.1.15
    Updating `/tmp/fmibuildjl_axGCIh/merged_BouncingBall/Manifest.toml`
  [226f0e26] - FMIBuild v0.1.15
  [9b87118b] - PackageCompiler v2.1.7
  [05181044] - RelocatableFolders v1.0.0
  [6c6a2e73] - Scratch v1.2.0
  [a5390f91] - ZipFile v0.10.1
  [4af54fe1] - LazyArtifacts
[ Info: [Build FMU]    > Removed FMIBuild
  Activating project at `~/tmp/FMIExport.jl/example/FMI2/BouncingBall`
[ Info: [Build FMU] ... adding/removing dependencies done.
[ Info: [Build FMU] ... generating new FMU source file at /tmp/fmibuildjl_axGCIh/merged_BouncingBall/src/BouncingBall.jl
[ Info: [Build FMU] ... generating package done.
[ Info: [Build FMU] Compiling FMU ...
[ Warning: PackageCompiler: This does not look like an official Julia build, functionality may suffer.
PackageCompiler: bundled artifacts:
  ├── Libiconv_jll - 3.674 MiB
  └── XML2_jll - 5.872 MiB
  Total artifact file size: 9.545 MiB
✔ [02m:15s] PackageCompiler: compiling base system image (incremental=false)
✔ [02m:59s] PackageCompiler: compiling nonincremental system image
Precompiling project...
  11 dependencies successfully precompiled in 6 seconds
[ Info: PackageCompiler: Executing /tmp/fmibuildjl_axGCIh/merged_BouncingBall/src/BouncingBall.jl => /tmp/jl_packagecompiler_OKjrQk/jl_RcdzTu
[ Info: PackageCompiler: Done
✔ [01m:18s] PackageCompiler: compiling incremental system image
In file included from /home/cas/.julia/packages/FMIBuild/y2TgX/src/../template/ME/header/FMU2_init.c:19:
/home/cas/.julia/packages/FMIBuild/y2TgX/src/../template/ME/header/FMU2_init.h:104:10: fatal error: WinDef.h: No such file or directory
  104 | #include <WinDef.h>
      |          ^~~~~~~~~~
compilation terminated.
ERROR: LoadError: failed process: Process(`gcc -c -O2 '-DJULIAC_PROGRAM_LIBNAME="libBouncingBall.so"' -DNEW_DEFINE_FAST_TLS_SYNTAX -m64 -std=gnu99 -I/usr/include/julia -fPIC -march=x86-64 -o /home/cas/.julia/packages/FMIBuild/y2TgX/src/../template/ME/header/FMU2_init.o /home/cas/.julia/packages/FMIBuild/y2TgX/src/../template/ME/header/FMU2_init.c`, ProcessExited(1)) [1]

Stacktrace:
  [1] run
    @ ./process.jl:477 [inlined]
  [2] run_compiler(cmd::Cmd; cplusplus::Bool)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:194
  [3] run_compiler
    @ ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:190 [inlined]
  [4] compile_c_init_julia(julia_init_c_file::String, sysimage_name::String)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:665
  [5] create_sysimage(packages::Vector{String}; sysimage_path::String, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::String, julia_init_c_file::String, version::Nothing, soname::String, compat_level::String, extra_precompiles::String)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:598
  [6] create_sysimage_workaround(ctx::Pkg.Types.Context, sysimage_path::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String; sysimage_build_args::Cmd, include_transitive_dependencies::Bool, julia_init_c_file::String, version::Nothing, soname::String, script::Nothing)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:1072
  [7] create_sysimage_workaround
    @ ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:1045 [inlined]
  [8] create_library(package_dir::String, dest_dir::String; lib_name::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, force::Bool, header_files::Vector{String}, julia_init_c_file::String, version::Nothing, compat_level::String, cpu_target::String, include_lazy_artifacts::Bool, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, script::Nothing)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:992
  [9] create_library
    @ ~/.julia/packages/PackageCompiler/b2smD/src/PackageCompiler.jl:941 [inlined]
 [10] fmi2Save(fmu::FMICore.FMU2, fmu_path::String, fmu_src_file::Nothing; standalone::Bool, compress::Bool, cleanup::Bool, removeLibDependency::Bool, removeNoExportBlocks::Bool, resources::Nothing, surpressWarnings::Bool, debug::Bool, pkg_comp_kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FMIBuild ~/.julia/packages/FMIBuild/y2TgX/src/FMIBuild.jl:294
 [11] fmi2Save
    @ ~/.julia/packages/FMIBuild/y2TgX/src/FMIBuild.jl:68 [inlined]
 [12] fmi2Save(fmu::FMICore.FMU2, fmu_path::String)
    @ FMIBuild ~/.julia/packages/FMIBuild/y2TgX/src/FMIBuild.jl:68
 [13] top-level scope
    @ ~/tmp/FMIExport.jl/example/FMI2/BouncingBall/src/BouncingBall.jl:138
 [14] include(fname::String)
    @ Base.MainInclude ./client.jl:478
 [15] top-level scope
    @ REPL[2]:1
in expression starting at /home/cas/tmp/FMIExport.jl/example/FMI2/BouncingBall/src/BouncingBall.jl:138

I don't really know how to fix this. In template/ME/FMU2_init.h it says the code is windows specific (I'm using Fedora38) and I think that is the problem? Are there any plans to make the fmu-generation linux compatible? Or am I missing something obvious?

EDIT: I have tried generating BouncingBall.fmu on a Windows machine and this did work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.