**5. Mathematical modelling**

In training simulators, the mathematical models must be able to reproduce, in a dynamic way, the behaviour of the power plant in any feasible operation, this includes: steady states from cold iron up to full-load generation, and transients states, as a part of operation itself or because of malfunctions. The better way of accomplishing this is using physical modelling techniques, where the conservation of mass, momentum and energy are always fulfilled.

### **5.1 The procedural approach**

The focus of procedural programming is to break down a programming task into a collection of variables, data structures and subroutines. EPRI (1983) published in 1983 an approach named Modular Modelling System (MMS), which provided an economical and accurate computer code for the dynamic simulation of fossil and nuclear power plants. Some of the most important uses of the MMS were: evaluation of plant design, checkout of control systems, operational procedures development, diagnosis of plant performance and training simulator qualification. MMS is based on the methodology of resistive and capacitive components or combinations of them depending of which variables are transmitted between adjacent modules (causality). According to this theory, resistive components are related with the simulation of the elements which involve a pressure variation in the process (valves, pumps, etc) and the storage of mass and energy are neglected. Usually, the behaviour of the resistive elements is represented by algebraic nonlinear equations. For instance, in the case of a valve for incompressible fluid, the equation to calculate the flow is obtained from the steady state momentum equation and it is:

 Carrying out a complete installation of the software (e.g. operating system, graphic packages, real-time executive, instructor console, mathematical models, etc). In the case of the real-time executive, instructor console and mathematical models, a good practice is carrying out a complete compilation and rebuilding all solution projects with the aim

Validating each one of the functions of the instructor console and the operator HMI,

 Carrying out availability tests with no aborts in any simulator task. This includes a continuous simulation for time periods of at least eight hours with a minimum

 Carrying out operative tests from cold iron to full-load generation, shutdown operations and malfunctions. The operative tests must be well documented with their specific objectives and the expected results for each one of the operative manoeuvres. The application of the acceptance procedures and the documentation of the found discrepancies are key elements in the final tuning of the simulator, before it can be

The general requirements of fossil fuel power plant simulators are well defined by the Instrument Society of America (ISA) and the Electric Power Research Institute (EPRI). These entities provide extensive guides related to the design, development, fabrication, performance, testing, training, documentation and installation of power plant simulators.

In training simulators, the mathematical models must be able to reproduce, in a dynamic way, the behaviour of the power plant in any feasible operation, this includes: steady states from cold iron up to full-load generation, and transients states, as a part of operation itself or because of malfunctions. The better way of accomplishing this is using physical modelling techniques, where the conservation of mass, momentum and energy are always fulfilled.

The focus of procedural programming is to break down a programming task into a collection of variables, data structures and subroutines. EPRI (1983) published in 1983 an approach named Modular Modelling System (MMS), which provided an economical and accurate computer code for the dynamic simulation of fossil and nuclear power plants. Some of the most important uses of the MMS were: evaluation of plant design, checkout of control systems, operational procedures development, diagnosis of plant performance and training simulator qualification. MMS is based on the methodology of resistive and capacitive components or combinations of them depending of which variables are transmitted between adjacent modules (causality). According to this theory, resistive components are related with the simulation of the elements which involve a pressure variation in the process (valves, pumps, etc) and the storage of mass and energy are neglected. Usually, the behaviour of the resistive elements is represented by algebraic nonlinear equations. For instance, in the case of a valve for incompressible fluid, the equation to

calculate the flow is obtained from the steady state momentum equation and it is:

of guarantying a full compatibility between the source and executable codes. Verifying the communication among the stations of the local area network.

according to their corresponding specifications.

availability of 95 %.

released for its commercial use.

**5. Mathematical modelling** 

**5.1 The procedural approach** 

$$\mathbf{w} = K \, A \mathbf{p} \sqrt{\rho (P\_l - P\_o)} \tag{1}$$

where: *w* is the flow, *K* is the valve conductance, *Ap* is the valve position, *ρ* is the density, *Pi* and *Po* are the inlet and outlet pressures.

In the case of elements like pumps and fans, an approach based in the operation curves of the actual equipment is preferred because it gives a complete representation of the flowpressure behaviour to any operation speed. For instance, in the case of a centrifugal pump, from the nominal data of the head-volumetric flow rate curve (H vs. q), the application of a least squares fitting gives the following expression:

$$
\Delta H = a + b \neq c \neq^2 \tag{2}
$$

where: *∆H* is the head developed by the pump, *q* is the volumetric flow rate and a*, b, c* are the coefficients obtained from the least squares fitting. The application of the pump affinity laws and the relationship for the developed head transforms the former equation in another one in terms of the flow, discharge pressure and pump speed, which is more suitable for the simulation.

