Skip to content

Commit fbd9a9d

Browse files
authored
Merge pull request #101 from ModiaSim/mo_adapt_to_Modia_0.8
Adapted to Modia 0.8 (= nonbackwards compatible change).
2 parents bf4b809 + a274a13 commit fbd9a9d

Some content is hidden

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

45 files changed

+301
-233
lines changed

Manifest.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -554,17 +554,17 @@ version = "1.0.2"
554554
[[deps.Mmap]]
555555
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
556556

557+
[[deps.Modia]]
558+
deps = ["DataFrames", "DifferentialEquations", "FiniteDiff", "ForwardDiff", "InteractiveUtils", "JSON", "LinearAlgebra", "Measurements", "ModiaBase", "ModiaResult", "MonteCarloMeasurements", "OrderedCollections", "Printf", "RecursiveFactorization", "Reexport", "StaticArrays", "Sundials", "Test", "TimerOutputs", "Unitful"]
559+
git-tree-sha1 = "b5b28c076c5b743c2233e36322582d84c3629e24"
560+
uuid = "cb905087-75eb-5f27-8515-1ce0ec8e839e"
561+
version = "0.8.1"
562+
557563
[[deps.ModiaBase]]
558-
deps = ["DataFrames", "DiffRules", "LinearAlgebra", "Measurements", "MonteCarloMeasurements", "OrderedCollections", "RecursiveFactorization", "StaticArrays", "TimerOutputs", "Unitful"]
559-
git-tree-sha1 = "e32f09c491f569f254d3c7776326539f4b3c5f24"
564+
deps = ["DataFrames", "DiffRules", "Measurements", "MonteCarloMeasurements", "OrderedCollections", "StaticArrays", "Unitful"]
565+
git-tree-sha1 = "4562d56ff6b2fe5b78ef0995e478e8b734e24f2a"
560566
uuid = "ec7bf1ca-419d-4510-bbab-199861c55244"
561-
version = "0.9.2"
562-
563-
[[deps.ModiaLang]]
564-
deps = ["DataFrames", "DifferentialEquations", "FiniteDiff", "ForwardDiff", "InteractiveUtils", "JSON", "Measurements", "ModiaBase", "ModiaResult", "MonteCarloMeasurements", "OrderedCollections", "Printf", "Reexport", "StaticArrays", "Sundials", "Test", "TimerOutputs", "Unitful"]
565-
git-tree-sha1 = "2557b26a61b61ebcd34cbe0c36b160b707bbf5df"
566-
uuid = "34b37210-eaa3-4b48-8781-0b87bf559981"
567-
version = "0.11.3"
567+
version = "0.10.0"
568568

569569
[[deps.ModiaResult]]
570570
deps = ["DataFrames", "Measurements", "MonteCarloMeasurements", "OrderedCollections", "Pkg", "Tables", "Unitful"]
@@ -574,9 +574,9 @@ version = "0.4.1"
574574

575575
[[deps.MonteCarloMeasurements]]
576576
deps = ["Distributed", "Distributions", "LinearAlgebra", "MacroTools", "Random", "RecipesBase", "Requires", "SLEEFPirates", "StaticArrays", "Statistics", "StatsBase", "Test"]
577-
git-tree-sha1 = "bce0a32d6c64165388eec2573b68000ed06f39c1"
577+
git-tree-sha1 = "03619e255664666b352a5e5f6b45e8b00d439870"
578578
uuid = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
579-
version = "1.0.7"
579+
version = "1.0.8"
580580

581581
[[deps.MozillaCACerts_jll]]
582582
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
@@ -640,9 +640,9 @@ version = "0.5.5+0"
640640

