Proposal of new object-oriented equation-based model libraries for thermodynamic systems [Elektronische Ressource] / von Christoph C. Richter
157 pages
English

Proposal of new object-oriented equation-based model libraries for thermodynamic systems [Elektronische Ressource] / von Christoph C. Richter

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
157 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Proposal of New Object-OrientedEquation-Based Model Librariesfor Thermodynamic SystemsVon der Fakult at fur Maschinenbauder Technischen Universit at Carolo-Wilhelmina zu Braunschweigzur Erlangung der Wurdeeines Doktor-Ingenieurs (Dr.-Ing.)genehmigte Dissertationvon: Christoph C. Richteraus: Braunschweigeingereicht am: 11. Januar 2008mundlic he Prufung am: 3. April 2008Referenten: Prof. Dr.-Ing. Jur gen K ohlerProf. Gerhard SchmitzVorsitzender: Prof. Dr.-Ing. Martin M onnigmann2008PrefacePrefaceThis thesis can be regarded as a follow-up project to the PhD thesis of Tegetho (1999)moving from his C++ simulation platform to a component model library written in Modelicacomplemented by a uid property library developed in C/C++ with interfaces to various soft-ware tools and programming languages including Modelica. The thesis belongs somewherein the intersection of Computer Science, Systems Design Engineering, and Thermodynamics.It examines the advantages and possible pitfalls of object-oriented model library design usingthe 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 verygood insight into the language design itself by being a member of the Modelica Association.

Informations

Publié par
Publié le 01 janvier 2008
Nombre de lectures 25
Langue English
Poids de l'ouvrage 3 Mo

Extrait

