Proposal of New Object-Oriented Equation-Based Model Libraries for Thermodynamic Systems
Total Page:16
File Type:pdf, Size:1020Kb
Proposal of New Object-Oriented Equation-Based Model Libraries for Thermodynamic Systems Von der Fakult¨atf¨urMaschinenbau der Technischen Universit¨atCarolo-Wilhelmina zu Braunschweig zur Erlangung der W¨urde eines Doktor-Ingenieurs (Dr.-Ing.) genehmigte Dissertation von: Christoph C. Richter aus: Braunschweig eingereicht am: 11. Januar 2008 m¨undliche Pr¨ufungam: 3. April 2008 Referenten: Prof. Dr.-Ing. J¨urgen K¨ohler Prof. Dr.-Ing. Gerhard Schmitz Vorsitzender: Prof. Dr.-Ing. Martin M¨onnigmann 2008 Preface Preface This thesis can be regarded as a follow-up project to the PhD thesis of Tegethoff(1999) moving from his C++ simulation platform to a component model library written in Modelica complemented by a fluid property library developed in C/C++ with interfaces to various soft- ware tools and programming languages including Modelica. The thesis belongs somewhere in the intersection of Computer Science, Systems Design Engineering, and Thermodynamics. It examines the advantages and possible pitfalls of object-oriented model library design using the free object-oriented modeling language Modelica. During the time of the library devel- opment, I was involved in the design of parts of the Modelica Standard Library and got very good insight into the language design itself by being a member of the Modelica Association. The enthusiasm of the members of the Modelica Association and the Modelica Fluid Group was a continuous source of motivation and a great help with a lot of problems that emerged during the library design process. Acknowledgments Writing a thesis is an iterative process that requires continuous input from other people especially when developing simulation libraries that are meant to be used by others than the author himself. I would not have been able to finish this project without the strong support of a number of people to whom the following paragraphs are dedicated. The order is random and not meant to be a ranking of any sort. First I wish to thank all postgraduate students at the Institut f¨urThermodynamik for their support and help in many situations. Special thanks to Roland who was never bored with my endless questions regarding C++ and Qt and with whom I was able to develop a program as unique as the StateViewer. I would also like to thank Christine, Julia, Christian S., Roland, and Niko for many nice evenings including sushi, wine, and memorable Cranium sessions. Special thanks to Christine for cheering me up in the mornings by having a little chat before everyone else showed up. Also writing chapter6 would not have been possible without her strong support that I really appreciated. Thanks to Kai and Marcos who had to test and extend my libraries for not getting sick of the many updates that they had to adopt their models to. Special thanks also to Christian T. for his strong support with the ejector test stand and for his never-ending effort to keep up with me when going for a run after a long day of work. I also want to thank Willi who was always keen enough to discuss new ideas and who did not stop me when starting to redesign TILFluids from scratch in late spring 2006. I am also very grateful that Willi taught me how to use Modelica in an in-house course knowing the language just a little better than the participants of the course back then. This thesis would not have been possible without his strong support especially during the last weeks and days before finishing it. Furthermore, I want to thank the staff at TLK for utilizing some of the software I de- veloped despite all the bugs. Many thanks also to the master students at the Institut f¨ur III Acknowledgments Thermodynamik that helped me with some aspects of my work, especially to Martin for his tool ModelicaCDV (which I misspelled many times as ModelicaCVD) and Nils for his implementation of heat exchangers in Modelica. I am grateful to the members of the Modelica Association for answering the really tricky Modelica questions. I especially want to thank Katrin Pr¨olß,Hubertus Tummescheit, Francesco Casella, and the entire Modelica Fluid Group for many fruitful discussions and nice evenings at the Modelica Design Meetings. I am glad to express my sincere gratitude to Prof. K¨ohler for supervising this thesis and to Prof. Schmitz for his valuable inputs. I also want to thank the technical staff at the Institut f¨urThermodynamik for their support during the three years I spent there. Special thanks to the Canada gang for the yearly meetings that always were a source of motivation to me. Thanks Debbie, Jenny, Sven, and Matthias for the many outdoor events and cooking sessions. Also thanks for changing me from a couch potato into a marathon finisher. Special thanks go to my girlfriend Frederike for always being supportive even during the hard times of self-doubts. The two months in New Zealand are unforgettable and belong to my most precious memories. Thanks also to Frederike, Mandy, and Christian T. for the nice evenings taking dancing lessons. Also many thanks to my parents for their loving support and confidence in me and to my brother Marius for proofreading this thesis and for many motivating phone calls. For the financial support, I want to thank the Studienstiftung des deutschen Volkes that was brave enough to support me since my second semester as an undergraduate student all the way until finishing my doctoral thesis. IV Abstract Proposal of New Object-Oriented Equation-Based Model Libraries for Thermodynamic Systems Abstract This thesis proposes two new model libraries for fluid properties and for components that can be used for the simulation of thermodynamic systems such as refrigeration, air-conditioning, and heat-pump systems. The new fluid property library is written in C/C++ and can be interfaced from various software tools and programming languages. The new component model library is written in the object-oriented equation-based modeling language Modelica. Furthermore, tools for the automated generation of class diagrams and the visualization of the solution process as well as the numerical results in relevant diagrams such as pressure- enthalpy diagrams are presented. Both new libraries are based on a thorough object-oriented analysis. Graphical repre- sentations for all object-oriented features of Modelica based on the elements defined in the Unified Modeling Language are introduced. A set of general design rules for the develop- ment of object-oriented component model libraries is formulated to ensure that the resulting library can be used by the entire spectrum of possible users from experienced developers to design engineers. The new object-based fluid property library is based on a generalized approach to include external fluid property computation codes in Modelica. It is simple to extend to additional external fluid property computation codes. It allows for a numerically efficient handling of fluid properties in Modelica and in a number of software tools. The numerical efficiency of the presented approach matches the numerical efficiency of available fluid property computation codes formulated in Modelica. The new model library for components and systems was developed based on the newly introduced design rules. It features a structure that is simple to understand and flexible to allow for extensions. All balance equations are formulated in an easy and comprehensible way in base components. The new component model library contains models with different levels of detail to allow for a problem-dependent model selection. Two applications are presented to demonstrate the capabilities of the two new libraries. A prototype Peltier heat exchanger heating one water stream while cooling another one is analyzed during a transient reversion of the applied voltage. The second example analyzes a prototype ejector refrigeration system partly developed within the scope of this thesis. It is shown that an ejector improves the COP of a CO2 refrigeration system. The two selected examples demonstrate the extendibility and multidisciplinarity of the new libraries. Both libraries are already used and extended by a team of developers at the Institut f¨ur Thermodynamik and the TLK-Thermo GmbH. V Kurzfassung Vorschlag f¨urneue objektorientierte gleichungsbasierte Modellbibliotheken f¨urthermodynamische Systeme Kurzfassung Diese Arbeit beschreibt zwei neue Modellbibliotheken mit Stoffdaten- und Komponentenmo- dellen zur Simulation thermodynamischer Systeme wie zum Beispiel K¨alteanlagen,Klimaan- lagen und W¨armepumpen. Die neue Stoffdatenbibliothek ist basierend auf C/C++ entwickelt worden und verf¨ugt¨uber Schnittstellen f¨urunterschiedliche Anwendungsprogramme und Pro- grammiersprachen. Die neue Komponentenbibliothek ist in der objektorientierten gleichungs- basierten Modellierungssprache Modelica geschrieben. Es werden außerdem Werkzeuge vor- gestellt, die die automatische Generierung von Klassenstrukturdiagrammen und die Visu- alisierung des L¨osungsprozessessowie der numerischen Ergebnisse in thermodynamischen Diagrammen wie zum Beispiel dem p,h-Diagramm erm¨oglichen. Beide neuen Bibliotheken basieren auf einer gr¨undlichen objektorientierten Analyse. Um diese einheitlich zu erm¨oglichen, werden grafische Darstellungen f¨ur alle objektorientierten Merkmale von Modelica basierend auf der UML eingef¨uhrt. Es werden des Weiteren all- gemeing¨ultigeRichtlinien f¨ur die Erstellung von objektorientierten Modellbibliotheken en- twickelt, die sicherstellen, dass die entwickelte Bibliothek das gesamte Spektrum m¨oglicher Benutzer vom Code-Entwickler bis hin zum Anwender unterst¨utzt.