• No results found

5. The ThermoFluid Library

5.8 Component Models

Chapter 5. The ThermoFluid Library



PPPPPPPPP

Figure 5.10 Example system using a heat exchanger consisting of two pipes, a wall and 4 connectors. In order to simulate it, all flow connectors are connected to reservoirs as boundary conditions.

cover only a fraction of the models that would be useful for a comprehen-sive process engineering or power plant modeling library. ThermoFluid contains standard cases for simple models which cover the basic needs for system models.

be-5.8 Component Models tween the individual elements of the distributed pipes. The lumped case is either based on this simple model or uses the logarithmic mean tem-perature.

A different approach to heat exchanger modeling that elegantly and efficiently uses advanced object-oriented modeling constructs has been presented in [Mattsson, 1997]. The heat exchanger is cut into discrete slices perpendicular to the axis of both flow channels(which are assumed to be in parallel). An array of such slices is modeled as an array of com-ponents in Modelica. An instance of the heat exchanger can be initialized with the number of slices as a parameter which gives the discretization of the heat exchanger. The authors ofThermoFluid feel however that the approach of building up a heat exchanger from the physical components hot side, cold side and wall gives more flexibility and better reuse in a library which uses these components also in other models.

Reservoirs

Reservoirs are used to add boundary conditions to other components or systems of components. Two types of boundary conditions have to be spec-ified: either the flows of mass, energy and momentum or the potentials given by the thermodynamic state. The reservoirs provide boundary con-ditions in accordance with these two types:

• either the thermodynamic state, using any of the combinations of variables listed in Section 4.6. These models are called reservoirs.

• A model computing the flows of mass, energy and momentum at the boundary. These models are called sources.

The latter boundary condition can be realized using a reservoir defining the thermodynamic state connected to a simple orifice model. The advan-tage of that way of specifying flow boundary conditions is that the steady state pressure has to be in the interval defined by the boundary reser-voirs. The second type of reservoirs connects to the HeatFlow -connectors and again, either the potential or the flow can be specified. In order to give a uniform interface to boundary conditions, all variables defining the boundary conditions can be set via signals, too. For variables like pressure where discontinuous boundary conditions are non-physical and lead to nu-merical problems, the input signal is interpreted as the time derivative of that condition. The sample system in Figure 5.10 contains 2 controlled sources and 2 sinks. Thermodynamic reservoirs are also called "infinite reservoirs", because the thermodynamic conditions do not vary over time as mass and energy leave or enter the reservoir.

Chapter 5. The ThermoFluid Library Flow Splitters- and Junctions

Correct modeling of flow splitters and junctions(from now on referred to as T-nodes) for reversible flows in all connecting branches is not difficult conceptually, but there are three different choices of doing it with models from the ThermoFluid library which have implications with respect to numerical robustness and performance. The cases of quasi steady state and dynamic momentum balance differ significantly because a correct modeling of the momentum balance in T-nodes requires a two-dimensional geometry. For quasi steady state flow, the three options are:

A Do not use a dedicated model at all. Instead, simply connect two flow models to the inflow of a volume in the case of a junction and two to the outflow in the case of a splitter. This is the preferred procedure for most cases in system modeling. It works for splitting or joining an arbitrary number of streams, not only two.

B Use a normal control volume with a small, compressible volume and three flow connectors, called Volume3Port .

C Use an idealized control volume with 0 volume and without dynamic states, called Ideal3Port .

Case A is preferable in most cases due to its simplicity. It has only one slight disadvantage which is the consequence of the ideal mixing assump-tions in control volumes and only gives noticeable errors for short periods after flow reversals. For example if a hot liquid is mixed with a cold liquid and the mixture is discharged into a much colder, perfectly mixed control volume, then the temperature at the mixing point after a short flow re-versal is the temperature of the cold control volume. This temperature can be quite different from the mixing temperature. The same potential problem occurs in case C.

Case B is the physically most detailed model and is well suited for mixing of flows. It has one numerical disadvantage: because all other volumes in a system are usually much larger, the system gets very stiff.

For modeling for control it has the additional disadvantage that it adds dynamic states to the overall system. Case B should therefore only be used for detailed modeling of mixing processes.

Case III is the physically most reasonable model when the difference between in the volume in the T-node and other volumes is large. Numeri-cally it may be more difficult to solve in some cases because the pressure in the T-node ends up in a non-linear equation system. The mixing enthalpy is calculated as:

hmix=∀( ˙mi> 0) P

ihim˙i P

im˙i (5.2)

5.8 Component Models

Figure 5.11 Modeling options for T-nodes. Taking advantage of the flow semantics and omitting explicit models is often the best solution. All three cases handle bi-directional flows.

This expression could easily be written directly in Modelica, but in the ThermoFluid library it is assembled symbolically from the equations for reversible flows in the adjacent flow models. It works for all configura-tions of inflow and outflow in any of the connected branches, but it fails numerically if all flows are zero. This can be handled by a simulation tool in a heuristic manner because the denominator goes to zero at the same time by checking for this condition and keeping the value from the previous time step.

T-nodes for dynamic flow are more difficult to model correctly. The problem is to have data for friction losses for all possible flow configura-tions. In the ThermoFluid library there are simple models which neglect the losses in the T-node and add or split the momentum in the same ratio as the mass flows. This is an adequate model for smoothly shaped T-nodes near their design flow conditions.

Turbines and Compressors

Multi-stage turbines and compressors are built up from turbine and com-pressor stage models, as described in Section 4.7 and Section 4.8, and control volumes between them. As an example, consider the schematic in Figure 5.12 showing the high pressure stage and first intermediate pressure stage of a typical steam turbine. There are bleed mass flows to

Chapter 5. The ThermoFluid Library

the pre-heaters between the stages. These flow splits are one reason that makes it numerically advantageous to model the rather small volumes between the stages as real control volumes. The method of modeling tur-bines as a series of stage models and control volumes has a long tradition, see [Traupel, 1977] and [Gašparovi´c and Stapersma, 1973]. It fits natu-rally into the scheme of flow models and volumes used in ThermoFluid.

There is a numerical difficulty associated with this scheme. Taking (4.6) for a constant volume, neglecting the enthalpy derivative and normalizing the variables with their nominal values we get

τT S

p

dt = ˙min− ˙mout, τT S = Vρ V p

h

V

Due to the very small volumes between turbine stages, the time constant τT Sis much smaller than any other time constant in the system and thus

renders the system very stiff. There are two possible remedies:

• set the volumes to zero which eliminates the states and introduces algebraic variables instead or

• make the volumes larger than they are in order to increase the time constants, but keep them small enough so that the mass storage effects in the turbine are still one or two orders of magnitude faster than the time constants of interest.

pCV 3 hin

pin min .

volume 1 volume 2

volume 3

HP − stage mturbine valve

.

mHP − valve .

hCV 1 pCV 1 TCV 1

hCV 2 pCV 2 TCV 2

hCV 3 pCV 3 TCV 3 mHP − stage

.

PHP

m.stage 1

Pstage 1

hCV 3

mpreheat .

hCV 3 pCV 3 mstage 2

.

Figure 5.12 High- and medium pressure parts of a steam turbo group.

The first remedy might seem more logical at first sight because the volumes are a lot smaller than other volumes in the system, but due to the tap-off flows to the pre-heaters and the non-linear turbine mass flow equations a large and difficult to solve non-linear system of equations

5.9 Examples