641641
[[deps.Optim]]
642642
deps = ["Compat", "FillArrays", "ForwardDiff", "LineSearches", "LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "PositiveFactorizations", "Printf", "SparseArrays", "StatsBase"]
643-
git-tree-sha1 = "045d10789f5daff18deb454d5923c6996017c2f3"
643+
git-tree-sha1 = "bc0a748740e8bc5eeb9ea6031e6f050de1fc0ba2"
644644
uuid = "429524aa-4258-5aef-a3af-852621145aeb"
645-
version = "1.6.1"
645+
version = "1.6.2"
646646

647647
[[deps.OrderedCollections]]
648648
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Modia3D"
22
uuid = "07f2c1e0-90b0-56cf-bda7-b44b56e34eed"
33
authors = ["Andrea Neumayr <[email protected]>", "Martin Otter <[email protected]>", "Gerhard Hippmann <[email protected]>"]
4-
version = "0.9.1"
4+
version = "0.10.0"
55

66
[deps]
77
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
@@ -13,7 +13,7 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1313
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1414
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
1515
MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118"
16-
ModiaLang = "34b37210-eaa3-4b48-8781-0b87bf559981"
16+
Modia = "cb905087-75eb-5f27-8515-1ce0ec8e839e"
1717
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
1818
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
1919
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
@@ -32,7 +32,7 @@ FileIO = "1"
3232
JSON = "0.21"
3333
Measurements = "2"
3434
MeshIO = "0.4.10"
35-
ModiaLang = "0.11.3"
35+
Modia = "0.8.1"
3636
MonteCarloMeasurements = "1"
3737
OrderedCollections = "1"
3838
Reexport = "1.0"

README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Modia3D
1+
# Modia3D.jl
22

33
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ModiaSim.github.io/Modia3D.jl/stable)
44
[![The MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/ModiaSim/Modia3D.jl/blob/master/LICENSE.md)
55

6-
[Modia3D](https://github.com/ModiaSim/Modia3D.jl) is a Julia package that integrates a multibody program and 3D shapes for visualization and collision handling into the [Modia Modeling Language](https://github.com/ModiaSim/ModiaLang.jl). It is then, for example, possible to model the 3D mechanical part of a robot with Modia3D and the electrical motors and gearboxes that are driving the joints with the Modia language. Collision handling with elastic response calculation is performed for shapes that are defined with a contact material and have a convex geometry or are approximated by the convex hull of a concave geometry. For more details, see the [Modia3D Tutorial](https://modiasim.github.io/Modia3D.jl/stable/tutorial/Tutorial.html).
6+
[Modia3D](https://github.com/ModiaSim/Modia3D.jl) is a Julia package that adds a multibody program and 3D shapes for visualization and collision handling to the [Modia Modeling Language](https://github.com/ModiaSim/Modia.jl). It is then, for example, possible to model the 3D mechanical part of a robot with Modia3D and the electrical motors and gearboxes that are driving the joints with the Modia language. Collision handling with elastic response calculation is performed for shapes that are defined with a contact material and have a convex geometry or are approximated by the convex hull of a concave geometry. For more details, see the [Modia3D Tutorial](https://modiasim.github.io/Modia3D.jl/stable/tutorial/Tutorial.html).
77

88
Modia3D supports currently tree-structured multibody systems, but does not (yet) support kinematic loops.
99

@@ -16,22 +16,43 @@ Example videos:
1616

1717
## Installation
1818

19-
Modia3D is included in [Modia](https://github.com/ModiaSim/Modia.jl) and is available, when Modia was installed. Please, follow the [extensive installation guide](https://github.com/ModiaSim/Modia3D.jl/wiki/Full-Installation-Guide-for-Julia,-Modia3D,-Modia) or the [lightweight installation guide](https://github.com/ModiaSim/Modia3D.jl/wiki/Lightweight-Installation-Guide:-Julia-Modia3D) for Modia3D.
20-
21-
A standalone Modia3D version is installed with
19+
Modia3D requires Julia 1.7 or later and is installed with
2220

2321
```julia
24-
julia> ]add ModiaLang, Modia3D
22+
julia> ]add Modia3D
2523
```
2624

27-
Modia3D animation can be exported in [three.js JSON Object Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4) and then imported in the open source web app [three.js editor](https://threejs.org/editor/) and use all the features of three.js, for example to export in the widely used glb format (the binary version of the [glTF](https://www.khronos.org/gltf/) format) and use any glb viewer (for example 3D-Viewer of Windows 10).
28-
29-
Additionally, Modia3D uses the (free) community or the (commercial) professional version of the [DLR Visualization Library](https://visualization.ltx.de/) for 3D simulations. It provides online animation (during simulation) and the generation of mpg4-videos. If you don't use the DLR Visualization Library result animation is switched of.
30-
Download and install the free DLR SimVis Community Edition, e.g. with [https://visualization.ltx.de/](https://visualization.ltx.de/) .
31-
32-
* Set an environment variable or add it to the [startup.jl file](https://github.com/ModiaSim/Modia3D.jl/wiki/Template-for-startup.jl). Please, read also the [installation guide](https://github.com/ModiaSim/Modia3D.jl/wiki/Full-Installation-Guide-for-Julia,-Modia3D,-Modia).
33-
* `ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"`
34-
* 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`
25+
It is advised to also install Modia and at least one Modia plot package (for details see [Installation of Modia](https://modiasim.github.io/Modia.jl/stable/#Installation)).
26+
27+
Note, Modia3D reexports the following definitions
28+
29+
- `using Modia`
30+
- `using Unitful`
31+
- `using DifferentialEquations`
32+
- and exports functions `CVODE_BDF` and `IDA` of [Sundials.jl](https://github.com/SciML/Sundials.jl).
33+
34+
As a result, it is usually sufficient to have `using Modia3D` in a model to utilize the relevant
35+
functionalities of these packages.
36+
37+
Modia3D has various *3D animation features*:
38+
39+
- With `world = Object3D(feature=Scene(animationFile="filename.json"))` the animation produced during a simulation run
40+
is exported in [three.js JSON Object Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
41+
The generated file can be imported into the open source web app [three.js editor](https://threejs.org/editor/) and
42+
use all the features of three.js, for example to export in the widely used glb format (the binary version of the [glTF](https://www.khronos.org/gltf/) format)
43+
and use any glb viewer (for example 3D-Viewer of Windows).
44+
45+
- With the default option `world = Object3D(feature=Scene(enableVisualization=true))` the
46+
[DLR Visualization Library](https://www.systemcontrolinnovationlab.de/the-dlr-visualization-library/)
47+
(see the many examples from various research and industrial projects) is used, if installed, for
48+
online animation (during simulation), replays (after simulation), and the generation of mpg4-videos.
49+
This library is available as *(free) Community Edition* and as *(commercial) Professional Edition*
50+
([Web page to request download of DLR Visualization Library](https://visualization.ltx.de/)).
51+
After download, make the library available in the following way:
52+
- Set Julia environment variable `ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"`
53+
or add it to the [Julia startup.jl file](https://github.com/ModiaSim/Modia3D.jl/wiki/Template-for-startup.jl).
54+
*Make sure that the SimVis executable under this directory has execution rights.*
55+
For example in Linux with command: `chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis`
3556

3657

3758
## Main Developers and License

docs/src/index.md

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Modia3D Documentation
22

3-
[Modia3D](https://github.com/ModiaSim/Modia3D.jl) is a Julia package that integrates a multibody program and 3D shapes for visualization and collision handling into the [Modia Modeling Language](https://github.com/ModiaSim/ModiaLang.jl). It is then, for example, possible to model the 3D mechanical part of a robot with Modia3D and the electrical motors and gearboxes that are driving the joints with the Modia language. Collision handling with elastic response calculation is performed for shapes that are defined with a contact material and have a convex geometry or are approximated by the convex hull of a concave geometry. For more details, see the [Modia3D Tutorial](@ref).
3+
[Modia3D](https://github.com/ModiaSim/Modia3D.jl) is a Julia package that adds a multibody program and 3D shapes for visualization and collision handling to the [Modia Modeling Language](https://github.com/ModiaSim/Modia.jl). It is then, for example, possible to model the 3D mechanical part of a robot with Modia3D and the electrical motors and gearboxes that are driving the joints with the Modia language. Collision handling with elastic response calculation is performed for shapes that are defined with a contact material and have a convex geometry or are approximated by the convex hull of a concave geometry. For more details, see the [Modia3D Tutorial](https://modiasim.github.io/Modia3D.jl/stable/tutorial/Tutorial.html).
44

5-
The multibody program supports currently tree-structured multibody systems, but does not (yet) support kinematic loops.
5+
Modia3D supports currently tree-structured multibody systems, but does not (yet) support kinematic loops.
66

77
Example videos:
88

@@ -13,22 +13,43 @@ Example videos:
1313

1414
## Installation
1515

16-
Modia3D is included in [Modia](https://github.com/ModiaSim/Modia.jl) and is available, when Modia was installed. Please, follow the [extensive installation guide](https://github.com/ModiaSim/Modia3D.jl/wiki/Full-Installation-Guide-for-Julia,-Modia3D,-Modia) or the [lightweight installation guide](https://github.com/ModiaSim/Modia3D.jl/wiki/Lightweight-Installation-Guide:-Julia-Modia3D) for Modia3D.
17-
18-
A standalone Modia3D version is installed with
16+
Modia3D requires Julia 1.7 or later and is installed with
1917

2018
```julia
21-
julia> ]add ModiaLang, Modia3D
19+
julia> ]add Modia3D
2220
```
2321

24-
Modia3D animation can be exported in threejs-json-format and then imported in the open source web app [threejs.org](https://threejs.org/editor/) and use all the features of threejs, for example to export in the widely used glb format (= the binary version of the [glTF](https://www.khronos.org/gltf/) format) and use any glb-viewer (for example 3D-Viewer of Windows 10).
22+
It is advised to also install Modia and at least one Modia plot package (for details see [Installation of Modia](https://modiasim.github.io/Modia.jl/stable/#Installation)).
23+
24+
Note, Modia3D reexports the following definitions
25+
26+
- `using Modia`
27+
- `using Unitful`
28+
- `using DifferentialEquations`
29+
- and exports functions `CVODE_BDF` and `IDA` of [Sundials.jl](https://github.com/SciML/Sundials.jl).
30+
31+
As a result, it is usually sufficient to have `using Modia3D` in a model to utilize the relevant
32+
functionalities of these packages.
33+
34+
Modia3D has various *3D animation features*:
2535

26-
Additionally, Modia3D uses the (free) community or the (commercial) professional version of the [DLR Visualization Library](https://visualization.ltx.de/) for 3D simulations. It provides online animation (during simulation) and the generation of mpg4-videos. If you don't use the DLR Visualization Library result animation is switched of.
27-
Download and install the free DLR SimVis Community Edition, e.g. with [https://visualization.ltx.de/](https://visualization.ltx.de/) .
36+
- With `world = Object3D(feature=Scene(animationFile="filename.json"))` the animation produced during a simulation run
37+
is exported in [three.js JSON Object Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
38+
The generated file can be imported into the open source web app [three.js editor](https://threejs.org/editor/) and
39+
use all the features of three.js, for example to export in the widely used glb format (the binary version of the [glTF](https://www.khronos.org/gltf/) format)
40+
and use any glb viewer (for example 3D-Viewer of Windows).
2841

29-
* Set an environment variable or add it to the [startup.jl file](https://github.com/ModiaSim/Modia3D.jl/wiki/Template-for-startup.jl). Please, read also the [installation guide](https://github.com/ModiaSim/Modia3D.jl/wiki/Full-Installation-Guide-for-Julia,-Modia3D,-Modia).
30-
* `ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"`
31-
* 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`
42+
- With the default option `world = Object3D(feature=Scene(enableVisualization=true))` the
43+
[DLR Visualization Library](https://www.systemcontrolinnovationlab.de/the-dlr-visualization-library/)
44+
(see the many examples from various research and industrial projects) is used, if installed, for
45+
online animation (during simulation), replays (after simulation), and the generation of mpg4-videos.
46+
This library is available as *(free) Community Edition* and as *(commercial) Professional Edition*
47+
([Web page to request download of DLR Visualization Library](https://visualization.ltx.de/)).
48+
After download, make the library available in the following way:
49+
- Set Julia environment variable `ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"`
50+
or add it to the [Julia startup.jl file](https://github.com/ModiaSim/Modia3D.jl/wiki/Template-for-startup.jl).
51+
*Make sure that the SimVis executable under this directory has execution rights.*
52+
For example in Linux with command: `chmod ug+x <path-to-library>/Visualization/Extras/SimVis/linux/SimVis`
3253

3354

3455
## Publications
@@ -48,6 +69,28 @@ Download and install the free DLR SimVis Community Edition, e.g. with [https://v
4869

4970
## Release Notes
5071

72+
### Version 0.10.0
73+
74+
**Non-backwards compatible changes**:
75+
76+
The Modia packages are slightly restructured to allow more efficient operations.
77+
Previously, Modia was planned to include all the functionality with all model libraries.
78+
This is now changed and Modia includes now equation-oriented modeling and basic model libraries.
79+
Further model libraries, such as Modia3D (and other model libraries in the future) must be
80+
explicitly imported and are no longer automatically imported by Modia.
81+
To simplify the structuring, ModiaLang is merged into Modia
82+
and some functionality for the code generation is moved from ModiaBase to Modia.
83+
Overall, the benefit is that loading and compilation times are reduced, if Modia3D is not needed.
84+
Furthermore, the generated code contains only references to Modia functionality and no longer to ModiaBase.
85+
The effect on Modia3D is:
86+
87+
- Modia3D is removed from Modia (so when a model is using Modia3D, the package must be explicitly imported
88+
and is no longer automatically imported from Modia).
89+
90+
- In user models, all references to ModiaBase and to ModiaLang should be replaced by Modia
91+
(otherwise, it is highly likely that the model does not longer compile and/or simulate).
92+
93+
5194
### Version 0.9.1
5295

5396
- Require ModiaLang 0.11.3 (avoids unnecessary double instantiation of Model3D models).
@@ -56,7 +99,7 @@ Download and install the free DLR SimVis Community Edition, e.g. with [https://v
5699

57100
### Version 0.9.0
58101

59-
Non-backwards compatible changes
102+
**Non-backwards compatible changes**:
60103

61104
- Operator `buildModia3D(..)` is removed. Instead, the new constructor `Model3D(..)` must be used at the top level of a
62105
Modia3D definition. It is now possible to define several, independent multibody systems

docs/src/internal/ContactForceLaw.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,25 @@ The default $r_{contact}$ values for each shape are:
186186
|[Beam](@ref) | min(length, width, thickness)/2 | true |
187187
|[FileMesh](@ref) | shortestEdge/2 | false |
188188

189-
For flat shapes, [Box](@ref) and [Beam](@ref), no $r_{contact}$ is taken. For Herz' pressure it is needed only if two flat shapes are colliding ($r_i$ is the contact sphere radius $r_{contact}$ of shape $i$):).
189+
For flat shapes, [Box](@ref) and [Beam](@ref), $r_{contact}$ is only used,
190+
if two flat shapes are in contact with each other ($r_i$ is the contact sphere radius $r_{contact}$ of shape $i$):
190191

192+
| isFlat | isFlat | $\mu_{r,geo}$ |
193+
|:-------|:-----------------|:-----------------------------|
194+
|false | false | $\dfrac{r_1 r_2}{r_1 + r_2}$ |
195+
|false | true | $r_1$ |
196+
|true | false | $r_2$ |
197+
|true | true | $\dfrac{r_1 r_2}{r_1 + r_2}$ |
191198

192-
| isFlat | isFlat | $\mu_{r,geo}$ |
193-
|:-------|:-----------------|:------------------------|
194-
|false | false | $\frac{r1 r2}{r1 + r2}$ |
195-
|false | true | $r1$ |
196-
|true | false | $r2$ |
197-
|true | true | $\frac{r1 r2}{r1 + r2}$ |
198-
199-
200-
$n_{geo} = 1.5$
201-
$c_{geo} = \frac{4}{3} \sqrt(\mu_{r,geo})$
199+
The factors $n_{geo}, c_{geo}$ in the definition of $f_n$ are computed with the
200+
equations for Hertz pressure:
202201

202+
```math
203+
\begin{align}
204+
n_{geo} &= 1.5 \\
205+
c_{geo} &= \dfrac{4}{3} \sqrt{\mu_{r,geo}}
206+
\end{align}
207+
```
203208

204209

205210
## Regularized unit vectors

src/Composition/_module.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ import Modia3D.Frames
8989
import Modia3D.Shapes
9090
import JSON
9191
import Printf
92-
import ModiaLang
93-
import ModiaLang: ModiaBase
92+
import Modia
9493
import TimerOutputs
9594
import MonteCarloMeasurements
9695

0 commit comments

Comments
 (0)