$$P\_o - P\_l = A\,\rho\Omega^2 + B\,\Omega\,\text{w} + \mathcal{C}\,\frac{\text{w}^2}{\rho} \tag{3}$$

where: *w* is the flow, *Pi* and *Po* are the inlet and outlet pressures, *ρ* is the density, *Ω* is the angular speed and *A, B, C* are the transformed coefficients depending on pump nominal data.

On the other hand, capacitive elements are those which have a storage effect in the process (tanks, metal walls, etc). In this case the equations of the element are based on the lumped parameters approach; this approach simplifies the description of the behaviour of spatially distributed physical systems into a topology consisting of discrete entities that approximate the behaviour of the distributed system under certain assumptions, e.g. perfect mixing, which assumes that there are no spatial gradients in a given physical envelope, so the outlet stream has the same conditions of the fluid inside a control volume. In this way, to model a tank of constant volume with a single-phase fluid, the mass conservation equation yields:

$$\frac{d\rho}{dt} = \frac{w\_i - w\_o}{V}; \quad \left.\rho\right|\_{t=0} = \left.\rho\_0\right|\tag{4}$$

where *ρ* is the density, *t* is the time, *wi and w*o are the inlet and outlet flows and V is the volume. The energy conservation equation with no work is expressed as:

$$\frac{d\mathcal{L}I}{dt} = \left.w\_i h\_i - w\_o h + Q \right. \quad ; \quad \left.\mathcal{U}\right|\_{t=0} = \mathcal{U}\_0 \tag{5}$$

where *U* is the total internal energy, *hi* and *h* are the inlet and outlet enthalpies and *Q* is the heat flow rate. For an incompressible fluid, the internal energy is equal to its enthalpy, and with the assumption of perfect mixing, equation (5) is transformed in:

$$\frac{dh}{dt} = \frac{w\_i \left(h\_i - h\right) + Q}{\rho V} \; ; \quad h\big|\_{t=0} = h\_0 \tag{6}$$

Fossil Fuel Power Plant Simulators for Operator Training 113

with the system to simulate (Murthy, 1986). This kind of languages use common procedural languages, such as FORTRAN or C, in this way, the whole system model is a collection of procedure calls and the assembling and connecting of the various components of a large system is performed through a sequence of elementary commands merely specifying the desired topological connections between modules. The language automatically translates these orders into equivalent FORTRAN or C statements and aligns a consistent set of variables names to all quantities transmitted from one module to another. The language organizes the order in which the equations are solved in order to satisfy causality. In other words, all model representations are translated into C or FORTRAN language source code for compilation and execution, with the aim of ensuring a fast performance. The current version of ACSL available

Due to the industry of training simulators grew during the 80´s and a big expense was done to create it, each one of the simulators builders have their own mathematical models libraries, and it is common to find that the core of installed simulators still have their

The Object-Oriented Programming (OOP) is based on to divide a programming task into objects where each one of these objects encapsulates its own data and methods (procedures associated with a class). The most important distinction regarding Procedural Programming (PP) is that this one uses procedures to operate on data structures, whereas the OOP uses procedures and data structures together. In object-oriented modelling, the objects are packages of data and functionalities and the methods can be sent to these objects rather than data only, as in PP. The main disadvantage of OOP compared with the PP is that the last one has a faster execution, which in real-time applications is an essential issue, in past decades, due to restrictions of memory and processing capacity, this arose as a serious problem, but nowadays, with the available computing power, the OOP is a

Leva and Maffezzoni (2003) establish some paradigms of the OOP in mathematical modelling; one of the most important is the definition of physical ports as the standard interface to connect a certain component model. In this way, an object is the mathematical model of a power plant component (e.g. valve, pump, etc) and the integration of these objects reflects the physical plant layout. The interactions among the components are satisfied with the flow information of the connectors, which are also related with the physical connections. Figure 13 describes these concepts, each one of the icons represents a physical component and according to this, it has defined their suitable communication ports (small coloured squares). The lines between two icons are equivalents to the actual

Although it is not destined to serve as a platform to develop training simulators, Modelica (Modelica, 2011) is representative of this kind of technologies. Modelica is a nonproprietary, object-oriented, equation based language to conveniently model complex physical systems containing, e.g., mechanical, electrical, electronic, hydraulic, thermal, control, electric power or process-oriented subcomponents. Therefore, Modelica is a modelling language rather than a true programming language. The Modelica classes are not compiled in the usual sense, but are translated into objects which are then executed by

for PC keeps its basis on FORTRAN and C languages (acslX, 2010).

**5.2 The object oriented approach** 

a simulation engine.

feasible alternative to develop training simulators.

physical connections. Table 2 shows some connector types.

mathematical models running in modern versions of FORTRAN compilers.

