Skip to content

Commit c684646

Browse files
committed
First public version
1 parent fe6ec78 commit c684646

File tree

161 files changed

+741910
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+741910
-23
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# exclude following files
2+
docs/build/
3+
docs/site/

.travis.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Documentation: http://docs.travis-ci.com/user/languages/julia/
2+
language: julia
3+
os:
4+
- linux
5+
- osx
6+
julia:
7+
- 0.6
8+
- nightly
9+
notifications:
10+
email: false
11+
git:
12+
depth: 99999999
13+
14+
## uncomment the following lines to allow failures on nightly julia
15+
## (tests will run but not make your overall status red)
16+
#matrix:
17+
# allow_failures:
18+
# - julia: nightly
19+
20+
## uncomment and modify the following lines to manually install system packages
21+
#addons:
22+
# apt: # apt-get for linux
23+
# packages:
24+
# - gfortran
25+
#before_script: # homebrew for mac
26+
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi
27+
28+
## uncomment the following lines to override the default test script
29+
#script:
30+
# - julia -e 'Pkg.clone(pwd()); Pkg.build("Modia3D"); Pkg.test("Modia3D"; coverage=true)'
31+
after_success:
32+
# push coverage results to Coveralls
33+
- julia -e 'cd(Pkg.dir("Modia3D")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
34+
# push coverage results to Codecov
35+
- julia -e 'cd(Pkg.dir("Modia3D")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

LICENSE.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
The Modia3D.jl package is licensed under the MIT "Expat" License:
2+
3+
> Copyright (c) 2016-2018: DLR Institute of System Dynamics and Control
4+
>
5+
>
6+
> Permission is hereby granted, free of charge, to any person obtaining a copy
7+
>
8+
> of this software and associated documentation files (the "Software"), to deal
9+
>
10+
> in the Software without restriction, including without limitation the rights
11+
>
12+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
>
14+
> copies of the Software, and to permit persons to whom the Software is
15+
>
16+
> furnished to do so, subject to the following conditions:
17+
>
18+
>
19+
>
20+
> The above copyright notice and this permission notice shall be included in all
21+
>
22+
> copies or substantial portions of the Software.
23+
>
24+
>
25+
>
26+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27+
>
28+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29+
>
30+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31+
>
32+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
>
34+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
>
36+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37+
>
38+
> SOFTWARE.
39+
>
40+
>

README.md

