|
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) — *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 | + |
| 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 | + |
0 commit comments