Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_Modia3D_sysimage.jl added (to generate a Modia3D sysimage) #112

Merged
merged 2 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,30 @@ Modia3D has various *3D animation features*:
For example in Linux with command: `chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis`


## Faster Startup

In order to speed up startup, it is adviced to generate a sysimage by executing the following commands:

```julia
julia
using Modia3D
include("$(Modia3D.path)/create_Modia3D_sysimage.jl")
exit()
```

This will include a file `Modia3D_sysimage.dll` (on Windows) or `Modia3D_sysimage.so` (otherwise) in your
current working directory that includes all packages of your current project and the following packages
(these packages are added to your current project, if not yet included):

- Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise

Start julia with this sysimage in the following way:

```
julia -JModia3D_sysimage.dll (on Windows)
julia -JModia3D_sysimage.so (otherwise)
```

## Main Developers and License

[Andrea Neumayr](mailto:[email protected]),
Expand Down
40 changes: 40 additions & 0 deletions create_Modia3D_sysimage.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# License for this file: MIT (expat)
# Copyright 2022, DLR Institute of System Dynamics and Control
# Author: Martin Otter (DLR)
#
# Execute this script via
#
# include("create_Modia3D_sysimage.jl")
#
# to generate a sysimage of your current project and store it in your current working directory.
# Before generating the sysimage, the following packages are added to your current project (if not yet included):
#
# Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise
#
module Create_Modia3D_sysimage

path = dirname(@__FILE__)
file = joinpath(path, "create_Modia3D_sysimage.jl")
Modia3D_sysimage_path = joinpath(pwd(), Sys.iswindows() ? "Modia3D_sysimage.dll" : "Modia3D_sysimage.so")

import Pkg
project = Pkg.project()
projectPath = project.path
availablePackages = keys(project.dependencies)
addPackages = setdiff!(["Modia", "Modia3D", "ModiaPlot_PyPlot", "PackageCompiler", "Revise"], availablePackages)
println("!!! Creating sysimage for Modia3D from $file")
println("!!! This will include all packages from project $projectPath")
if length(addPackages) > 0
println("!!! Additionally, it will include the following packages")
println("!!! $addPackages")
println("!!! that are now added to the project ...")
Pkg.add(addPackages)
end

using PackageCompiler
create_sysimage(sysimage_path = Modia3D_sysimage_path)

println("!!! Modia3D sysimage created. Use sysimage by starting julia with:")
println(" julia -J$Modia3D_sysimage_path")

end
29 changes: 28 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,30 @@ Modia3D has various *3D animation features*:
For example in Linux with command: `chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis`


## Faster Startup

In order to speed up startup, it is adviced to generate a sysimage by executing the following commands:

```julia
julia
using Modia3D
include("$(Modia3D.path)/create_Modia3D_sysimage.jl")
exit()
```

This will include a file `Modia3D_sysimage.dll` (on Windows) or `Modia3D_sysimage.so` (otherwise) in your
current working directory that includes all packages of your current project and the following packages
(these packages are added to your current project, if not yet included):

- Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise

Start julia with this sysimage in the following way:

```
julia -JModia3D_sysimage.dll (on Windows)
julia -JModia3D_sysimage.so (otherwise)
```

## Publications

| | Paper or Talk | Conference | DOI or YouTube |
Expand All @@ -71,11 +95,14 @@ Modia3D has various *3D animation features*:

### Version 0.10.3

- New script `Modia3D/create_Modia3D_sysimage.jl` to create a sysimage for a much faster startup
(usage see Installation notes above or README.md file).

- New keyword `Scene(provideAnimationHistory=true)` in order to store animation data compactly during a simulation run.
After `simulate!(instantiatedModel, ...)`, the animation data of a `Model3D(..)` can be retrieved as dictionary via the new
function `get_animationHistory(instantiatedModel, modelPathAsString)`

- Improvements of the MPR algorithm to determine the distances between Object3Ds.
- Improvements of the MPR algorithm (which determines the distances between Object3Ds).


### Version 0.10.2
Expand Down