Accepted at European Simulation Multiconference ESM’98, Manchester, United Kingdom DESIGN OF A THERMO-HYDRAULIC MODEL LIBRARY IN MODELICA Hubertus Tummescheit, Jonas Eborn Department of Automatic Control Lund Institute of Technology Box 118, SE-221 00 Lund, Sweden Hubertus.Tummescheit@gmd.de, jonas@control.lth.se ABSTRACT A new language called Modelicafor hierarchical physi- cal systems modeling is developed in an international effort. The main objectives are to make it easy to exchange models and model libraries between tools and to use object-oriented constructs to facilitate the reuse of modeling knowledge. To promote the idea of a unified modeling language for con- tinuous and hybrid systems, public domain model libraries for basic models are developed in various application do- mains. This paper deals with the design of a base library for thermo-hydraulic applications. Requirements for the li- brary are derived from representative simulation examples and special care is taken to cover the basic physical phe- nomena broadly. Accurate and fast calculations for ther- modynamic properties of fluids constitute a very important and intricate part of thermo-hydraulic calculations, there- fore they are given much attention. The state equations for the transport of mass, momentum and energy are for- mulated in a very general way in order to allow applica- tion oriented simplifications in derived classes. Constitu- tive equation submodels (e. g., for heat transfer coefficients) complete the set of basic building blocks. Modelicas unique language features 1 of class parameters and multiple inher- itance are extensively used in order to structure the library for intuitive use by model-users and maximum code reuse by model-developers. The library is under development now. GENERAL CONCEPT The general goal of the library is to provide a framework and basic building blocks for modeling thermo-hydraulic systems in Modelica. For obvious reasons it is impossi- ble to provide a complete library, so one of the main goals is extensibility. For the same reason, much more empha- sis will be but on the basic parts of the library, such as medium models and essential control volumes, than on an exhaustive application library. The focus of the library is on models of homogeneous one- and two-phase flows, non- homogeneous and multi-phase flows are not taken into ac- count yet. It is necessary to support bidirectional flow, be- cause flow directions can change during simulation or are not known initially in networks. Flow splitters or junctions must also be modeled correctly for arbitrary flow directions in all branches. These goals lead to the following guidelines: 1. one unified library both for lumped and distributed pa- rameter models, 1 among physical systems modeling languages 2. separation of the medium submodels, which can be se- lected through class parameters, 3. both bi- and unidirectional flows are supported, 4. assumptions (e.g., incompressible flow) can be se- lected by the user in the control volume level. The first guideline puts a constraint on the discretization method that must be used in the distributed parameter mod- els: only the multinodal or staggered grid method, where all fluxes are calculated on the border of a control volume and the intensive quantities are calculated in the center of a control volume, reduces to a useful model in the lumped parameter case. This model is very common for systems modeling and for one-dimensional discretizations, but it has the drawback that the approximation of the spatial deriva- tives is always only first order accurate. The staggered grid model is also used for heat conduction in solid structures. Homogeneous fluid properties over the cross section are assumed in all models, but whenever suitable a property dis- tribution along the main axis increase the model accuracy. In the case of combined convection-diffusion processes and heat transfer, the steady state solution temperature profile of the partial differential equation (PDE) combined with safe- guards against unphysical behavior in fast transients results in a better approximation of real equipment and make it eas- ier to compare result with stationary calculations. Experiences from a library for the simulation of thermal power plants written in the SMILE language (Tummescheit and Pitz-Paal 1997) (mainly distributed models) and from a library written in OMOLA (Eborn 1998) (mainly lumped parameter models) are combined to form the basis for the Modelica library. COMPONENT BUILDING BLOCKS The main goal of a model library is to enable the user to quickly assemble complex plant topologies from the ba- sic building blocks that result in a physically correct com- pound model and can be simulated efficiently. For thermo- hydraulic networks this can be achieved by structuring the user models in a specific way: all models have a design flow direction, also when the physical model correctly de- scribes bidirectional flows. Many schemes of distributed and concentrated models can be realized in this way. It is also possible to model components, where the pressure drop is concentrated at the outlet and the thermal variables are distributed or neglect the pressure drop completely. These component blocks are at the same time the smallest unit, that “make sense” as a simulation experiment. Internally, these component blocks may be composed of several ba- sic models. In general there is a basic energy and mass