Lines changed: 133 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,133 @@
1-
# Modia3D.jl
2-
Modeling and Simulation of 3D systems
1+
# Modia3D
2+
3+
Modia3D is a Julia package to model fixed and moving objects in 3D (*e.g.* visual shapes, rigid bodies).
4+
These objects are driven kinematically by pre-defined time functions or are moving dynamically by
5+
solving Differential Algebraic Equations (DAEs)
6+
with a variable-step DAE solver. Collision handling with elastic response calculation is
7+
performed for objects that are defined with a contact material and (a) have a convex geometry,
8+
(b) can be approximated by a set of convex geometries, or (c) have a concave geometry
9+
that is (automatically) approximated by its convex hull.
10+
A more detailed overview of the available features is given in the
11+
[Modia3D documentation](https://ModiaSim.github.io/Modia3D.jl/latest).
12+
Papers about Modia3D:
13+
14+
- *[Collision Handling with Variable-Step Integrators](docs/resources/documentation/CollisionHandling_Neumayr_Otter_2017.pdf)* ([EOOLT 2017, December](http://www.eoolt.org/2017/))
15+
- *Component-Based 3D Modeling Combined with Equation-Based Modeling*, accepted for publication at the
16+
[American Modelica Conference 2018, October 9-10](https://www.modelica.org/events/modelica2018Americas/index_html)
17+
18+
Before releasing version 1.0, Modia3D shall be
19+
easily combinable with [Modia](https://github.com/ModiaSim/Modia.jl), for example to define a controlled
20+
electrical motor with Modia, and add 3D behavior/visualization with Modia3D.
21+
By this approach the best of both worlds can be combined:
22+
Special 3D algorithms (Modia3D) + power/flexibility of equation based modeling (Modia).
23+
24+
25+
## Installation
26+
27+
This package is not yet registered in `METADATA.jl`and need to be installed with `Pkg.clone`:
28+
29+
```
30+
julia> Pkg.clone("https://github.com/ModiaSim/ModiaMath.jl")
31+
julia> Pkg.clone("https://github.com/ModiaSim/Modia3D.jl")
32+
```
33+
34+
Modia3D performs simulation and plotting with ModiaMath. ModiaMath in turn
35+
uses `PyPlot` as basis for the plotting. Since installation of `PyPlot` is not
36+
robust with the automatic installation procedure of current Julia, it is recommended
37+
to first install `PyPlot` as described in the
38+
[installation procedure of ModiaMath](https://modiasim.github.io/ModiaMath.jl/latest/index.html#Installation-1).
39+
40+
Modia3D visualizes the movement of 3D objects with a renderer.
41+
Currently, the (free) community or the (commercial) professional version of the
42+
[DLR Visualization](http://www.systemcontrolinnovationlab.de/the-dlr-visualization-library/) library
43+
are supported. To install the free version for *Windows* perform the following steps
44+
(the free *Linux* version will become available in a few days):
45+
46+
1. Go to [https://visualization.ltx.de/](https://visualization.ltx.de/),
47+
provide your contact information and click on *Request download* for *Community Edition*.
48+
Afterwards, you get a link to download the library and you need to unzip the file.
49+
2. In your `HOME/.juliarc.jl` file, include the environment variable
50+
`ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"`.
51+
3. Start Julia and run one of the examples, for example
52+
`include("$(Modia3D.path)/examples/dynamics/Simulate_DoublePendulumWithDampers.jl")`
53+
54+
If Modia3D cannot use one of the renderers above, it will continue with renderer **NoRenderer**
55+
that is animation is switched off.
56+
57+
## Documentation
58+
59+
- [**LATEST**](https://ModiaSim.github.io/Modia3D.jl/latest) &mdash; *in-development version of the documentation.*
60+
61+
62+
## Use
63+
64+
### To define a model
65+
```julia
66+
import ModiaMath
67+
using Modia3D
68+
69+
material1 = Modia3D.Material(color="LightBlue", transparency=0.3);
70+
material2 = Modia3D.Material(color="Red");
71+
72+
@assembly Pendulum(;Lx = 1.0, Ly=0.2*Lx, Lz=0.2*Lx) begin
73+
world = Object3D(Modia3D.CoordinateSystem(0.5*Lx))
74+
beam_frame0 = Object3D(Modia3D.Solid(Modia3D.SolidBeam(Lx,Ly,Lz), "Aluminium", material1))
75+
beam_frame1 = Object3D(beam_frame0; r=[-Lx/2, 0.0, 0.0])
76+
cylinder = Object3D(beam_frame1,Modia3D.Cylinder(Ly/2,1.2*Ly; material=material2))
77+
revolute = Modia3D.Revolute(world, beam_frame1)
78+
end;
79+
simulationModel = Modia3D.SimulationModel(Pendulum(Lx=0.8),stopTime=5.0);
80+
```
81+
82+
83+
### To simulate a model, animate and plot results
84+
85+
```julia
86+
result = ModiaMath.simulate!(simulationModel);
87+
ModiaMath.plot(result, ["revolute.phi", "revolute.w"]);
88+
```
89+
90+
![PendulumPlot](docs/resources/images/pendulum_readme.png)
91+
92+
93+
### To run examples
94+
```julia
95+
include("$(Modia3D.path)/examples/dynamics/Simulate_DoublePendulumWithDampers.jl")
96+
include("$(Modia3D.path)/examples/dynamics/Simulate_FallingBall4.jl")
97+
include("$(Modia3D.path)/examples/kinematics/Move_FourBar.jl")
98+
include("$(Modia3D.path)/examples/visual/Move_AllVisualObjects.jl")
99+
```
100+
101+
### To run tests
102+
```julia
103+
include("$(Modia3D.path)/test/runtests.jl")
104+
```
105+
106+
## Status
107+
108+
The package is tested against Julia `0.6` on Windows 7.
109+
The actual version number is 0.2.0-beta.1 and functionality and robustness is planned to be improved for the 1.0 version.
110+
111+
Especially note, the collision handling has still bugs and the elastic response calculation is not
112+
yet robust. This needs to be improved.
113+
114+
Furthermore, kinematic loops are currently only supported for 2D loops and if they are driven kinematically.
115+
The technique to handle kinematic loops for dynamic simulations is demonstrated in the example
116+
`include("$(ModiaMath.path)/examples/withoutMacros_withoutVariables/Simulate_PendulumDAE.jl")`
117+
and is described in the paper *[Transformation of Differential Algebraic Array Equations to
118+
Index One Form](http://www.ep.liu.se/ecp/132/064/ecp17132565.pdf)*.
119+
120+
121+
## Issues and Contributions
122+
123+
Contributions are welcome, as are feature requests and suggestions.
124+
Please open an [issue](https://github.com/Modia/Modia3D.jl/issues) in this case and also if you encounter problems.
125+
126+
127+
## Main Developers and License
128+
[Andrea Neumayr](mailto:[email protected]) and [Martin Otter](https://rmc.dlr.de/sr/de/staff/martin.otter/)
129+
130+
[DLR - Institute of System Dynamics and Control](https://www.dlr.de/sr/en)
131+
132+
License: [MIT (expat)](LICENSE.md)
133+

REQUIRE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
julia 0.6
2+
ModiaMath
3+
StaticArrays
4+
DataFrames
5+
DataStructures
6+
Unitful

appveyor.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
environment:
2+
matrix:
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
5+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
6+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
7+
8+
## uncomment the following lines to allow failures on nightly julia
9+
## (tests will run but not make your overall status red)
10+
#matrix:
11+
# allow_failures:
12+
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
13+
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
14+
15+
branches:
16+
only:
17+
- master
18+
- /release-.*/
19+
20+
notifications:
21+
- provider: Email
22+
on_build_success: false
23+
on_build_failure: false
24+
on_build_status_changed: false
25+
26+
install:
27+
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
28+
# If there's a newer build queued for the same PR, cancel this one
29+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
30+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
31+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
32+
throw "There are newer queued builds for this pull request, failing early." }
33+
# Download most recent Julia Windows binary
34+
- ps: (new-object net.webclient).DownloadFile(
35+
$env:JULIA_URL,
36+
"C:\projects\julia-binary.exe")
37+
# Run installer silently, output to C:\projects\julia
38+
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
39+
40+
build_script:
41+
# Need to convert from shallow to complete for Pkg.clone to work
42+
- IF EXIST .git\shallow (git fetch --unshallow)
43+
- C:\projects\julia\bin\julia -e "versioninfo();
44+
Pkg.clone(pwd(), \"Modia3D\"); Pkg.build(\"Modia3D\")"
45+
46+
test_script:
47+
- C:\projects\julia\bin\julia -e "Pkg.test(\"Modia3D\")"

docs/make.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Documenter, Modia3D
2+
3+
makedocs(
4+
modules = [Modia3D],
5+
format = :html,
6+
sitename = "Modia3D",
7+
authors = "Andrea Neumayr, Martin Otter (DLR-SR)",
8+
pages = [
9+
"Home" => "index.md",
10+
"Manual" => [
11+
"man/GettingStarted.md"
12+
"man/Examples.md"
13+
"man/Plans.md"
14+
],
15+
"Library" => [
16+
"lib/Composition.md",
17+
"lib/Graphics.md",
18+
"lib/Solids.md",
19+
"lib/ForceElements.md",
20+
"lib/Basics.md"
21+
]
22+
]
23+
)
24+
Binary file not shown.

0 commit comments

Comments
 (0)