the heat flow rate can be evaluated as:

$$Q = jA \left( T\_w - T \right) \tag{7}$$

where *A* is the area of the heat-transfer surface, *Tw* is the wall temperature, *T* is the fluid temperature and *j* is the heat transfer coefficient. In the previous equations, there are the following types of variables:


Many times the conservation equations do not give, in a straight way, the information required for the simulated control elements or for the operator HMI, therefore, it is necessary to introduce additional expressions to transform the Equations (4) and (6) in terms of measurable variables like liquid height (L) and temperature (T). This can be easily made with the definitions of density and heat capacity at constant pressure (Cp) and considering a tank with constant cross-sectional (ܽ), the result is:

$$\frac{dL}{dt} = \frac{w\_i - w\_o}{\rho \ a}; \quad L\big|\_{t=0} = \big|\quad\tag{8}$$

$$\frac{dT}{dt} = \frac{w\_i \left(h\_i - \text{Cp } T\right) + \text{Q}}{\rho \text{ } V \text{ } \text{Cp}} \; ; \quad \left. T \right|\_{t=0} = \left. T\_0 \right| \tag{9}$$

for the deduction of the former equations it is assumed that density and heat capacity are constants in the validity range of the model.

In their original version, the use of the MMS requires a simulation language like EASY-5 and ACSL, which are in charge of gathering, sorting and solving all the equations related

where *A* is the area of the heat-transfer surface, *Tw* is the wall temperature, *T* is the fluid temperature and *j* is the heat transfer coefficient. In the previous equations, there are the

 System states. They are the independent variables of the model and they will establish the operation state of the simulator at any time. In the tank model, these variables are *ρ* and *h*, which are related with the solution of their ordinary differential equations. Initial guess for iterative methods. They are the variables related with the solution of algebraic equations (mainly non-linear) which requires an initial guess to converge to their solution. In the case of a single valve (Equation 1) this cannot be required, but in a complete system of a simulator, e.g. the feed water system for a combined cycle power plant, which have more than 30 valves, 4 pumps, and several pipe fittings, the solution turns more complicated, and usually the problem will be based on the solution of a

 Fluid properties calculations. In the simulation of power plants, the calculation of thermodynamic properties of the water (liquid and steam) is essential for a accurate representation of the phenomena occurred in the power plant. This calculation includes the evaluation of densities, enthalpies, entropies, viscosities, etc. The calculation of

 Design data of equipment. The physical size and nominal operation data of the actual equipment are very important because they determine the dynamic response of the simulator. For instance, this type of data includes: nominal flow rates, size and type of

Empirical functions. These calculations are related with the use of empirical functions

Many times the conservation equations do not give, in a straight way, the information required for the simulated control elements or for the operator HMI, therefore, it is necessary to introduce additional expressions to transform the Equations (4) and (6) in terms of measurable variables like liquid height (L) and temperature (T). This can be easily made with the definitions of density and heat capacity at constant pressure (Cp) and considering a

> <sup>0</sup> <sup>0</sup> ; *i o t*

;

(8)

0 0

(9)

*t*

*dL w w L L*

*dT w h Cp T Q T T*

for the deduction of the former equations it is assumed that density and heat capacity are

In their original version, the use of the MMS requires a simulation language like EASY-5 and ACSL, which are in charge of gathering, sorting and solving all the equations related

*dt a* 

*i i*

*dt V Cp* 

properties for lubricating oil, fuel, combustion gas and air are also required.

available in the literature like heat transfer coefficients and friction factors.

valves; operation curves of pumps and geometry of tanks.

( ) *Q jA T T <sup>w</sup>* (7)

the heat flow rate can be evaluated as:

simultaneous system of nonlinear equations.

tank with constant cross-sectional (ܽ), the result is:

constants in the validity range of the model.

following types of variables:

with the system to simulate (Murthy, 1986). This kind of languages use common procedural languages, such as FORTRAN or C, in this way, the whole system model is a collection of procedure calls and the assembling and connecting of the various components of a large system is performed through a sequence of elementary commands merely specifying the desired topological connections between modules. The language automatically translates these orders into equivalent FORTRAN or C statements and aligns a consistent set of variables names to all quantities transmitted from one module to another. The language organizes the order in which the equations are solved in order to satisfy causality. In other words, all model representations are translated into C or FORTRAN language source code for compilation and execution, with the aim of ensuring a fast performance. The current version of ACSL available for PC keeps its basis on FORTRAN and C languages (acslX, 2010).

Due to the industry of training simulators grew during the 80´s and a big expense was done to create it, each one of the simulators builders have their own mathematical models libraries, and it is common to find that the core of installed simulators still have their mathematical models running in modern versions of FORTRAN compilers.
