|
1 | 1 | # Modia Documentation |
2 | 2 |
|
3 | | -[Modia](https://github.com/ModiaSim/Modia.jl) is a Julia package for modeling and simulation of multidomain engineering systems described by differential equations, algebraic equations, and (space-discretized) partial differential equations. It shares many powerful features of the [Modelica language](https://www.modelica.org/modelicalanguage), together with features not available in Modelica. |
| 3 | +[Modia](https://github.com/ModiaSim/Modia.jl) is a minimalistic environment in form of a Julia package to model and simulate physical systems (electrical, mechanical, thermo-dynamical, etc.) described by differential and algebraic equations. A user defines a model on a high level with model components (like a mechanical body, an electrical resistance, or a pipe) that are physically connected together. A model component is constructed by "expression = expression" equations. The defined model is symbolically processed (for example, equations might be analytically differentiated) with algorithms from package [ModiaBase.jl](https://github.com/ModiaSim/ModiaBase.jl). From the transformed model a Julia function is generated that is used to simulate the model with integrators from [DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl). |
| 4 | +The basic type of the floating point variables is usually `Float64`, but can be set to any |
| 5 | +type `FloatType<:AbstractFloat` via `@instantiateModel(..., FloatType = xxx)`, for example |
| 6 | +it can be set to `Float32, DoubleFloat, Measurement{Float64}, StaticParticles{Float64,100}`. |
4 | 7 |
|
5 | | -A user defines a model on a high level with model components (like an electrical resistance, a rotational inertia, a rod with heat transfer, a PI controller etc.) that are physically connected together. A model component is constructed by "expression = expression" equations. The defined model is symbolically transformed to ODE form dx/dt = f(x,t). For example, equations might be analytically differentiated, ODE states selected, linear equation systems numerically solved when evaluating the transformed model. From the transformed model a Julia function is generated that is used to simulate the model with integrators from [DifferentialEquations](https://github.com/SciML/DifferentialEquations.jl). Simulation results can be plotted with [ModiaPlot](https://github.com/ModiaSim/ModiaPlot.jl), that provides a convenient interface to [GLMakie](https://github.com/JuliaPlots/GLMakie.jl) line plots. |
6 | | - |
7 | | -Other packages from the Julia eco-systems that are specially supported: |
8 | | - |
9 | | -- [Unitful](https://github.com/PainterQubits/Unitful.jl) to define and process physical units. |
10 | | -- [Measurements](https://github.com/JuliaPhysics/Measurements.jl) to perform simulations with uncertain parameters and initial values with linear propagation theory. |
11 | | -- [MonteCarloMeasurements](https://github.com/baggepinnen/MonteCarloMeasurements.jl) to perform simulations with uncertain parameters and initial values with particle theory. |
| 8 | +## Installation |
12 | 9 |
|
| 10 | +The package is registered and is installed with (Julia >= 1.5 is required): |
13 | 11 |
|
14 | | -## Installation |
| 12 | +```julia |
| 13 | +julia> ]add Modia |
| 14 | +``` |
15 | 15 |
|
16 | | -Modia and ModiaPlot are registered and are installed with (Julia >= 1.5 is required): |
| 16 | +Furthermore, one or more of the following packages should be installed in order |
| 17 | +to be able to generate plots: |
17 | 18 |
|
18 | 19 | ```julia |
19 | | -julia> ]add Modia, ModiaPlot |
| 20 | +julia> ]add ModiaPlot_PyPlot # if plotting with PyPlot desired |
| 21 | + add ModiaPlot_GLMakie # if plotting with GLMakie desired |
| 22 | + add ModiaPlot_WGLMakie # if plotting with WGLMakie desired |
| 23 | + add ModiaPlot_CairoMakie # if plotting with CairoMakie desired |
20 | 24 | ``` |
21 | 25 |
|
22 | 26 | It is recommended to also add the following packages, in order that all tests and examples can be executed in your standard environment: |
23 | 27 |
|
24 | 28 | ```julia |
25 | | -julia> ]add Measurements |
26 | | - add MonteCarloMeasurements |
27 | | - add Distributions |
28 | | - add Interpolations |
| 29 | +julia> ]add Unitful, DifferentialEquations, Measurements |
| 30 | + add MonteCarloMeasurements, Distributions |
29 | 31 | ``` |
30 | 32 |
|
31 | 33 | ## Release Notes |
32 | 34 |
|
33 | | -### Version 0.4.0 |
34 | 35 |
|
35 | | -- Initial version of new Modia design. |
| 36 | +### Version 0.8.0 |
| 37 | + |
| 38 | +- Improved scalability by using OrderedDicts instead of named tuples for models, variables and parameter modifications. |
| 39 | +- Speed improvements for structural and symbolic algorithms. |
| 40 | +- Added support for state events, time events and synchronous operators. |
| 41 | +- Added support for mixed linear equation systems having Real and Boolean unknowns. |
| 42 | +- Added support for user-defined components defined by structs and functions |
| 43 | + (multibody modeling with Modia3D is based on this feature). |
| 44 | + This makes it possible to utilize algorithms specialized for a component. |
| 45 | +- Added support for numerical and analytic linearization. |
| 46 | +- Added support for propagation of parameters (e.g. deep in a model, the value of a parameter can be defined as a function of some top level parameter and this parameter is changed before simulation starts). |
| 47 | +- New small model libraries Translational.jl and PathPlanning.jl added. |
| 48 | +- Result storage changed: `sol = simulate!(...)` calls internally `sol = solve(..)` from DifferentialEquations.jl. `sol` contains time and the states at the communication time grid and |
| 49 | + at events. This is now kept in simulate(..), so the return value of simulate!(..) can be exactly used as if `solve(..)` would have been used directly. |
| 50 | +- The plot(..) command now supports the following underlying plot packages: |
| 51 | + [PyPlot](https://github.com/JuliaPy/PyPlot.jl), |
| 52 | + [GLMakie](https://github.com/JuliaPlots/GLMakie.jl), |
| 53 | + [WGLMakie](https://github.com/JuliaPlots/WGLMakie.jl), and |
| 54 | + [CairoMakie](https://github.com/JuliaPlots/CairoMakie.jl). |
| 55 | + It is also possible to select `NoPlot`, to ignore `plot(..)` calls |
| 56 | + or `SilenNoPlot` to ignore `plot(..)` calls silently. The latter is useful for `runtests.jl`. |
| 57 | + Note, often [PyPlot](https://github.com/JuliaPy/PyPlot.jl) is the best choice. |
| 58 | + |
| 59 | +Changes that are **not backwards compatible** to version 0.7.x: |
| 60 | + |
| 61 | +- Models are OrderedDicts and no longer NamedTuples. |
| 62 | + |
| 63 | +- simulate!(..): |
| 64 | + - If FloatType=Float64 and no algorithm is defined, then Sundials.CVODE\_BDF() is used |
| 65 | + instead of the default algorithm of DifferentialEquations as in 0.7. The reason is that Modia models |
| 66 | + are usually large and expensive to evaluate and have often stiff parts, so that multi-step |
| 67 | + methods are often by far the best choice. CVODE_BDF() seems to be a good choice in many applications |
| 68 | + (another algorithm should be used, if there are many events, highly oscillatory vibrations, or if all states are non-stiff). |
| 69 | + - The default value of `stopTime` is equal to `startTime` (which has a default value of 0.0 s), and is no longer 1.0 s. |
| 70 | + |
| 71 | +- Plotting is defined slightly differently (`@useModiaPlot`, instead of `using ModiaPlot`). |
| 72 | + |
| 73 | + |
| 74 | +### Version 0.7.3 |
| 75 | + |
| 76 | +- Evaluation and propagation of parameter expressions (also in simulate!(..., merge=Map(...))). |
| 77 | + Propagation of start/init values of states is not yet supported. |
| 78 | + |
| 79 | +- State events supported. |
| 80 | + |
| 81 | + |
| 82 | +### Version 0.7.2 |
| 83 | + |
| 84 | +- Missing dependency of Test package added. |
| 85 | + |
| 86 | +### Version 0.7.1 |
| 87 | + |
| 88 | +- Variable constructor `Var(...)` introduced. For example: |
| 89 | + `v = input | Var(init = 1.2u"m")`. |
| 90 | + For details see section [A.1 Var constructor](@ref). |
| 91 | + |
| 92 | +- Functions are called in the scope where macro [`@instantiateModel`](@ref) is called. |
| 93 | + |
| 94 | +- New arguments of function [`simulate!`](@ref): |
| 95 | + - Parameter and init/start values can be changed with argument `merge`. |
| 96 | + - A simulation can be checked with argument `requiredFinalStates`. |
| 97 | + - Argument `logParameters` lists the parameter and init/start values used for the simulation. |
| 98 | + - Argument `logStates` lists the states, init, and nominal values used for the simulation. |
| 99 | + |
| 100 | +- `end` in array ranges is supported, for example `v[2:end]`. |
| 101 | + |
| 102 | +- New (small) model library `Modia/models/HeatTransfer.jl`. |
| 103 | + |
| 104 | +- Modia Tutorial improved. |
| 105 | + |
| 106 | +- [Functions](@ref) docu improved. |
| 107 | + |
| 108 | +### Version 0.7.0 |
| 109 | + |
| 110 | +- Initial version, based on code developed for Modia 0.6 and ModiaMath 0.6. |
36 | 111 |
|
37 | 112 |
|
38 | 113 | ## Main developers |
|
0 commit comments