Proposal of New ObjectOriented EquationBased Model Libraries for Thermodynamic Systems
Von der Fakultät für Maschinenbau der Technischen Universität CaroloWilhelmina zu Braunschweig
von: Christoph C. Richter aus: Braunschweig
zur Erlangung der Würde
eines DoktorIngenieurs (Dr.Ing.)
genehmigte Dissertation
eingereicht am: 11. Januar 2008 mündliche Prüfung am: 3. April 2008
Referenten: Prof. Dr.Ing. Jürgen Köhler Prof. Dr.Ing. Gerhard Schmitz Vorsitzender: Prof. Dr.Ing. Martin Mönnigmann
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ür Thermodynamik 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 chapter 6 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 redesignTILFluidsI am alsofrom scratch in late spring 2006. 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ür
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ölß, 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öhler for supervising this thesis and to Prof. Schmitz for his valuable inputs. I also want to thank the technical staff at the Institut für Thermodynamik 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
Abstract
Proposal of New ObjectOriented EquationBased Model Libraries for Thermodynamic Systems
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 CO2refrigeration 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ür Thermodynamik and the TLKThermo GmbH.
V
Kurzfassung
Vorschlag für neue objektorientierte gleichungsbasierte Modellbibliotheken für thermodynamische Systeme
Kurzfassung
Diese Arbeit beschreibt zwei neue Modellbibliotheken mit Stoffdaten und Komponentenmo dellen zur Simulation thermodynamischer Systeme wie zum Beispiel Kälteanlagen, Klimaan lagen und Wärmepumpen. Die neue Stoffdatenbibliothek ist basierend auf C/C++ entwickelt worden und verfügt über Schnittstellen für unterschiedliche 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ösungsprozesses sowie der numerischen Ergebnisse in thermodynamischen Diagrammen wie zum Beispiel dem p,hDiagramm ermöglichen. Beide neuen Bibliotheken basieren auf einer gründlichen objektorientierten Analyse. Um diese einheitlich zu ermöglichen, werden grafische Darstellungen für alle objektorientierten Merkmale von Modelica basierend auf der UML eingeführt. Es werden des Weiteren all gemeingültige Richtlinien für die Erstellung von objektorientierten Modellbibliotheken en twickelt, die sicherstellen, dass die entwickelte Bibliothek das gesamte Spektrum möglicher Benutzer vom CodeEntwickler bis hin zum Anwender unterstützt. Die neue objektbasierte Stoffdatenbibliothek basiert auf einem generalisierten Ansatz zur Einbindung externer Stoffdatenbibliotheken in Modelica. Der beschriebene Ansatz lässt sich einfach auf weitere externe Bibliotheken zur Stoffdatenberechnung erweitern. Er erlaubt die numerisch effektive Behandlung der eingebundenen Bibliotheken in Modelica sowie in An wendungsprogrammen. Der generalisierte Ansatz ist vorhandenen Modelicainternen Stoff datenbibliotheken in numerischer Hinsicht ebenbürtig. Die neue Modellbibliothek für Komponenten und Systeme verfügt über eine Struktur, die einfach verständlich und flexibel erweiterbar ist. Alle Erhaltungsgleichungen sind in einfach verständlicher Form in Basiskomponenten formuliert. Die neue Komponentenmodell bibliothek enthält Modelle unterschiedlicher Modellierungstiefe, um eine problemabhängige Auswahl von Modellen zu erlauben. Zwei Anwendungen für die beiden neuen Modellbibliotheken werden präsentiert. Die er ste Anwendung ist die transiente Simulation einer PeltierWasserWasserWärmeübertragers während einer Spannungsumkehrung. Das zweite Beispiel ist ein EjektorKältekreislauf, der teilweise im Rahmen dieser Arbeit entwickelt wurde. Es wird gezeigt, dass der Einsatz eines Ejektors den COP eines CO2Kältekreislaufes steigert. Beide Anwedungsbeispiele demon strieren die Erweiterbarkeit und die Multidisziplinarität der neuen Bibliotheken. Beide neuen Modellbibliotheken werden von einem Team von Anwendern und Entwicklern am Institut für Thermodynamik und bei der TLKThermo GmbH genutzt und erweitert.
VI
Contents
1
2
3
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Kurzfassung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction 1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 A Brief History of Modeling Languages . . . . . . . . . . . . . . . . . . . . . 1.3 State of the Art in Thermodynamic System Simulations . . . . . . . . . . . . 1.4 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Structure of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ObjectOriented Modeling 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 ObjectOriented Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.3 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.4 Multiple Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 Exchangeable Object Type . . . . . . . . . . . . . . . . . . . . . . . . 2.4.2 Replaceable Local Class . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 More Pitfalls in ObjectOriented Modeling . . . . . . . . . . . . . . . . . . . . 2.6 Accessing Object Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.1 Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.2 Direct Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.3 Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.4inner/outerConcept . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7 Evaluation of Existing Libraries . . . . . . . . . . . . . . . . . . . . . . . . . .
Modeling of ThermoPhysical Fluid Properties 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 FunctionBased Computation of Fluid Properties . . . . . . . . . . . . . . . . 3.3 ObjectBased Computation of Fluid Properties . . . . . . . . . . . . . . . . . 3.4 Calling External Fluid Property Computation Codes . . . . . . . . . . . . . .
V VI
1 1 3 5 8 9
11 11 13 13 14 14 15 18 20 20 21 22 23 23 24 25 26 27
31 31 33 34 36
VII
4
5
3.5
Contents
3.4.1 Architecture of the Modelica Layer (Modelica ExternalMedia. . .) . 3.4.2 Architecture of the C/C++ Layer (ExternalMedia) . . . . . . . . . . . Advanced ObjectBased Computation of Fluid Properties . . . . . . . . . . . 3.5.1 Architecture of the Modelica Layer (TILFluids. . . . . . . . . . .) . 3.5.2 Architecture of the C/C++ Layer (TILFluidsLib) . . . . . . . . . . . 3.5.3 Interfaced External Fluid Property Computation Codes . . . . . . . . 3.5.4 Comparison of Computational Efficiency . . . . . . . . . . . . . . . . .
ObjectOriented Modeling of Fluid Systems Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Connectors and Connection Equations . . . . . . . . . . . . . . . . . . . . . . Conservation Laws . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Accumulator Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Heat Transfer and Pressure Drop Models . . . . . . . . . . . . . . . . . . . . 4.5.1 SinglePhase Refrigerant Flows . . . . . . . . . . . . . . . . . . . . . . 4.5.2 TwoPhase Refrigerant Flows . . . . . . . . . . . . . . . . . . . . . . . 4.5.3 Gas Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.4 Solids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Smooth Transition Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . Cells for Refrigerants, Liquids, Gases, and Solids . . . . . . . . . . . . . . . . 4.7.1 Refrigerant Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2 Gas Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.3 Liquid Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.4 Wall Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Heat Exchangers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.1 Sandwich Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.2 Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.3 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Compressor Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Component Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1 System Information Manager . . . . . . . . . . . . . . . . . . . . . . . 4.10.2 Pressure State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.3 Partial Base Component . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.4 Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Numerical Aspects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11
Visualization 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Automated Generation of UML Class Diagrams . . . . . . . . . . . . . . . . . 5.3 Thermodynamic Phase Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Online Visualization during Initialization . . . . . . . . . . . . . . . . . . . .
VIII
37 40 40 41 44 45 46
49 49 51 55 58 60 60 62 64 65 66 70 70 72 73 74 74 75 77 79 79 80 80 81 82 83 84
87 87 88 90 93
SteadyState ObjectOriented Modeling of Fluid Systems C.1 Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2 Compressor Model . . . . . . . . . . . . . . . . . . . . . . . . C.3 Gas Cooler Model . . . . . . . . . . . . . . . . . . . . . . . . C.4 Evaporator Model . . . . . . . . . . . . . . . . . . . . . . . . C.5 Internal Heat Exchanger . . . . . . . . . . . . . . . . . . . . . C.6 Accumulator Model . . . . . . . . . . . . . . . . . . . . . . . C.7 Valve Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.8 Loop Breaker Model . . . . . . . . . . . . . . . . . . . . . . .
Contents
6
IX
D Partial Derivatives of Fluid Properties 142 D.1 OnePhase State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 D.2 TwoPhase State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 D.3 Further Partial Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
8
B
Thermoelectric Applications 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Thermoelectric Refrigeration . . . . . . . . . . . . . . . . . 6.3 Prototype Peltier Heat Exchanger . . . . . . . . . . . . . . 6.4 Peltier Heat Exchanger Model . . . . . . . . . . . . . . . . . 6.5 Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 Numerical Results . . . . . . . . . . . . . . . . . . . . . . .
7
References
Design Rules
Ejector Refrigeration System 108 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 7.2 Ejector Refrigeration Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 7.3 A Brief History of CO2. . . . . . . . . . . . . . . . . . . . . . 111as Refrigerant 7.4 State of the Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 7.5 Layout of the Test Stand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 7.6 Ejector Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 7.7 Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 7.8 Numerical Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
96 96 97 98 100 103 105
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
138 . . . . . . . . . 138 . . . . . . . . . 139 . . . . . . . . . 139 . . . . . . . . . 140 . . . . . . . . . 140 . . . . . . . . . 140 . . . . . . . . . 141 . . . . . . . . . 141
9
A Nomenclature
C
Conclusions and Outlook 121 8.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 8.2 Future Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
125
137
134
E
X
Contents
Additional Component and System Models E.1 TheStateViewerInterface. . . . . . . . . . . . . . . . . . . . . . . . . . . E.2 Model for Prototype Peltier Heat Exchanger . . . . . . . . . . . . . . . . . . .
145 145 146
Chapter
1
Introduction
1.1
Computer simulations are one of the foundations of modern engi neering. A lot of engineering knowhow is coded into system mod els that allow for a deeper understanding and reliable predictions of system behavior. This chapter motivates the development of a new objectoriented Modelica library to simulate and analyze thermodynamic systems and provides background information on the development of modern modeling languages especially of Mo delica.
Motivation
Over the past decades, computer simulations have become a central foundation of modern engineering. A large number of simulation tools has been developed to solve a wide range of engineering problems. This thesis focuses on the analysis of general strategies for the devel opment of objectoriented component model libraries and proposes suitable basic structures. It presents a new model library to compute fluid properties as well as a new component model library written in the free modeling language Modelica. The component models are either zerodimensional, i.e., do not take into account spatial distributions, or onedimensional, i.e., take into account spacial distributions in one spatial direction. The idea for the new object oriented component model library emerged from the experience with other libraries in this field. These libraries very often feature an objectoriented structure that makes it very hard to trace errors or to extend or customize the library due to its complexity. The new com ponent model library offers a unique structure that is simple to understand and that fulfills the requirements of developers, simulation specialists, and design engineers. The equations in each component model are formulated to yield a numerically efficient differential algebraic equation (DAE) system. The component model library uses a new fluid property library that offers a generalized and numerically efficient way to include external fluid property compu tation codes in Modelica and a number of software tools. Both libraries are extended by a team of developers and used to analyze various thermodynamic systems. Two demonstrating examples are presented as a proof of concept for the new model libraries and to show possible applications.
1
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents