Patterns and Anti-Patterns in Modelica

Michael M. Tiller, Christopher Alexander, Sara Ishikawa, Murray Silverstein, A Pat · 2008

In 1977, Christopher Alexander, Sara Ishikawa and Murray Silverstein published the book “A Pattern Language: Towns, Buildings, Construction” [1]. Although the topic of the book was architecture, it inspired Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides in their approach to pattern based software development. This ultimately led to the publication, in 1994, of the book “Design Patterns: Elements of Reusable Object-Oriented Software” [2] (also known as the “Gang of Four” or “GoF” book) which launched a major movement in the software development community toward pattern based software design. The idea behind the pattern movement is to formally identify sound design solutions to common problems. Since the publication of “Design Patterns” there have been numerous books published on the topic of software patterns. Several of these books dealt with the sub-topic of anti-patterns [3,4]. In contrast to a normal pattern, anti-patterns are an attempt to identify common bad practices and ways they can be refactored using sound design patterns. The emphasis of the pattern community is, understandably, on object-oriented languages with procedural semantics. This paper will build on previous work [5] identifying patterns in Modelica. These design patterns include how medium properties can be handled in a flexible way, how to deal with systems with varying causality and differential index, idealized plant control and, finally, coordination between models. In addition, this paper includes some extensive discussion of anti-patterns to avoid redundant code, awkward data management and inflexible models. This paper continues the discussion on patterns within the Modelica community with the hope that this will encourage others to contribute patterns of their own. One obvious benefit of such efforts will be additional resources for Modelica developers to make the process of developing models in Modelica easier. In addition, we expect that many of the patterns discussed will also generate proposals for improving the Modelica language through new features and semantics.

Read the paper · More papers on PaperTik