Skip to content

Commit

Permalink
Merge pull request #112 from ModiaSim/mo_startup_up
Browse files Browse the repository at this point in the history
create_Modia3D_sysimage.jl added (to generate a Modia3D sysimage)
  • Loading branch information
MartinOtter authored Apr 18, 2022
2 parents 31b6081 + 3078732 commit 6408163
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
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:andrea.neumayr@dlr.de),
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

0 comments on commit 6408163

Please sign in to comment.