Decision Making Control Algorithm for Cogeneration Plants in Operating with the Heat Accumulator Deep Analysis Model

. Accurate production planning in both the short and long term is very important in cogeneration plants. Especially if the cogeneration unit operates under free electricity market conditions, which complicates the decision-making process as an additional planning condition with variable heat, fuel, and CO 2 costs. On the other hand, when a cogeneration plant uses a heat accumulation system, it is impossible to make a production decision without using a computer system; the human factor in decision-making can lead to erroneous decisions without traceability. The role of modern computer systems is growing and greatly influences the optimal production planning process in cogeneration plants, regardless of the installed capacity and in the operation with heat accumulation. One of the problems solved by the research is the integration of real operating modes and conditions (applied thermal insulation solution) into the production decision algorithms. The developed methodology allows not only to plan the operating modes of the cogeneration plant, but also to evaluate the efficiency of the battery solution. This study shows the developed methodology for calculating heat loss for a heat accumulator depending on the operating mode and the need to introduce a correction coefficient. When determining the total influencing expenses of the cost model of the heat accumulator operation mode, their mutual influence is shown and integrated into the decision-making algorithm for the next day's free-market conditions. The aim of the algorithm is maximally increasing the total gross revenue threshold for the planning of cogeneration operations and to exclude operating modes that may cause losses.


Introduction
The liberalization of the energy market and the EU's targets for improving energy efficiency in each Member State [1] are contributing to the rapid development of heat accumulation facilities. Accurate production planning is very important in cogeneration plants operating in the free electricity market [2], [3]; besides, the use of heat accumulators increases significantly in terms of both complexity and additional calculation functions. In addition, the production process is affected by variable heat, CO2, and fuel costs [4]. In Latvia, 175 stations produce 75% of heat in cogeneration mode. In 2019, out of the total number of all CHPs, 159 received mandatory purchase (MP) support for electricity production. The 5 largest stations with a capacity of more than 10 MWel received payment for installed capacity, which is the MPC from electricity for consumers. Combined heat and power (CHP) with a capacity of less than 10 MWel, that have received mandatory procurement components (MPC) support, have a total installed electrical capacity of 199.2 MWel.
The total installed capacity of 62 gas, 51 biogas, and 48 biomass CHP ranges from 63.05MWel for biogas to 68.15MWel for biomass. In turn, the installed capacity of the 5 largest electricity CHP receives 1061.90MWW of the installed capacity, which is also included in the MPC [5]. A total of 61 stations [6] out of a total of 164 stations or 37% of the total share will lose support from 2020-2022. Also after 2022, the number of stations, which receive state aid, will decrease, as the guaranteed MP for electricity was provided for a support period of 10-15 years [7]. As a large number of CHP approaches or ends MPC support, it is necessary to refocus on free-market conditions, which means that electricity is not purchased at a guaranteed price rate.
Reorientation to market conditions requires new challenges for CHP operational planning [2], such as next-day weather and heat forecasts [8], or, for instance, the planning of equipment operating costs depending on start-up (cold, warm, hot) conditions [9]. The accuracy of the forecasts influences the heat and power generation regimes of CHP [10] and, consequently, the strategies for determining free-market volumes [11]. An artificial neural network model for heat demand in the district heating network is used for forecasting. In turn, different forecasting models are used for the price of electricityextreme training machines, multilayer perceptrons, automatic ARIMA, and triple exponential smoothing methods [8]. The analysis of historical data contributes to the development and accuracy of these methods and tools. Determining market volumes in the next day market takes place in a short time with a large amount of data input, therefore forecasting tools in combination with multi-stage programming modeling concept methods already provide a reliable result and decision [12], [13]. By acquiring more effective CHP operation decarbonisation is promoted [14] and the use of heat storage (HS) can improve the efficiency of the whole plant [15]. The use of HS as a system element affects the performance of the whole system [8], increases the uncertainty for the efficient use of the equipment if not all criteria, such as losses, are considered [16]. This study proposes a methodology for calculating heat loss for a heat accumulator; and, as a result of experiments, the effect of thermal bridges on a real heat accumulator was tested. The HS was verified and a correction factor was introduced for the calculated theoretical heat losses. The calculation of the impact of electrical and heat loss costs of the HS operating mode included in the cost model has been performed. A decision-making algorithm for cogeneration plants for the free-market conditions of electricity has been developed, which is based on the cost of electricity and a detailed analysis of HS with the included operating cost model. The algorithm serves as the basis for a computer systems planning tool that aims to maximize the total gross revenue limit for the planning of cogeneration operations and to exclude operating modes that may cause losses.
The research object is located in the biomass cogeneration plant at 73A Rūpniecības Street, Jelgava, Latvia, where a HYBEX fluidized bed steam boiler is installed, with a steam output of 26 kg/s at a pressure of Ps = 117 bar, Ts=527 °C from the feed water at 180 °C. The rated capacity of the steam boiler is 77 MW (providing a heat generation capacity of 45 MW and electricity generation capacity of 23 MW) [17]. To increase efficiency, heat accumulation equipment with a capacity of 5000m 3 was installed in this CHP. The efficient operation of the installed heat accumulation system is influenced by factors such as the actual heat capacity, charging, discharging rates, and the ability to determine whether the unit will meet the specified operating mode. The operating mode depends on the flow and return temperatures T1, T2, height of HS thermal wedge with temperature T3. In turn, the operator must also respect, for operation planning, such factors as HS heat loss, which depends on the thermal insulation resistance from the air temperature outside, wind exposure, and electricity consumption in addition to the operation of pumps No. 1, 2, 3, 4 ( Figure 1) to ensure the process and equipment maintenance costs. In addition, when CHP is working in the next day's market, the planning of HS's operations requires an hourly forecast for the next 24 hours, where the prices of electricity, heat, CO2 emissions (if fossil fuels), and fuel are variable in free-market conditions.
The scheme of a biomass cogeneration plant with a heat accumulator is shown in Figure 1. The authors will perform an in-depth analysis of this accumulator in the following sections of this article.  [17] The methodology for calculating heat loss in accumulator operation mode, where the performed experimental method for calculating heat loss allows to confirm the verification of the accumulator is presented in Section 2. In Section 3, the heat accumulator operating mode cost model is discussed. In Section 4 is included the decision-making algorithm using an in-depth analysis of the heat accumulator. The conclusion of the article is available in Section 5.

