Skip to content

Commit 6408163

Browse files
authored
Merge pull request #112 from ModiaSim/mo_startup_up
create_Modia3D_sysimage.jl added (to generate a Modia3D sysimage)
2 parents 31b6081 + 3078732 commit 6408163

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,30 @@ Modia3D has various *3D animation features*:
5555
For example in Linux with command: `chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis`
5656

5757

58+
## Faster Startup
59+
60+
In order to speed up startup, it is adviced to generate a sysimage by executing the following commands:
61+
62+
```julia
63+
julia
64+
using Modia3D
65+
include("$(Modia3D.path)/create_Modia3D_sysimage.jl")
66+
exit()
67+
```
68+
69+
This will include a file `Modia3D_sysimage.dll` (on Windows) or `Modia3D_sysimage.so` (otherwise) in your
70+
current working directory that includes all packages of your current project and the following packages
71+
(these packages are added to your current project, if not yet included):
72+
73+
- Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise
74+
75+
Start julia with this sysimage in the following way:
76+
77+
```
78+
julia -JModia3D_sysimage.dll (on Windows)
79+
julia -JModia3D_sysimage.so (otherwise)
80+
```
81+
5882
## Main Developers and License
5983

6084
[Andrea Neumayr](mailto:[email protected]),

create_Modia3D_sysimage.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# License for this file: MIT (expat)
2+
# Copyright 2022, DLR Institute of System Dynamics and Control
3+
# Author: Martin Otter (DLR)
4+
#
5+
# Execute this script via
6+
#
7+
# include("create_Modia3D_sysimage.jl")
8+
#
9+
# to generate a sysimage of your current project and store it in your current working directory.
10+
# Before generating the sysimage, the following packages are added to your current project (if not yet included):
11+
#
12+
# Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise
13+
#
14+
module Create_Modia3D_sysimage
15+
16+
path = dirname(@__FILE__)
17+
file = joinpath(path, "create_Modia3D_sysimage.jl")
18+
Modia3D_sysimage_path = joinpath(pwd(), Sys.iswindows() ? "Modia3D_sysimage.dll" : "Modia3D_sysimage.so")
19+
20+
import Pkg
21+
project = Pkg.project()
22+
projectPath = project.path
23+
availablePackages = keys(project.dependencies)
24+
addPackages = setdiff!(["Modia", "Modia3D", "ModiaPlot_PyPlot", "PackageCompiler", "Revise"], availablePackages)
25+
println("!!! Creating sysimage for Modia3D from $file")
26+
println("!!! This will include all packages from project $projectPath")
27+
if length(addPackages) > 0
28+
println("!!! Additionally, it will include the following packages")
29+
println("!!! $addPackages")
30+
println("!!! that are now added to the project ...")
31+
Pkg.add(addPackages)
32+
end
33+
34+
using PackageCompiler
35+
create_sysimage(sysimage_path = Modia3D_sysimage_path)
36+
37+
println("!!! Modia3D sysimage created. Use sysimage by starting julia with:")
38+
println(" julia -J$Modia3D_sysimage_path")
39+
40+
end

docs/src/index.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,30 @@ Modia3D has various *3D animation features*:
5252
For example in Linux with command: `chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis`
5353

5454

55+
## Faster Startup
56+
57+
In order to speed up startup, it is adviced to generate a sysimage by executing the following commands:
58+
59+
```julia
60+
julia
61+
using Modia3D
62+
include("$(Modia3D.path)/create_Modia3D_sysimage.jl")
63+
exit()
64+
```
65+
66+
This will include a file `Modia3D_sysimage.dll` (on Windows) or `Modia3D_sysimage.so` (otherwise) in your
67+
current working directory that includes all packages of your current project and the following packages
68+
(these packages are added to your current project, if not yet included):
69+
70+
- Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise
71+
72+
Start julia with this sysimage in the following way:
73+
74+
```
75+
julia -JModia3D_sysimage.dll (on Windows)
76+
julia -JModia3D_sysimage.so (otherwise)
77+
```
78+
5579
## Publications
5680

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

7296
### Version 0.10.3
7397

98+
- New script `Modia3D/create_Modia3D_sysimage.jl` to create a sysimage for a much faster startup
99+
(usage see Installation notes above or README.md file).
100+
74101
- New keyword `Scene(provideAnimationHistory=true)` in order to store animation data compactly during a simulation run.
75102
After `simulate!(instantiatedModel, ...)`, the animation data of a `Model3D(..)` can be retrieved as dictionary via the new
76103
function `get_animationHistory(instantiatedModel, modelPathAsString)`
77104

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

80107

81108
### Version 0.10.2

0 commit comments

Comments
 (0)