Logo

The 14th International Modelica Conference
Linköping, September 20-24, 2021

[Practical Information] [Tutorials and Vendor Sessions] [Proceedings] [Modelica Libraries] [FMI User Meeting] [Archives] [Journal Special Issue (open for submissions until 2022-07-31)]

Session 7A - Modelica Language

Title: Handling Multimode Models and Mode Changes in Modelica
Authors: Albert Benveniste, Benoît Caillaud and Mathias Malandain
Abstract: Since its version 3.3, the Modelica language offers the possibility to model multimode systems having different DAE-based dynamics in each mode, thanks to the introduction of state machines. When the differentiation index and structure varies with mode changes, compilers generate erroneous simulation code, often resulting in runtime exceptions.
We propose in this paper amultimode structural analysis for both multiple modes and mode change events and we show how correct code for restarts can be generated. Our approach is illustrated on two simple but representative mechanical systems.
Keywords: multimode DAE, structural analysis, mode change events
Paper: full paper Creative Commons License
Bibtex:
@InProceedings{modelica.org:Benveniste:2021a,
  title = "{Handling Multimode Models and Mode Changes in Modelica}",
  author = {Albert Benveniste and Beno{\^\i}t Caillaud and Mathias Malandain},
  pages = {507--517},
  doi = {10.3384/ecp21181507},
  booktitle = {Proceedings of the 14th International Modelica Conference},
  location = {Link\"oping, Sweden},
  editor = {Martin Sj\"olund and Lena Buffoni and Adrian Pop and Lennart Ochel},
  isbn = {978-91-7929-027-6},
  issn = {1650-3740},
  month = sep,
  series = {Link\"oping Electronic Conference Proceedings},
  number = {181},
  publisher = {Modelica Association and Link\"oping University Electronic Press},
  year = {2021}
}


Title: A Reduced Index Mode-Independent Structure Model Transformation for Multimode Modelica Models
Authors: Benoît Caillaud, Mathias Malandain and Albert Benveniste
Abstract: Since its 3.3 release, Modelica offers the possibility to specify models of dynamical systems with multiple modes having different DAE-based dynamics. However, the handling of such models by the current Modelica tools is not satisfactory, with mathematically sound models yielding exceptions at runtime. In this article, we propose a systematic way of rewriting a multimode Modelica model, based on the results of an already implemented multimode structural analysis. The rewritten Modelica model is guaranteed to be correctly compiled by state-of-the-art Modelica tools. Simulation results are presented on a simple, yet meaningful, physical system whose original Modelica model is not correctly handled by state-of-the-art Modelica tools.
Keywords: Modelica, multimode DAE, structural analysis, model transformations
Paper: full paper Creative Commons License
Bibtex:
@InProceedings{modelica.org:Caillaud:2021,
  title = "{A Reduced Index Mode-Independent Structure Model Transformation for Multimode Modelica Models}",
  author = {Beno{\^\i}t Caillaud and Mathias Malandain and Albert Benveniste},
  pages = {519--528},
  doi = {10.3384/ecp21181519},
  booktitle = {Proceedings of the 14th International Modelica Conference},
  location = {Link\"oping, Sweden},
  editor = {Martin Sj\"olund and Lena Buffoni and Adrian Pop and Lennart Ochel},
  isbn = {978-91-7929-027-6},
  issn = {1650-3740},
  month = sep,
  series = {Link\"oping Electronic Conference Proceedings},
  number = {181},
  publisher = {Modelica Association and Link\"oping University Electronic Press},
  year = {2021}
}


Title: Evaluating a Tree Diff Algorithm for Use in Modelica Tools
Authors: Martin Sjölund
Abstract: Modelica tools change the formatting of the source code when performing operations in the graphical user interface. These unintended changes cause problems for source code management where during a code review you will mostly see changes that do not perform anything. The intent of this work is to present a workflow where edits from an interactive environment do not contain these unintended changes when using the source code management system.
A diff tool that can merge two Modelica files and produce a merged copy is presented and evaluated. The diff algorithm works by comparing syntax subtrees of Modelica code and having some domain knowledge about which subtrees belong together, speeding up the diff algorithm. The result is a merged file by taking formatting of the first file and the semantics from the second file. This works very well for smaller changes (a single edit) and scales with file size (making the user interface faster for smaller files). To test the algorithm on a larger set of changes, a conversion script was applied to a set of libraries and the performance was analyzed. The results are very promising especially for Modelica libraries that are split into multiple files rather than a large single file. Having a single large file takes slightly longer to process and produces additional formatting changes to a library developed as a set of smaller files.
Keywords: Modelica, diff, file comparison, conversion script, interactive user interface
Paper: full paper Creative Commons License
Bibtex:
@InProceedings{modelica.org:Sjolund:2021,
  title = "{Evaluating a Tree Diff Algorithm for Use in Modelica Tools}",
  author = {Martin Sj\"olund},
  pages = {529--537},
  doi = {10.3384/ecp21181529},
  booktitle = {Proceedings of the 14th International Modelica Conference},
  location = {Link\"oping, Sweden},
  editor = {Martin Sj\"olund and Lena Buffoni and Adrian Pop and Lennart Ochel},
  isbn = {978-91-7929-027-6},
  issn = {1650-3740},
  month = sep,
  series = {Link\"oping Electronic Conference Proceedings},
  number = {181},
  publisher = {Modelica Association and Link\"oping University Electronic Press},
  year = {2021}
}


Title: Numerically Robust Six-Equation Two-Phase Flow Model for Stationary and Moving Systems in Modelica
Authors: Johannes Brunnemann, Ales Vojacek and Thomas Koch
Abstract: We present a physics based Modelica finite volume flow model that separately balances vapour and liquid phase. By using extensive state variables and a special mass flow regularisation, the model can cope with the possible vanishing or emerging of a phase in a numerically robust way. Although at prototype stage, the model already exhibits all required capabilities. These are demonstrated in feature testers and in a model of a natural convection driven cooling cycle operating under external acceleration forces.
Keywords: two phase flow, six equation model, cooling cycle, natural convection, moving systems, ClaRa library
Paper: full paper Creative Commons License
Bibtex:
@InProceedings{modelica.org:Brunnemann:2021,
  title = "{Numerically Robust Six-Equation Two-Phase Flow Model for Stationary and Moving Systems in Modelica}",
  author = {Johannes Brunnemann and Ales Vojacek and Thomas Koch},
  pages = {539--548},
  doi = {10.3384/ecp21181539},
  booktitle = {Proceedings of the 14th International Modelica Conference},
  location = {Link\"oping, Sweden},
  editor = {Martin Sj\"olund and Lena Buffoni and Adrian Pop and Lennart Ochel},
  isbn = {978-91-7929-027-6},
  issn = {1650-3740},
  month = sep,
  series = {Link\"oping Electronic Conference Proceedings},
  number = {181},
  publisher = {Modelica Association and Link\"oping University Electronic Press},
  year = {2021}
}


Title: Compile-Time Impulse Analysis in Modelica
Authors: Albert Benveniste, Benoît Caillaud and Mathias Malandain
Abstract: Since its 3.3 release, Modelica offers the possibility to specify models of dynamical systems with multiple modes having different DAE-based dynamics. However, the handling of mode changes by the current Modelica tools is not satisfactory.
An important difficulty is the occurrence of impulsive behavior at some mode changes, for some variables. In this paper, we propose a compile-time algorithm for identifying such impulsive behaviors and quantifying them in terms of their magnitude orders. Such algorithm can be used as an additional step of the structural analysis of Modelica models.
Keywords: DAE, multimode DAE, structural analysis, impulsive behaviors
Paper: full paper Creative Commons License
Bibtex:
@InProceedings{modelica.org:Benveniste:2021b,
  title = "{Compile-Time Impulse Analysis in Modelica}",
  author = {Albert Benveniste and Beno{\^\i}t Caillaud and Mathias Malandain},
  pages = {549--559},
  doi = {10.3384/ecp21181549},
  booktitle = {Proceedings of the 14th International Modelica Conference},
  location = {Link\"oping, Sweden},
  editor = {Martin Sj\"olund and Lena Buffoni and Adrian Pop and Lennart Ochel},
  isbn = {978-91-7929-027-6},
  issn = {1650-3740},
  month = sep,
  series = {Link\"oping Electronic Conference Proceedings},
  number = {181},
  publisher = {Modelica Association and Link\"oping University Electronic Press},
  year = {2021}
}