Methodology of Heat Loss Calculation in Accumulator Operation Mode
The thickness of the thermal insulation and the thermal conductivity of HS affect not only the losses but also the efficiency. Poor thermal insulation causing large heat losses can disrupt stratification within HS and disrupt hot and cold layers [18], [19]. Efficiency is also affected by the shape of the HS, where stratification becomes more pronounced with a higher height-todiameter ratio [20].
Using HS geometric dimensions and enclosure constructions specification from Table 1 data there was made calculation for heat losses at 0 °C air temperature -75 °C flow water (HS hot layer), 47 °C return water (HS cold layer), which corresponds to a real district heating network (DHN) graph. The average temperature in the mixing zone is 60 °C. Typical dimensions are the heat accumulator height -25.86 m and a diameter of 16m. In order to obtain a more reliable result, the  values at the selected heat accumulator operating parameters for both forced and free convection will be calculated.
In Figure 2, the operator control tool for the control of HS operating parameters is shown, where it can be established that the height of the thermal wedge is 1 m. The thermal wedge formed at this point in the operating mode is located in the zone 6.5 m and 7.5 m.

Heat Loss Calculation
In order to be able to determine the HS losses in the operating mode, the calculation methodology in the form of a block diagram, which is shown in Figure 3, was applied. Abbreviations from Appendix are used in Figure 3 and in the remainder of the article.  [25] Using the methodology shown in Figure 3, it is possible to calculate the heat loss in the HS stationary cooling process at the same internal temperature throughout, the volume, and external temperature. In order to be able to calculate the hourly heat loss in the operating mode at different temperatures in the indoor environment zones, an additional methodology was developed, which is shown in Figure 4.

The heat transfer coefficient  is formed by free and forced convection.
Free convection is on both the inner (water) and outer surfaces(air). Forced convection on the outer surface where the wind acts Thermal insulation resistance of a heat accumulator determined by coefficient U U 0 = 1/R '0 , R 0 =R ins +R 1 +R 2 +R n +R out = where Rthermal resistance, W(m2*K) material layer thickness, m; λcoefficient of thermal conductivity of materials, W(m*K); heat transfer coefficient, W/(m 2 *K),

