The scope of this work is motivated by the large number of solar heaters recently installed by the government in joint housing developments for the low-income population in Brazil, the technical challenges inherent in deploying domestic hot water systems, and innovative new models of sustainability technology being developed in Brazil. Computational algorithms were developed to establish the criteria for optimization, such as minimizing the required recycling, the energy consumption in pumping, and the diameter of the pipes in the secondary circuit of the distribution network. The numerical method adopted, the conjugate gradient method combined with a genetic algorithm, has exhibited a very satisfactory degree of convergence, even though high-oscillation amplitudes were observed, which are attributed to slight variations in the pipe diameters (commercial).

## Introduction

By the year 2000, there were approximately 400 solar heating systems installed in social interest housing in Brazil. By 2001, there were already 625 installed systems, and approximately 2100 systems were installed per year in the ensuing years. Many of these systems were installed in low-income communities by the electric power companies. The number of low-income households serviced by solar heating systems is expected to increase further in the coming years. In 2000, a project coordinated by the Study Group on Energy at the Catholic University of Minas Gerais, Brazil installed solar systems in 100 houses in the Sapucaias neighborhood of Contagem/Minas Gerais and monitored them for 5 years. Compared to systems that work only with electricity for water heating, the average electric power consumption savings observed in the monitored houses was 36.4%, and the monetary savings exceeded 50% of the energy bill in some households [1]. Given the technical challenges of equipment installation, maintenance, and even the sale of some systems by community residents, the proposal is an unprecedented project in Brazil, aiming to identify the critical variables of a domestic hot water system (DHWS) through the development of an optimized mathematical model. The study aims to establish the minimum standards for hot water supply to low-income houses, develop optimized systems of hot water distribution, develop programs and applications for control and design of the facilities, and possibly build a monitored DHWS unit in a place of strategic interest in the state of Minas Gerais, Brazil, while also solving the technical difficulties of today's solar heating systems in low-income houses.

## Bibliographic Review

Several parameters influence the performance and feasibility of district heating systems and DHWS. Several authors, mentioned below, have studied the modeling and optimization of these systems.

Pulido-Calvo et al. [2] studied how to select the best combination of tube diameters in a water distribution network for a fish farm. Fraisse et al. [3] compared various optimization criteria for a solar domestic hot water system. Cho et al. [4] showed that optimization of combined cooling, heating, and power (CCHP) systems' operation commonly focuses only on energy cost. Wang et al. [5] analyzed the energy flow of a CCHP system. In the Wang et al. [5] study, the capacity and operation of CCHP systems were optimized by a genetic algorithm. Lygnerud and Ojala [6] studied the efficiency of providing district heating to small houses in Finland and Sweden. The results indicate that Finnish companies, overall, are more efficient when offering district heat to small-house customers compared to large-house customers. Reverberi et al. [7] proposed an algorithm for the minimization of a suitable cost function. Prasanna and Umanand [8] proposed a hybrid solar cooking system, where the solar energy is transported to the kitchen. In that study, the diameter of the pipe was selected to optimize the overall energy transfer. Young-Deuk et al. [9] optimized the long-term performance of an existing active-indirect solar hot water plant using a microgenetic algorithm in conjunction with a relatively detailed model of each component in the plant and a solar radiation model based on the measured data.

Although extremely widespread in Europe and the United States, such simulation and optimization tools and DHWS themselves are new in Brazil, Latin America, and in most tropical and subtropical countries. Therefore, it is necessary to develop tools adapted to this type of country and, particularly, consider the profile of the low-income consumer.

## Mathematical Modeling and Optimized Implementation of the Global Cost Function of the DHWS

^{®}and utilizes the equations of fluid dynamics (mass conservation, momentum, and energy) to determine the pressures, flow rates, and diameters at each point of the network of pipes in the secondary circuit (subbranches, branches, and supply and return branches). The system is divided into a primary and secondary circuit connected by supply and return branches. The primary circuit generates and stores energy, in this case, hot water. The secondary circuit is the entire distribution network of the hot water to the consumers. Only the primary circuit is integrated into the public network of water distribution, while the secondary circuit is totally independent. To optimize the overall cost of the system, the installation costs of the materials and equipment and the costs of the electricity for the primer and recirculation pumps must be considered; however, the heat losses of the pipes are not taken into consideration for the optimization. The independent variables in this case are the pipe diameters in each network segment, which must be optimized to reduce the cost of the pipes. However, optimizing the diameters alone can lead to a loss of high-pressure in the pipes and, therefore, a higher required power for the hydraulic pumps, which necessarily leads to higher costs for the pumps and electricity. Thus, a global cost function is modeled that takes into account the configuration of each system. A multivariable optimization method, known as the gradient method, is highly recommended for this type of application. The iteration process begins with arbitrary values for the independent variables and then calculates the new values that tend to minimize the function. To do this, the value of each variable is the sum of the values of the previous iteration with a step that is proportional to the function gradient at the original point. Mathematically, the global cost function is defined as

*C*

