Skip to content

v0.9.0

Compare
Choose a tag to compare
@MartinOtter MartinOtter released this 05 Jul 17:59
· 70 commits to main since this release
958fad1

Modia 0.9.0

Before using this new Modia version, it is probably best to first remove all "old" Modia related packages from your current environment and then add the new packages:

]
remove Modia, Modia3D, ModiaResult, ModiaPlot_PyPlot, ModiaPlot_GLMakie
add Modia, Modia3D, SignalTables, SignalTablesInterface_PyPlot, SignalTablesInterface_GLMakie

Diff since v0.8.4

  • This version is slightly non-backwards compatible to 0.8.x. Most important, the result handling has been changed. Especially, package ModiaResult.jl has been replaced by package SignalTables.jl. Also the plot package interfaces ModiaPlot_PyPlot, ModiaPlot_GLMakie etc. have been replaced by packages SignalTablesInterface_PyPlot, SignalTablesInterface_GLMakie etc. In order that plotting works again with your models, you have to add one of the new plot package interfaces, e.g. ]add SignalTablesInterface_PyPlot. One benefit is, that the plot packages have now access to all attributes associated with a variable.

  • An instantiated model (as returned from @instantiateModel(..)) is now a signal table according to SignalTables.jl. This means that all functions defined for a signal table (see function overview) can be applied on a simulated model. Hereby, all Var(..) and Par(..) Modia variables are seen as signals of the signal table (so both time varying variables, as well as parameters). See example Modia/test/TestFirstOrder2.jl.
    For example, it is now possible to store simulation results (together with all parameter and start values) on file in JSON format with writeSignalTable(filename, instantiatedModel), see firstOrder.json (or in HDF5 format via JDL). You get an overview of a simulation result via showInfo(instantiatedModel).

  • New functions hasParameter, getParameter, getEvaluatedParameter, showParameters, showEvaluatedParameters to get parameter/init/start values by name (e.g. getEvaluatedParameter(instantiatedModel, "a.b.c")) or show all parameters.

  • New functions to add states and algebraic variables from within functions that are not visible in the generated code (see Variable definitions in functions and example Modia/test/TestLinearSystems.jl). This feature is used in the next version of Modia3D to allow (Modia3D) model changes after code generation and to get more light weight code.

  • simulate!(..): Maximum number of iterations is switched off (DifferentialEquations.jl option set to: maxiters = Int(typemax(Int32)) ≈ 2e9).

  • Docu improved.

Bug fixes

  1. A hierarchical model name with a derivative operator, say der(a.b.c), has now the correct name a.b.der(c) in the result. For example, the plot command needs to be changed to plot(..., "a.b.der(c)") instead of the previous command plot(..., "der(a.b.c)").
  2. The initial state vector was not always correctly filled with start/init values of the model (is now fixed).
  3. signalNames(instantiatedModel) did sometimes not show the correct signal names available in the result (is now fixed).
    signalNames is deprecated. Use instead getSignalNames.

Non-backwards compatible changes

  • Bug fix 1 can lead for some models to warnings and the selected variable is no longer plotted (-> the model needs to be changed).

  • Bug fix 2 can lead for some models to a different result (without notice).

  • The result data structure is now constructed with deepcopy(..) of every involved result variable. Previously, for some result variables just the variable reference was stored. The effect is that if previously a complex internal data structure was incorporated into the result data structure, then it was present just once. Now, a deepcopy of the data structure is stored at every time instant. Note, a variable v (especially, a complex internal data structure) is not stored in the result if defined as v = Var(hideResult=true). In some rare cases, deepcopy(..) gives an error (if module variables are, for whatever reason, tried to be copied). Such variables v need to be declared with v = Var(hideResult=true), in order that this error does not appear (and these variables are then not stored in the result).

  • Function rawSignal(instantiatedModel, name) is no longer supported. Use getValues or getSignal instead.

  • Function getPlotSignal(instantiatedModel, name) is no longer supported. Use getFlattenedSignal instead.

  • Function getPath(path, ...) does no longer return a dictionary but a SignalTable.