The Use of Experimental Method for Calculation of Heat Loss
The main goal of the experiment is to determine the real heat losses of HS. The obtained results were compared with the theoretically calculated ones, conclusions were made, and a correction factor was introduced. The proportion of thermal bridges in HS will also be determined using thermography and calculation. The experiment is an organized test that will contain measurements for the cooling process of the HS tank from 31.08.2020. until 07.09.2020. During this period, the HS system was completely shut down and no technological activity took place, such as the charging or discharging process, drainage or refilling. The average approximate temperature during the experimental period was +17.09 °C, the average wind speed was 3.14 m/s. Uncontrollable factors that were not taken into account were humidity and exposure to sunlight. An observation period was chosen in which no precipitation was observed that would lead to an additional possibility of error. During this period, a decrease in the HS water temperature was observed at 25 points throughout its height. Figure 5 shows the location on the tank of temperature sensors from T1 to T25

Determining Heat Losses under Real Environmental Conditions
To determine the actual heat losses under real environmental conditions, the HS was divided into 25 separate layers or cylinders with their own volume or zones where temperature sensors with a certain volume were located. The heat losses for each individual layer with volume were determined using the equition: where T1 -starting temperature, °C; T2final temperature, °C; Vwater volume in the measuring zone, m 3 [26]. The total heat losses were obtained by summarizing heat losses of each layer: Q=Qsl.1+ Qsl.2 +Qsl.n+ Qsl. 25 (2)

Determining And Calculation of Thermal Bridges
A thermal bridge is any inclusion element of increased thermal conductivity in a reservoir or may result from the installation of inhomogeneous insulation.
There was calculated the coefficient of heat loss HT (WK -1 ), that indicated losses of energy (W) Where ψthe calculation of thermal transmittance of the linear thermal bridge (Wm -1 K -1 ), li the designed height (m) of linear thermal bridge and Χheat transmittance (WK -1 ) of dot type thermal bridge k calculation [25].
The two-dimensional thermal bridges of the constructions were modulated and calculated using the Lawrence Berkely National Laboratory software THERM established in the USA in accordance with the criteria set by LVS EN ISO 10211 [27]. Using the THERM simulation calculation software, it allows classification as a high-precision method with an accuracy of ± 5% [28].
In Figure 7 illustrates performed simulation using Therm program for cotton wool mounting nails. In total, this HS has 7800 such cotton wool mounting nails, which together make 650.08 W of heat flow under the experimental conditions. The nails of the thermal insulation fastening, on the one hand, help to keep the thermal insulation homogeneous (no deposits, air cavities are formed, which can also cause a thermal bridge), but, on the other hand, the nails themselves form thermal bridges.
In Figure 8 there can be seen thermal bridges under construction and after commissioning. During the determination of the thermal bridges the mains water with a temperature of 75.3 °C was located in the accumulator, and it can be seen that the outlet of the vacuum valve connection with the flange reaches 62.3 °C. Figure 8 on the right shows a thermal bridge for an uninsulated heat accumulator base.
The total effect of thermal bridges was 3.44 kW HS under modulation (experimental) conditions (Table 2). The analysis showed that the thermal bridges to be preventable or reduced were 655.02 W out of 3440.01 W or 19% of the total share. The use of such a methodology allows to evaluate and reduce the impact of thermal bridges by making additional investments.

Verification of Heat Loss of Heat Accumulator
The obtained data allow to evaluate the accuracy of the calculation against real experimental values and to introduce a correction coefficient. By verifying the HS tank in this way, in further operating modes, it is possible to accurately predict heat losses and costs.
Theoretical heat losses were calculated according to the methodology represented in Figure 3 under the experimental environmental conditions (The average approximate temperature during the experimental period was +17.09 °C, the average wind speed was 3.14 m/s, the temperature corresponded to the graph of HS represented in Figure 5).
Theoretical heat losses for this period were calculated to determine the ncorrection coefficient.
According to this formula, the results were compared with each other Qteor, Qteor+Qter,til, Qeksp Figure 9 shows a comparison of 3 different options of the HS battery, where the first bar is the experimentally obtained value of 12.71 kW.
The second bar is the value obtained during the theoretical calculation of 7.59 kW without taking into account the thermal bridges. The result obtained during the theoretical calculations is 40.25% lower if it is assumed that the thermal insulation is homogeneous and does not contain thermal bridges. The third bar shows the theoretical calculation, which includes the specified thermal bridges. 11.09 kW was obtained, which is 12.94% of the experimental result.