_{global}(

*D*

_{1},

*D*

_{2},

*D*

_{3}, …,

*D*), where the indices 1, 2, 3,…,

_{ns}*ns*represent each segment of the network with continuous partial derivatives. The optimization starting point gives arbitrary values to the diameters, $Ds,0$, where the index

*s*refers to the network segment and the index 0 indicates that $Ds,0$ is the initial value. The new values are calculated by Eq. (1).

The adapted method uses values for the constant α that, rather than minimize a function that approximates the real function, calculates new values of the diameters that are immediately higher or lower than the value in the current iteration (according to the sign of the diameter's partial derivatives). The global cost function was modeled as the sum of the costs for pipes, fittings, pumps, and electrical energy consumed during the lifetime of the system, and each of these parcels were statistically described as functions of the pipe diameters. The costs attributed to labor, maintenance, and instrumentation of the installation were considered to be independent of the configuration chosen for the system and therefore not part of the global cost function.

The logical sequence to minimize the function is based on an adaptation of the gradient method and can be described briefly as follows:

- (1)
declaration of an array of commercial pipe diameters

- (2)
declaration of an array that receives the index of the diameter of each pipe segment in relation to the array of commercial diameters defined in Item 1

- (3)
a loop for each pipe segment is inserted into the fluid-dynamic and cost-optimization equations that govern the DHWS. For each loop, the partial derivatives of the cost function are calculated.

## Results and Conclusions

For a DHWS secondary circuit with five houses, the diameters of the supply branches are 20 mm (calculated by the maximum probable consumption [10]) and 22 mm (calculated by the gradient method); both situations have a mass flow rate per household of 0.12 kg/s. This mass flow rate is accepted by the Brazilian technical standards that address hot water installations. The resulting diameters of the supply branches are 22 mm (gradient method), because this configuration allows a decrease in the total pressure drop in the pipe segments of approximately 35%, and the required power of the primer pump is thus reduced from 0.39 HP (nonoptimized) to 0.25 HP (optimized). Initially, the total cost of the installation (nonoptimized method) is US$29,992.00. Applying the developed optimization algorithm, the final cost of the same facility is approximately US$29,054.00, which represents a reduction of 3.13% in the system cost. The optimization process can reduce the electricity costs for the primer pump by 24.24%. The employed method exhibited a satisfactory convergence degree; in the 5th iteration, the DHWS cost already achieves its optimum value. The fast convergence and the data output, already compatible with existing commercial diameters, show the suitability of the method for this type of application.

## Acknowledgment

Acknowledgments to the National Council for Scientific and Technological Development (CNPq), the Energetic Company of Minas Gerais (CEMIG), and the Graduate Program in Mechanical Engineering of the Federal University of Minas Gerais (UFMG).

### Nomenclature

- $Caccess$ =
manufacturing and marketing costs of the connections (US$)

- $Caccess,2009$ =
manufacturing and marketing costs of the connections estimated in Dec. 2009 (US$)

- $Cconn$ =
connections cost (US$)

- $Cet$ =
electricity cost for each hydraulic pump (US$)

*C*_{global}=global cost function (US$)

- $Cman$ =
manufacturing and marketing costs (US$)

- $Cman,2009$ =
manufacturing and marketing costs estimated in Dec. 2009 (US$)

- $Cmat$ =
material costs (US$/m or US$/unit)

- $Cpipe$ =
pipe cost (US$)

- $Ctet$ =
total cost of electricity for each hydraulic pump during the useful life of the DHWS (US$)

*D*=pipe diameter (m)

- $iinf$ =
annual inflation rate (dimensionless)

- $irate$ =
interest rate, given by the General Index of Market Prices (dimensionless)

- $Infaccum$ =
accumulated inflation rate from Dec. 2009 until the project date (dimensionless)

- $k$ =
current iteration index of the optimization (dimensionless)

- $Lpipe$ =
pipe length (m)

- $Ltmonths$ =
lifetime of the DHWS (months)

- $Ltyears$ =
total lifetime of the DHWS (years)

- $Mconn$ =
pipe or connection mass per unit of pipe length (kg/m)

*ns*=number of segments of the pipe network (dimensionless)

- $PBpro$ =
pump price at the date of the project (US$)

- $PBrep$ =
reserve pump price to be acquired ten years after the project date (US$)

- $Pcopper$ =
copper price (US$/ton)

- $Qttconn$ =
number of a particular connection type in a given pipe section (dimensionless)

- $Retet$ =
total readjustment of the electric power due to the inflation and interest rates (dimensionless)

- $Retot$ =
total readjustment considering the total accumulated interest and inflation in ten years (dimensionless)

*s*=index of each network segment (dimensionless)

- $tax$ =
electricity tax (US$/kWh)

- $tdec$ =
elapsed time from Dec. 2009 until the project date (years)

- $top$ =
operation times of the pumps (s)

- $W\xb7pump$ =
electrical power of the pump (W)

- $\alpha $ =
proportionality constant (dimensionless)