In other cases, hot oil is directly stored in a tank (thermocline). Thermal stratification of the oil in the tank allows energy to be stored at different temperatures. As an example, in the ACUREX field, the storage tank is connected to the solar field and to the PCS by means of two pipe circuits placed at the top and bottom of the tank (see Fig. 8.1). The heated oil stored in the tank is used to generate the steam needed to drive the steam turbine of the PCS.
The storage system can be used in different modes; the first mode of operation is only used when there is not enough solar radiation, then hot oil is taken from the tank to the steam generator. The second mode of operation is useful when there are large variations in solar radiation due to clouds and the storage tank is used to smooth down the oil temperature disturbances. The power conversion system is run using the thermal energy stored inside the tank together with the solar field, but the oil from the field is sent to the bottom of the tank. This is done in order to avoid temperature fluctuations at the top of the tank. The third mode of operation is used when the level of solar radiation is high enough; then the oil from the field is sent to the top of the tank to be used by the PCS. The lower part of Fig. 8.1 shows a detailed description of the geometric characteristics of the tank. Note how the oil entrance and exit contain several diffusers used to avoid disturbances in the oil stratification. Furthermore, the position of the thermocouples in the oil and in the wall of the tank is shown in the figure. These thermocouples provide temperature measurements that can be used in the identification part of the modeling procedure.
A grey-box model for the storage tank of the ACUREX field was developed in . The grey-box approach for building models  stems from the fact that it is best to take advantage of the a priori knowledge of a system. This knowledge is usually expressed in terms of a set of ordinary or partial differential equations obtained from first principles. For some systems such equations are not completely known and data have to be used to fill in the gap via an identification procedure.
A simultaneous perturbation stochastic approximation (SPSA) optimization procedure was used in  to adjust the parameters of the model to the observed data. The SPSA algorithm  provides an estimation of the gradient of an objective function to be optimized, making it appropriate for high-dimensional optimization problems. An interesting feature is that SPSA can be used in situations where the objective function is contaminated by noise. Furthermore, the gradient approximation is deliberately different from the alleged true gradient and this provides a means of escape from local minima while retaining the desired local convergence property. In the present case, the objective function is a measure of the simulation error given by the model.
Model Structure The model structure for the thermal storage tank corresponds to a discrete-time set of first order equations . This structure has been chosen to achieve the main goals set for the model:
• Long term prediction capabilities that allow it to be used in the upper layer of a hierarchical control strategy.
• Adequate representation of the distributed energy content of the tank. The PCS does not operate in the same conditions for the whole range of temperatures resulting from stratification. For this reason, the model must reflect the temperature gradient and its changes during charge or usage periods.
• Low computational load during its use in simulation. In this way optimization in the upper layer of the hierarchical controller can be run frequently and in enough depth to provide a quasi-optimum solution in different scenarios.
• Low dependence on the sample time in order to be able to use historical data coming from different experiments.
• Good convergence capabilities in order to diminish the influence of a partially known or noise corrupted initial state.
The basic principles acting on a storage tank are heat and mass transfer laws; Thus, a first principle model seems a good choice. However, it is a well known fact that some parameters such as heat transfer coefficients among interfaces are difficult to measure. This is specially true for systems whose distributed nature cannot be overlooked which is the case of the storage tank, since stratification of temperatures along the vertical direction affects the spatial distribution of the oil parameters. Even in this case, a set of partial differential equations adequately adjusted to the particularities of the tank will yield an excellent model. Unfortunately, the computational load of running such a model in the many simulations needed for the hierarchical control scheme completely rules out this choice. Traditional grey-box approaches assume that the structure of the model is given directly as a parameterized mathematical function partly based on physical principles. In the present case a computer program or algorithm serves as well for the same purpose and has the advantage of being directly the same object later used by the hierarchical controller.
In the remainder of the section the a priori knowledge is presented together with a spatial discretization to produce a simulation algorithm that is in fact the model of the tank.
Spatial discretization: For purposes of modeling the oil and wall of the tank will be divided into sections to form control volumes and control annular sections, respectively. This spatial discretization will follow the particular arrangement of thermocouples along a vertical rod placed inside the tank, yielding ten oil volumes. The thermocouples of the wall are located at different heights and their number is different (20 instead of 10). To match the temperature measurements on the wall with the temperatures of the discrete annular sections a simple interpolation procedure was used . The inset in Fig. 8.1 shows a diagram of the oil volumes and wall annular sections considered. The geometric parameters are the interior diameter Dst, the wall thickness tst and the height hst which is the same for all volumes except the lower and upper ones. Other geometrical features such as surfaces can be obtained from the above parameters.
Heat transfer models: For each volume a number of models are considered to describe the heat transfer. A simplifying assumption is that conditions (i. e. temperature Of, density pf and specific heat cf of oil on a given volume are homoge
neous). This introduces a source of error in the model since the temperature profile can be very steep, causing conditions within one volume to vary appreciably from bottom to top. This is unavoidable since there are no other measurements than those provided by the thermocouples. In the following the different models are introduced :
• Transport. During operation oil moves along control volumes causing changes in their energy content. The different modes of operation: charge of the tank with hot oil from the field, simultaneous charge and discharge and discharge with or without recirculation of oil cause different values of the net flow through the tank. A flow q is considered to be positive when it goes from top to bottom which is the normal situation during charge of the tank.
• Conduction. The energy flow between adjacent oil volumes and between adjacent wall segments due to conduction is modeled in the usual way as a linear function of the temperature increment. The distances among volumes centers are known and depend on the particular disposition of thermocouples. The thermal conductivity kf of oil is computed from tables using the average temperature of the volume 0°. For the wall section the thermal conductivity is considered constant.
• Convection. The convection mechanism is the trickiest in this model. It is difficult to model since it involves effects such as turbulence. The detailed modeling of such phenomenon is absolutely out of the question due to the limitations imposed on the computing load for the final model. The effects produced by convection are, however, easy to describe: when hot oil enters the bottom of the tank there is a quick mix with the cooler layers above that homogenizes the temperature profile very efficiently. From this observation the energy variation in the volumes due to convection is modeled using: (i) a coefficient that determines the amount of energy that the recirculating flow of hot oil from the collectors yields to the tank and (ii) a set of equations that ensure that this energy is efficiently distributed over the layers above. In this way the simplicity of the model is kept while producing a mechanism that performs well.
Simulation algorithm: The simulation algorithm is based in computing the changes in temperature over time for each oil volume (0f) and wall segment (0lm). The transition from a generic discrete time k to the next (k + 1) is governed by the above described heat transfer mechanisms. For each volume i = 1,…, 10 the energy change due to transport (AE*), conduction among oil volumes (AEco), conduction among wall segments (AEcm), convection (AEv), losses from oil to wall (AEw) and from wall to the ambient (AEa) is computed yielding a pair of discrete-time equations:
The sampling time Ts = 120 s has been selected to provide a good balance between representation of the observed behavior of the temperatures of the volumes and the computational load that it will imply for the simulation. The volume of the discrete
elements of oil (Vf) and metal (V^) are computed from geometrical parameters. In  the complete model adjustment is explained using the SPSA algorithm, showing experimental results.