Results of The Heat Loss Calculation of The Heat Accumulator
When performing heat loss calculation for HS operating mode with operating temperatures represented in Figure 2 and applying the methodology shown in Figures 3 and 4, a graph of the calculated and actual heat loss with the correction coefficient was obtained that is represented in Figure 10. From the graph in Figure 10 it can be seen that, as the result of full charging and discharging of the HS, the actual heat loss is 438,84 kWh

Heat Accumulator Operation Mode Cost Model
The use of a heat accumulator must not impair the overall efficiency of the CHP [29] that is why revenue Re CHP <(Re CHP +Re HS -(Call costs expenses for provision of the process)). The main costs in this model are electricity, heat loss, and maintenance and repair, which are expressed by the equation: With respect to the methodology developed by the authors for calculating heat loss shown in Section 2, where the heat loss of 438,84 kWh was obtained, the heat loss is determined as: where Ppower, kWh; hnumber of working hours. Analyzing HS operation in maximum mode for 12 hours charging and 12 discharge modes, it can be statted that:

Decision-Making Algorithm Using Deep Analysis of Heat Accumulator
The goal is to be able to accept the most accurate result for participation in the free electricity market in the shortest possible period (for instance, the Nord Pool daily market, where supply and demand bids for the next day must be placed no later than 12:00 on the current day) [30]. During this period, it is necessary to be able to process a large amount of data, such as the next day's heat load forecasts and the operation of the CHP, changes in the price of electricity, and, in the case of HS, its performance parameters. At this point, if not all circumstances are respected, then there may be a case where CHP's operation with HS may not produce the best result, or even can cause a loss. With changing and stochastic external factors, such as heat load and the market price of electricity [31], it is almost impossible to achieve perfect planning of cogeneration regimes for the next day, but this goal can be approximated using different methodologies. There are several ways to achieve more flexible operation of cogeneration plants under market conditions [26], one of which is the use of a HS [32]. In addition, planning the coherent operation of a cogeneration unit with the HS can increase efficiency, but complicates the planning task [33]. The aim of a cogeneration plant with multi-level heat storage control is to obtain the maximum positive result by quickly excluding those operating scenarios in which the operation of the CHP with HS is not technically or economically feasible.
This algorithm consists of a multi-level system with the main 5 block calculation modules, which have their own input data, but each of them can interact with others with its own functional output or result ( Figure 11). When all functions are exited, the cases of CHP operation with HS are filtered out, if they are effective or not. In addition, it is possible that as a result of entering the input data in one of these blocks, the outcome immediately shows that the use of HS is not applicable.
In order to achieve the most efficient result, it was necessary to develop a decision-making algorithm, where it was necessary to combine these separate processes into a single one. The developed algorithm consists of the following five large basic block modules, which define the main processes: 1. Electricity first cost calculation moduleone of the key indicators for starting into a free-market, is accurate calculation of the current first cost of produced electricity [34], which is influenced by such variable factors as fuel costs, the cost of heat production against the selling price, as well as the CO2 emission stock market factor, if the plant does not use renewable fuels. In addition, the availability of equipment and operational risks are determined in this block. 2. The electricity calculation module determines the next day's electricity price forecasts. In the market price calculation, the maximum and minimum average price periods of electricity are analyzed and searched for and compared with the average cost price of electricity. In addition, many studies use analysis of historical data to help plan for a longer period of time [8]. 3. The heat load calculation module provides an accurate heat load forecast for each hour [35] 24 hours ahead, which significantly affects the entire production planning process. As a result of an inaccurate forecast, the heat accumulator may be precharged prematurely and by continuing production it would no longer be possible to store excess heat, and this fact, thus, would reduce production capacity. Or there may be a situation where the HS has not yet been discharged at the start of the new stock exchange cycle. Again, production would not take place at the declared capacity. 4. Cogeneration operating mode is a technical one in which, depending on the ratio of heat and electricity energy and the flexibility of the generation blocks, a calculation has to be made in order to decide on the start of production. In addition, the start-up and shut-down conditions of the cogeneration unit and the range of production capacity during the day must be taken into account, which may damage the technical components of the plant [29]. In addition, the conditions and costs of starting and stopping the CHP installation must be respected [9]. 5. The heat accumulator calculation module concerns the technical parameters of heat accumulation such as heat capacity, charging and discharging capacity, heat loss, electrical, and other technical parameters. The availability of equipment for the accumulation system is very important.  Figure 11, a multi-level Euclidean block diagram decision-making algorithm of CHP operating with HS was developed, by using factors Decision making algorithm 2. Next day market electricity prices and peak period calculation

