-
Notifications
You must be signed in to change notification settings - Fork 8
Full Installation Guide for Julia, Modia3D, Modia
The following installation guidelines are for Julia v1.9.0 under Windows 10. If it is possible use a portable version. For Linux or Mac users the installation steps should be quite similar.
These installation guidelines are a full version, it includes Modia3D and Modia Packages. Modia3D uses the DLR Visualization Library for 3D simulation. Further, two plotting packages, Makie and PyPlot are supported.
Julia might fill up your user profile so be aware by installing Julia under Windows. We'd recommend you creating a new environment variable JULIA_DEPOT_PATH = <path-to-julia-home>/.julia
before installing Julia. How to set an environment variable under Windows 10 is explained here. A path should not contain a whitespace.
Please read the following guidelines carefully.
For further information about ModiaSim project visit https://github.com/ModiaSim .
You need to define where all Julia packages like Modia and Modia3D are stored.
- Create an environment variable called
JULIA_DEPOT_PATH
- Set
JULIA_DEPOT_PATH = <path-to-julia-home>/.julia
(e.g.<path-to-julia-home>/.julia = D:/home/.julia
)
- Set
- Download the latest stable version of Julia, based on the platform you are using, if available use a portable version from the Julia homepage https://julialang.org/downloads/
- Unzip Julia (portable) in your Julia installation directory
<path-to-julia-installation>
- E.g.
<path-to-julia-installation> = D:/software/julia-1.9.0
- E.g.
- Add the Julia installation directory to the
PATH
environment variablePATH = <path-to-julia-installation>\bin
- Test Julia
- Open a command window (cmd), write down
julia
- This will open the Julia command window. The Julia command line is called
REPL
- This will open the Julia command window. The Julia command line is called
- If Julia starts: Congratulations!! 🥇 👍
- Otherwise open
<path-to-julia-installation>/bin/julia.exe
, if this works go back to step 3
- Open a command window (cmd), write down
- Close Julia window, or type
exit()
Downloading, installing and testing packages take some time, so be patient and drink a cup of coffee.
-
Open a Julia
REPL
- Open a command window (cmd), write down
julia
. This opens a JuliaREPL
- Open a command window (cmd), write down
-
Adding some packages, typing the following into the
REPL
] add Revise
- Do you want to use Modia3D?
] add Modia3D, Modia
- Further packages might be needed (follow instructions of Julia
REPL
): - Do you want to develop your own package?
] dev "path-to-my-package"
- Update all installed packages.
] update
-
Configure Julia with a startup.jl file
- Create folder
config
under<path-to-julia-home>/.julia
- Open startup.jl template, adapt it to your needs and save it under
<path-to-julia-home>/.julia/config/startup.jl
- Note: After saving your startup.jl file you need to restart Julia.
- Create folder
-
Please read: Choose between several plot packages: one or more of the plotting packages should be installed.
-
Please, read: Choose a 3D renderer.
-
Test Modia3D and Modia packages
- Open a Julia
REPL
using Modia3D
include("$(Modia3D.path)/test/Tutorial/BouncingSphere.jl")
- Further tests are available under
include("$(Modia3D.path)/test/runtests.jl")
using Modia
include("$(Modia.path)/examples/FilterCircuit.jl")
exit()
- Open a Julia
-
Congratulations!! 🥇 👍
Modia offers an interface to several plot packages. For getting started it might be easier to start with one of the Makie packages.
Environment option | Modia package | Description |
---|---|---|
"GLMakie" | SignalTablesInterface_GLMakie | interactive plots in an OpenGL window |
"WGLMakie" | SignalTablesInterface_WGLMakie | interactive plots in a browser window |
"CairoMakie" | SignalTablesInterface_CairoMakie | static plots on file with publication quality |
"PyPlot" | SignalTablesInterface_PyPlot | plots with Matplotlib from Python |
"NoPlot" | all plot(...) calls are ignored |
|
"SilentNoPlot" | like "NoPlot" without messages |
Use a Makie package for plotting
Let's say you'd like to use "GLMakie"
, for the other Makie packages it works equivalent.
- Open a Julia
REPL
] add SignalTablesInterface_GLMakie
- Set:
ENV["SignalTablesPlotPackage"] = "GLMakie"
in your startup.jl file
Use PyPlot for plotting
It might be a bit tricky running PyPlot
the first time.
- Open a Julia
REPL
] add SignalTablesInterface_PyPlot
- There are two ways of using
PyPlot
:
-
a: Use the Python distribution delivered with Julia. Add the following environment variables to your startup.jl file.
ENV["PYTHON"] = ""
ENV["CONDA_JL_USE_MINIFORGE"] = "1"
ENV["SignalTablesPlotPackage"] = "PyPlot"
-
b: Install/use your own Anacondy Python distribution. Please, follow instructions from https://github.com/ModiaSim/Modia.jl/wiki/Installing-PyPlot-in-a-robust-way
- Check if Anaconda Python is already installed
-
Remark: Do not use the Anaconda installation from Visual Studio in
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64
-
Remark: Do not use the Anaconda installation from Visual Studio in
- Download the latest stable version of Anaconda Python, based on the platform you are using
- Set an environment variable or add it to the startup.jl file
ENV["PYTHON"] = "<path-to-python-installation>/python.exe"
ENV["SignalTablesPlotPackage"] = "PyPlot"
- If you'll encounter issues, please, follow instructions from https://github.com/ModiaSim/Modia.jl/wiki/Installing-PyPlot-in-a-robust-way
- If it's not working try
Pkg.add("PyCall")
,Pkg.build("PyCall")
andPkg.add("PyPlot")
several times, and also with a different order.
- If it's not working try
- Check if Anaconda Python is already installed
Nothing needs to be done for installation. Modia3D animation can be exported in threejs-json-format and then imported in the open source web app threejs.org and use all the features of threejs, for example to export in the widely used glb format (= the binary version of the glTF format) and use any glb-viewer (for example 3D-Viewer of Windows 10).
Modia3D uses the DLR Visualization Library for 3D simulations. Download and install the free DLR SimVis Community Edition, e.g. with https://visualization.ltx.de/ . If you don't use the DLR Visualization Library result animation is switched of.
- Set an environment variable or add it to your startup.jl file
ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"
- Make sure that the SimVis executable under this directory has execution rights. For example in Linux with command:
chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis
We recommend you using a portable VS Codium or VS Code version as editor for Julia. VS Codium is a clone of VS Code. It’s identical to VS Code with the single biggest difference that unlike VS Code, VS Codium doesn’t track your usage data.
For further information see https://vscodium.com/
- Download VS Codium (Portable) https://portapps.io/app/vscodium-portable/
- Install VS Codium/VS Code
For further information see https://www.julia-vscode.org/docs/dev/gettingstarted/#Installation-and-Configuration-1
- Start or open VS Codium
<path-to-VSCodium>\vscodium-portable.exe
- Select View and then click Extensions to open Extension View.
- Enter the term
julia
in the marketplace search box. Click the green Install button to download the extension.
NOTE: It is recommended that you restart VS Codium/VS Code after installation.
If you managed to start Julia from command window, which means you installed Julia into a standard location on Mac or Windows, or if the Julia binary is on your PATH
environment, the Julia VS Codium extension automatically finds your Julia installation. You do not need to configure the extension. Otherwise you have to configure your extension: see https://www.julia-vscode.org/docs/dev/gettingstarted/#Installation-and-Configuration-1
- Select File and then click Open Folder... and browse to folder
<path-to-julia-home>/.julia/packages/Modia3D
- Open
~/Modia3D/test/Tutorial/Pendulum1.jl
- Select View and then click Command Palette... and choose Julia: Execute File
- If more tabs are opened in your editor the actual file will be executed
- You could create a shortcut for that
- See also https://www.julia-vscode.org/docs/dev/userguide/runningcode/
VS Code, Jupyter, Juno, Pluto.jl, Vim, Emacs, SublimeText, NotePad++ (see listed editors: Julia Editors)
- VS Code (see the above installation guide)
- Jupyter (see https://github.com/JuliaLang/IJulia.jl)
- If not already done, install Anaconda Python
- Open a Julia
REPL
and write] add IJulia
using("IJulia")
-
notebook()
--> opens a Jupyter notebook
- Juno/Atom
- It is a handy editor, but there is no further development progress. Bug fixes are still done.
For further remarks or if you encounter problems, please feel free to contact Andrea Neumayr (andrea.neumayr[at]dlr.de).