HS calculation of parameters and modes
Output: Produce electricity is not economically viable Output: HS will be efficient and profitable shown in Figure 12. Figures 11 and 12 complement each other, where in Figure 11 the main input data and 4 output functions are displayed. In turn, Figure 12 shows the calculation sequence and influencing factors of Yes/No output functions. In Figure 12, the main emphasis of the algorithm is on the inclusion of the data of the in-depth analysis of the HS, as a result of which the operating costs of the CHP are specified in order to exclude such operating modes that would cause losses in the operation of the HS. To get a positive result, where the use of HS will be efficient and profitable, a 12-position filter must be passed. The algorithm can also lead to the following results: CHP operation without a HS, CHP operation only for self-consumption electricity production, and to produce 1.

7.
Is HS available 8. HS heat capacity forecast (Q foresc.HS -Q hs_actua )> charge/discharge (P char(forecasted) xh-P disch(forecasted) xh) 9. electricity is not economically viable. At the initial starting position, the availability of CHP equipment must be assessed. In addition, it is necessary to identify the risks if the technical condition does not pose a hazard that will affect the production process [13]. The block diagram in Figure 12 can be divided into 12 basic blocks (points) that describe the necessary relationships that influence decision making. Each block can be described with functions and sub-functions executable by a software tool:

HS is not efficient, cogeneration modes without HS
1. The starting position begins with the calculation of the cost of electricity production (Cpp el). Production costs are affected by many factors, such as CO2 stock prices, heat tariffs, cogeneration efficiency, fuel and personnel costs, and other factors [10].
2. The availability of CHP equipment must be assessed in this block. In addition, it is necessary to identify the risks if the technical condition does not pose a hazard that will affect the production process [13].
3. Initially, the market price of electricity must be forecasted for the whole period of the day and compared with the production costs. This step determines whether the market price of electricity per hour is higher than the cost of electricity production: Cmp el nh>Cpp (9) If the cost of electricity generation Cpp el is higher than the daily forecast, then it is not effective to use the HS for revenue generation. A situation may arise where the operation of the CHP is economically inefficient or possible only to cover the needs of the CHP for own consumption. In addition, it must be taken into account whether the technological minimum capacity of the generator corresponds to self-consumption and the purchased electricity from the network is cheaper than the cost price of the produced one. 4. In a situation where the price in the next day's electricity market is equal to or almost equal to the average market price for the entire 24-hour period, the operation of the HS equipment is inefficient and its charging and discharging will be unfavorable due to heat and electricity losses: ̅̅̅̅̅̅̅̅̅ ≠ Cmp1h ≈Cmpnh≈ Cmp24h (10) In this case, the result is obtained that the operation of the CHP should be organized without a HS. 5. Calculates the best average stock market price over a period of time above the electricity production price ̅̅̅̅̅̅̅̅̅ best max period ̅̅̅̅̅̅̅̅̅ bestmax.period=(Cmp1h+Cmp2h+Cmpnh)/nh (11) This function determines the best period during which the operation of the CHP under market conditions can bring the highest income in the operation of both the CHP and the CHP with HS. 6. In addition to the electricity market price, it is important to forecast also the next day's heating demand before deciding whether the heat storage operation could be profitable. Accurate heat load forecasting has a significant impact on the entire production planning process. It is very important to forecast the heat load for every hour for the next 24 hours and to determine the flow and return temperatures of the network. This is due to the period announced by the stock market for the next day at 12:00 on the current day [30]. This means that as a result of an inaccurate forecast, the heat accumulator may be prematurely charged, then there will be nowhere to utilize the heat produced and the cogeneration production capacity will have to be reduced. It may also be the case that if all the energy from the HS is not discharged during the low hours of the electricity market, the next reported cycle will not produce the requested capacity, where at a good electricity stock price there will not only ungenerated revenue, but also compensation must be paid in case of not produced large quantities [30]. 7. In case the forecasted heat load corresponds to the maximum capacity of the CHP or is higher, then the cogeneration block can be loaded in the desired mode in the maximum market price range and it is not expedient to use its HS for profit generation.
8. Depending on the heat and electricity production ratio and the flexibility of the production blocks, a calculation has to be made to decide on the operating hours of the CHP per hour. In addition, the conditions for starting (cold, warm, and hot), increasing or decreasing the capacity of the cogeneration unit should as well be taken into account in ideal situation [12]. This block also determines the need for self-consuming Psc electrical energy to ensure the process. 9. In this block, two revenue figures Pr el are defined, where the maximum revenue for CHP operation without the HS and Prhs, where the CHP operates with the HS.
10. The availability of HS equipment must be assessed in this block. In addition, it is necessary to identify the risks if the technical condition does not pose a hazard that will affect the production process [36]. 11. In this block, a calculation is made if the remaining heat in the HS and the forecasted CHP mode with the produced additional heat will ensure the charging of the HS and later the maximum discharge. It can vary depending on the forecast heating network temperature schedule. It may be that the heat capacity of the HS does not allow to perform the storage of all heat generated in the electricity production mode, or, if all the heat in the accumulator is not used in night mode, additional calculation is required for CHP operation to adapt the mode to the current and forecasted HS situation.
12. In this block, the costs of the HS operating modes performed in Section 3 are applied and deducted from the total revenue. Only the income from the CHP is compared, with the losses from the CHP with HS. The output function is that the operation of the HS is effective, or that the losses account for a larger share than the revenue, then the operation of the CHP without the HS is recommended.

Conclusions
The research was conducted in Latvia, where 75% of heat is produced by 175 cogeneration plants, of which, in 2019, 159 received MP support for electricity production, but the 5 largest plants charged more than 10 MW of installed capacity, which created MPC for consumers at the expense of electricity. Research shows that 61 cogeneration plants will have to adapt to the free electricity market in the coming years due to the expiry of state aid, which was provided for a support period of 10 to 15 years. Many of these stations will have to find a way to change in order to operate efficiently in free-market conditions. The decision-making algorithm proposed by the author for the operation of a cogeneration plant with a heat accumulator can initially show the production planning mechanisms in the free electricity market.
The methodology developed by the authors allows to determine the heat loss in different operating modes of HS. Each HS requires verification and, depending on the number of thermal bridges, a correction factor needs to be introduced. The effect of thermal bridges on the studied HS during the experiment was determined and a correction factor of 1.4 was introduced.
During the in-depth analysis of the HS by researching its operating mode costs model, it was concluded that the largest costs are accounted for electricity costs, where 3.355 MWh of electric current was consumed in the considered HS operation. Heat losses, on the other hand, amounted to 0.438,84MWh.
To increase the overall efficiency of the CHP, the proposed production decision-making algorithm for CHP in operation with HS (12 functional blocks) allow to, in a short time, make an economically and technologically justified decision by excluding such operating modes that may cause losses in the free electricity market, where the production decision must be made from 10:00 to 12:00. The algorithm offers 4 output states or results for CHP operation with HS, CHP operation without HS, CHP operation for self-consumption, and when the electricity production is unprofitable.
The proposed production decision-making algorithm in CHP operation with HS can be reduced from 12 to 9 blocks by blocking the calculation of HS parameters and operating modes. In this case, the algorithm is applicable to CHP production planning without heat accumulation, which would always allow to choose the most efficient and economically justified decision in free electricity market.
Implementing the model of in-depth analysis of heat accumulation and using input data such as weather, heat forecast and CHP operating mode forecasts would enable accurate and economically justified decision making for different operating modes. In further research it is possible to study the application of phase change (PCM) or thermochemical accumulators and to adapt the algorithm, as well as to compare historical data on made decisions with current data.