**1. Introduction**

Pipelines are one of the most economical means of transporting liquids. They are widely used to carry water, fuels, and other substances in the process industries. Pipeline monitoring generally consists of measuring pressures and flow rates at some strategic points in the pipeline, frequently including the ends of the line. The changes in the hydraulic variables, mainly the pressures, make it possible to identify disturbances and faults in the system, e.g., blockages and leaks, as well as the implementation of control loops that allow regulating or changing the operating point [1]. Since many of the diagnosis/control algorithms are based on a mathematical model of the hydraulic system, fine-tuning such algorithms requires precise knowledge of their parameters [2,3]. For example, to diagnose leaks through pressure variations, it is essential to know how much pressure variation is caused by a reasonable pressure drop due to friction in the pipeline, which is only possible if the roughness and head loss coefficients of the pipe are known [4,5].

The Colebrook–White equation is the primary reference for calculating the friction factor in pressurized pipes. Since there are no known explicit solutions to this nonlinear equation in terms of elementary functions, many works have focused on studying its numerical solution [6,7] or by proposing different explicit approaches with varying degrees of accuracy [8–12].

Since many pipelines operate with turbulent flow, most publications focus on the study of friction for this regime. However, there are some works in which explicit formulas have been proposed to calculate the friction factor for the three regimes: laminar, transitional, and turbulent, considering both smooth and rough pipes [13]. There are also works where only friction in smooth pipes is studied, neglecting the roughness [14], and others where pipes with ribs are considered [15].

Then, by considering the importance of friction in head losses, it could be said that the reports on the investigation of physical measurements and mathematical modeling of pipe roughness are scarce in the technical literature [16]. Direct measurement of roughness is not a simple process. However, current developments in profilometry and surface engineering have achieved accurate measures of a pipe's internal roughness, but only in a laboratory setting, usually with new pipes. In this way, Farshad and Pesecreta evaluated the roughness of different pipes' rough surfaces using linear surface profilometers [17]. However, Kang and Lansey point out that, in practice, the roughness of the pipe cannot be measured in the field, so it must be estimated indirectly [18]. In this context, the research in [19] addresses the estimation of roughness in a straight water supply pipe from flow measurements and head losses measured by piezometric pipes. Since the experimental pipe they used in this work is approximately straight, the minor head losses due to the fittings were not considered.

The works above focus on calculating the friction factor, which is the critical element in determining head losses in long-distance pipelines. Fittings and valves contribute very little to the total pressure drop in the pipeline. Therefore, in such cases, pressure losses through fittings, valves, and other restrictions are generally classified as "minor losses" and are neglected. However, in shorter pipelines, the pressure loss in valves, fittings, etc., can be a substantial part of the total pressure loss, so these must be included for correct engineering calculations [16]. Therefore, it is necessary to know the head loss coefficients (for local losses, accessories, and valves), and the roughness coefficients related to friction (for distributed losses, in the entire pipeline).

During the design of the piping system, it may be sufficient to know the nominal value of the roughness and head loss coefficients provided by the manufacturer. The calculations consider a safety factor that guarantees the operation of the system with an oversized pumping power [17]. However, during system operation, the implementation of model-based monitoring and diagnosis algorithms require an accurate estimate of both roughness and head loss coefficients. It should be considered that, even under the same pumping pressure, the head losses change over time because, with continuous use, the pipelines show natural wear and aging. Particles can also accumulate on the pipe walls, changing the roughness and effective diameter of the pipes [18,19]. Therefore, a periodic recalibration is necessary to update the parameter values.

Recently, in [20], both major losses (due to roughness) and minor losses (due to fittings) are independently studied. However, as will be explained in Section 3, when these are calculated separately, a small overestimate in one of them leads to an overestimate in the other one, and vice versa. This article proposes a procedure to simultaneously estimate the roughness and minor loss coefficients in a pipeline based on these considerations. The proposed calculation requires some measurements of flow and pressure at the pipeline ends.

This work's main contribution is the simultaneous computation of the coefficients of both components of the pressure loss: the major losses associated with roughness and the minor losses related to the fittings in the pipeline. In this proposal, it is possible to jointly estimate both coefficients assuming the minor losses as equivalent pipe lengths and looking for the coefficients that minimize the fitting error in the Colebrook–White equation. In order to demonstrate the applicability of the proposed technique, a series of tests on a prototype pipeline is described.

#### **2. Background on Turbulent Flow in Pipelines**

There is a general assumption that the head loss (*hf*) due to friction depends on the inner diameter (*D*) of the pipe, the length (*L*) in which the head loss is measured, the average flow velocity ( *V*), the absolute roughness of the pipe wall (*ks*), the gravity acceleration (*g*), and the density and the viscosity of the fluid. Through force balance and dimensional analysis, it is possible to determine the head losses due to friction as [21,22]:

$$h\_f = \frac{L}{D} \frac{V^2}{2g} f(\varepsilon, \text{Re}),\tag{1}$$

where Re is the Reynolds number, which measures flow turbulence as a function of viscosity and velocity, and *ε* = *ks*/*D* is the so-called relative roughness coefficient. The expression *f*(*<sup>ε</sup>*,Re) in (1) is the "friction factor", and is abbreviated hereinafter with the shortcut *f* := *f*(*<sup>ε</sup>*,Re). In this way, Equation (1) is represented in the following simplified form called the Darcy–Weisbach equation [21,23]:

$$h\_f = f \frac{L}{D} \frac{V^2}{2g} = f \frac{8L}{g\pi^2 D^5} Q^2. \tag{2}$$

where *Q* is the volumetric flow rate in the pipeline. Compared to other formulas for calculating friction losses, Equation (2) has the advantage of being a dimensionally homogeneous equation, so that the friction factor *f* is a dimensionless number consistent with any system of units [21]. There are works where some variants of the Darcy–Weisbach equation are considered. For example, [24] suggests an improvement in the calculation of the friction factor by assuming a periodicity of the roughness in the longitudinal direction of the pipe. However, in this work only the classical form (2) is considered.

In general, the friction factor depends on the flow turbulence (measured with Re) and also on the physical characteristics of the pipe (diameter and roughness of the interior walls). However, when the flow is laminar, at low velocity, the friction factor depends only on the Reynolds number, and is given by *f* = 64/Re for Re ≤ 2000. Instead, at high speeds where the flow is turbulent (Re ≥ 4000), the friction factor also depends on the roughness of the pipe walls. In the interval, 2000 < Re < 4000, after the laminar regime and before the turbulent regime, the values of the friction factor are not very predictable. Therefore this transitional regime will not be considered in this work.

One of the most widely accepted models for expressing the relationship between friction, turbulence, and roughness in pressurized flows is the Colebrook–White equation:

$$\frac{1}{\sqrt{f}} + 2\log\_{10}\left(\frac{\varepsilon}{3.7} + \frac{2.51}{\text{Re}\sqrt{f}}\right) = 0,\tag{3}$$

where the Reynolds number given by

$$\text{Re} = \frac{DQ}{A\nu} \tag{4}$$

measures flow turbulence in terms of kinematic viscosity *ν* and flow rate *Q*, while the friction factor

$$f = \frac{g\pi^2 D^5 h\_f}{8LQ^2} \tag{5}$$

is expressed in terms of the head loss *hf* (= *H*in − *H*out) along the pipe.

Explicit solutions for *f* of the DW equation using elementary functions are not known, because due to their nonlinearity, it is impossible to isolate *f* in terms of *ε* and Re. However, it is possible to find approximate solutions using iterative numerical methods. For this, the DW equation is rewritten as:

$$\phi(f) := \frac{1}{\sqrt{f}} + 2\log\_{10}\left(\frac{\varepsilon}{3\mathcal{I}} + \frac{2.51}{\text{Re}\,\sqrt{f}}\right) \\ = 0. \tag{6}$$

The problem is then reduced to iteratively find the zero of *φ*(*f*) or, equivalently, the minimum of *φ*<sup>2</sup>(*f*). Figure 1 shows the numerical solution of (6) obtained using the COLEBROOK MATLAB-routine, which can be consulted in [20]. It is also possible to estimate the solution of the CW equation, with different percentages of error, using explicit non-iterative approximations, such as those proposed by [25–27], among others. The surface plot in Figure 1 shows the general behavior that friction factor increases with roughness and decreases with the Reynolds number. However, for high turbulence (very large Re) the friction factor depends only on the roughness.

**Figure 1.** Variation of friction factor with roughness and Reynolds number in turbulent regime.

On the other hand, in addition to the pressure losses due to friction, which are distributed throughout the pipeline, the pressure losses due to flow disturbance caused by elbows, valves, and other fittings must be quantified. These are not distributed losses, but rather local losses that can be located in a well-defined position. Head losses due to singularities or fittings are commonly called "minor losses" because, for very long pipes, their value can be neglected compared to that due to friction. However, their effect can be significant for short pipes [28].

Equation (2) only predicts major losses due to fluid friction on the pipe wall and due to the effects of fluid viscosity and does not include minor losses on inputs, elbows, and other fittings. Minor losses in accessories are defined in terms of a loss coefficient *K*, by

$$h\_{\rm mf} = K \frac{V^2}{2g'} \tag{7}$$

which has some similarity with Equation (2) used for friction losses. There are some empirical formulas to estimate the minor loss coefficient (*K*) for valves, elbows, and other fittings [16]. In practice, the values obtained in this way can differ considerably from the true values, so it is convenient to determine them experimentally. For example, for 90◦ elbows, the minor loss coefficient is typically in the interval 0.9 ≤ *K* ≤ 1.5, according to [29]; on the other hand, in [16] it is suggested to use the empirical formula *K* = 30 *fT*, where *fT* is the turbulent friction factor. In general, the minor loss coefficient is a function of both the fitting geometry and the Reynolds number. However, when Re is large enough, *K* can be assumed as a function of the fitting geometry only.

Given the similarity between Equations (2) and (7), in some applications it has been proposed to combine distributed losses with local losses, expressing the latter as if they were friction losses in an additional length of pipe. The "equivalent length" of pipe associated with a local head loss is the length of pipe that would produce a friction head loss equal to the corresponding local head loss. By matching Equations (2) and (7), the equivalent length *<sup>L</sup>*eq can be obtained as

$$K\frac{V^2}{2g} = f \frac{L\_{\text{eq}}}{D} \frac{V^2}{2g} \qquad \Rightarrow \qquad L\_{\text{eq}} = \frac{KD}{f} ,\tag{8}$$

so, if the additional length of pipe that would equal the local losses is known, the minor loss coefficient is given by

$$K = f \frac{L\_{\text{eq}}}{D}.\tag{9}$$

The above equations are the basis for addressing the problem under study. Formally, the problem whose solution is proposed in the next section can be expressed as follows: "Given a list of flow-rate and pressure measurements at pipeline ends, find simultaneously the roughness coefficient *ε* and the minor loss coefficient *K*—as equivalent length—so that for the friction factor values obtained experimentally, via the Darcy–Weisbach equation, the fitting error in the Colebrook–White equation is minimized".

#### **3. Proposed Methodology**

Consider the simultaneous estimation of the roughness coefficient and the minor loss coefficient. The strategy used to integrate the minor losses together with the friction (major losses) is to assume them as an additional length of pipe, so that the total length used in the calculations is a "computational length" that integrates both the physical length of the pipeline as the equivalent length of the fittings.

If the pipe length *L* is assumed to be known, the friction factor *f* can be determined by measuring the flow rate *Q* and the head loss *hf* between the pipeline ends and substituting these values (5). Then, the roughness can be obtained by substituting *f* in the nonlinear Equation (3) and solving for *ε*. However, when starting from an underestimated length, if the roughness is overestimated, then the pipeline appears to be rougher when its length is shortened for a given friction factor.

Additionally, in practice, the roughness *ε* obtained by the numerical solution of (3) is sensitive to variations in the computed value of *f* due to measurement noise on *Q* and *hf* . Therefore, a single value of *ε* does not completely satisfy (3) for different measurements, even if they correspond to the same operating point. Consequently, for each measurement, the right side of (3) is not exactly zero, but there is a residual or fitting error *δ*. However, if we consider a length-dependent friction factor, *f*(*L*), it is possible to minimize the error *δ* by adjusting the parameters *ε* and *L* in (3). In this way, the Colebrook–White equation expresses the friction factor in terms of flow rate and head loss but is parameterized by the roughness coefficient and the total length of the pipeline.

Thus, for each value of flow rate and head loss (for each operating point), there is a fitting error

$$\delta\_k(\varepsilon, L) := \frac{1}{\sqrt{f\_k(L)}} + 2\log\_{10}\left(\frac{\varepsilon}{3.7} + \frac{2.51}{\mathrm{Re}\_k\sqrt{f\_k(L)}}\right),\tag{10}$$

where Re*k* and *fk* are calculated as specified in (4) and (5), using the flow rate and head loss measurements in the *k*-th operating point.

Considering a nonlinear least squares optimization problem, with *N* measurements (*N* ≥ 2), the optimal roughness and total length estimates have been defined as follows:

$$\widehat{\mathfrak{e}}, \widehat{\mathbb{L}} := \operatorname\*{arg\,min}\_{\mathfrak{e}, \operatorname\*{Im}} \sum\_{k=1}^{N} \delta\_{\mathbf{k}} \left( \mathfrak{e}, \mathbb{L} \right)^{2} = \operatorname\*{arg\,min}\_{\mathfrak{e}, \operatorname\*{Im}} \mathfrak{d}^{\top} \mathfrak{d}, \tag{11}$$

where *δ* = [*<sup>δ</sup>*1(*<sup>ε</sup>*, *<sup>L</sup>*), *<sup>δ</sup>*2(*<sup>ε</sup>*, *<sup>L</sup>*),..., *<sup>δ</sup>N*(*<sup>ε</sup>*, *L*)] is the vector of fitting errors in the Colebrook–White equation. One way to solve the optimization problem (11), the one proposed in this work, is through the Levenberg–Marquardt (LM) method [30,31].

In the context of curve fitting, the LM method, also known as the damped least squares (DLS) method, is formulated as follows: Given a set of *N* pairs of empirical data (**<sup>x</sup>***k*, *yk*) of independent and dependent variables, find the parameters *β* of the model *φ*(**<sup>x</sup>**, *β*) so that the sum of the squares of the deviations is minimized:

$$\hat{\boldsymbol{\beta}} = \underset{\boldsymbol{\beta}}{\text{arg}\min} \sum\_{k=1}^{N} \left[ y\_k - \boldsymbol{\phi}(\mathbf{x}\_{k'} \boldsymbol{\beta}) \right]^2. \tag{12}$$

There is a correspondence between the optimization form (12) and the problem of calculating the roughness and length in (11), assuming the following equivalence:

$$\mathfrak{g} \equiv [\mathfrak{e}, \operatorname{L}]^\top, \quad y\_k \equiv 0, \quad \mathfrak{q}(\mathbf{x}\_k, \mathfrak{g}) \equiv \delta\_k(\mathfrak{e}, \operatorname{L}).\tag{13}$$

In order to find the optimal value of *β*, the LM algorithm iterates from an initial approximation *β*0. In each iteration, the parameter vector, *β*, is replaced by a new estimate, *β* + **Δ**. The increment **Δ** is calculated, according to [32], by solving

$$\left(\mathbf{J}^{\top}\mathbf{J} + \lambda \operatorname{diag}\left(\mathbf{J}^{\top}\mathbf{J}\right)\right)\mathbf{A} = \mathbf{J}^{\top}\left(\mathbf{y} - \boldsymbol{\Phi}(\boldsymbol{\beta})\right),\tag{14}$$

where **J** = [*∂φ*(**<sup>x</sup>***k*, *β*)/*∂β*] is the Jacobian matrix, *φ*(*β*) = [*φ*(**<sup>x</sup>***k*, *β*)], **y** = [*yk*], and *λ* is a damping factor updated at each iteration. The iterations start with an empirical value *λ* = 0.01. Then if the sum in (12) decreases fast, a smaller value *λ* ← *λ*/10 is used in the subsequent iteration. When the step size, **Δ**, or the decrease in the sum of squares for the last parameter vector, *β* + **Δ**, falls below predefined limits, the iteration stops, and the last parameter vector *β* is considered the solution. The box in Figure 2 summarizes the complete calculation procedure.

**Input**. Column-shaped arrays of the same length: *H*in, *H*out, *Q*, and *ν*.

	- (a) Compute the Jacobian matrix **J**.
	- (b) Solve Equation (14) for **Δ**.

$$\text{(c) } \mathcal{J}\_{\text{old}} \gets \mathcal{J}$$

	- *λ* ← *λ*/10
	- **else**

*λ* ← 10 *λ*

**endif**

**until Δ** ≤ TOLΔ or *β* − *β*old ≤ TOL*β*

**Output**. Optimal estimates: \**ε* = *β*[1], \* *L* = *β*[2].

**Figure 2.** Algorithm to compute the optimal estimates of the roughness and minor loss coefficients.

The solution to the problem (11), using the LM method as described in Figure 2, was coded into a MATLAB subroutine. This subroutine, named Pipeline Parameter Calibration (PPC), receives inlet and outlet pressures, flow rate, and viscosity measurements at each operating point of the pipeline, and returns the estimated optimal values for *ε* and *L*. The head loss coefficient *K* can be obtained from the excess length of \* *L* over the straight length using (9). In slightly turbulent flows, measurements should be taken over a small operating interval, because the minor loss coefficient could

vary significantly between widely separated operating points. However, for completely turbulent flows the minor loss coefficient remains approximately constant. The range of Re in the test measurements described in the next section corresponds to a sufficiently high turbulence.

## **4. Experimental Setup**

The procedure described in the preceding section has been tested on a prototype serpentine-shaped pipeline [33] (see Figure 3). This experimental pipeline is part of the Hydroinformatics Laboratory of the National Institute of Technology of Mexico, located in Tuxtla Gutiérrez. This pipeline has a straight length of 84.58 m and uses 90◦ elbows to give it a serpentine shape, as shown in Figure 4. The flow is driven from a 2500 l tank using a 5 hp centrifugal pump whose power is controlled by a frequency inverter. Pressure and flow sensors/transmitters are available at the pipeline ends. Although the prototype pipeline has two flow sensors, only one of them is used to obtain the flow-rate measurements required by the algorithm, because the measurements are made in a steady state with no leaks. There are no pressure sensors before and after each change in flow direction, so it is not possible to calculate the head loss on each direction change individually. In order to change the operating point of the pipeline, the frequency inverter was driven at the following working frequencies: 30 Hz, 35 Hz, 40 Hz, 45 Hz, 50 Hz and 55 Hz. Other parameters of the experimental pipeline used in calculations are *D* = 0.0486 m, and *g* = 9.79 m/s2.

**Figure 3.** Prototype pipeline in the National Institute of Technology of Mexico, at Tuxtla Gutiérrez.

**Figure 4.** Top view of the prototype pipeline.

Table 1 shows the first dataset containing the pressure and flow measurements used to estimate the roughness and equivalent length of the prototype pipe. The kinematic viscosity in the fourth column was calculated from the measured water temperature by spline interpolation using the NIST Standard Reference Data, according to [34]. Pressure and flow measurements at each operating point were obtained by averaging the sensor signals over a time interval (1000 samples, corresponding to 10 s) to minimize the effect of measurement noise. In order to test the Algorithm of Figure 2, five datasets with the same structure as Table 1 were built, named pipeline\_data\_1 : pipeline\_data\_5. Each dataset contains measurements at six operating points within the typical working range in the prototype pipeline, limited by the available pumping power. In practice, in other pipelines, the measurements used should consider their specific operating region, provided that it corresponds to the turbulent regime because the Colebrook–White equation does not correctly represent the laminar and transitional regimes.


**Table 1.** Dataset with measurements at six operating points.

#### **5. Results and Discussion**

The box in Figure 5 shows the result of running the PPC subroutine with the measurements reported in Table 1. The best fit of the measurements to the Colebrook–White equation was obtained for a roughness coefficient \**ε* = 3.4652 × 10−<sup>4</sup> and a total length \**L* = 112.2238 m. This result corresponds to an excess length of 27.6438 m, compared to the physical length, due to minor losses. Figure 6 graphically shows the existence of the minimum, evidencing the behavior of the cost function in the neighborhood of the optimal estimate *β* \* = (\**ε*, \* *<sup>L</sup>*). Starting from the initial approximation *β*0 = (1 × <sup>10</sup>−4, <sup>100</sup>), the LM procedure converges to the optimal value in eight iterations, when the norm of the increment, **Δ**, reaches the value of 5.1559 × 10−9.

```
>> load pipeline_data_1
>> ppc(Hin, Hout, Q, nu)
Dataset...
   Hin Hout Q nu Re f
  ______ ______ _________ __________ ______ ________
  3.7528 1.6063 0.0016903 8.4116e-07 52644 0.021924
  4.7461 1.7960 0.0020166 8.3951e-07 62932 0.021168
  5.8550 2.0033 0.0023346 8.3713e-07 73063 0.020620
  7.0908 2.2399 0.0026452 8.3513e-07 82980 0.020231
  8.4442 2.4941 0.0029531 8.3296e-07 92881 0.019909
  9.8962 2.7663 0.0032562 8.3061e-07 102704 0.019622
Calibration results...
epsilon~=~0.00034652
L~=~112.2238
```
**Figure 5.** MATLAB output of the Pipeline Parameter Calibration (PPC) subroutine for the measurements in Table 1.

**Figure 6.** Behavior of the cost function in the neighborhood of the optimal estimate.

The PPC subroutine was run in each of the five available datasets; the results are summarized in Table 2. It can be seen that the roughness estimate was more sensitive than the length estimate concerning the change in pressure and flow-rate measurements. This is evidenced by the fact that the roughness varies from the third significant digit between different datasets, while the length only varies from the fourth significant digit. More precisely, the root-mean-square deviation (RMSD) was 1.929 × 10−<sup>6</sup> (0.56%) for roughness, and 0.0456 m (0.04%) for length.

**Table 2.** Roughness and length estimates from different datasets.


The variation in the results obtained with different datasets could be attributed, at least partially, to the measurement error of the sensors, which is between 0.01% and 0.04% (maximum) according to the manufacturer's datasheets. This has the consequence that the computation of the friction factor, based on an inaccurate estimate of the roughness coefficient, is also inaccurate. Sensitivity analysis in the working region of the prototype pipeline showed that

$$(\Delta f)/f = 0.092 \, (\Delta \varepsilon)/\varepsilon, \qquad (\Delta f)/f = -0.156 \, (\Delta \text{Re})/\text{Re},\tag{15}$$

where (ΔRe)/Re can be taken approximately equal to the flow-rate measurement error, (Δ*Q*)/*Q*, considering the relationship (4). These results show that the friction factor calculation is considerably sensitive to flow measurement errors.

The final estimates of *ε* and *L* were obtained by averaging the estimates from the five experiments on the prototype pipeline, resulting in \**ε* = 3.4743 × 10−<sup>4</sup> and \**L* = 112.21 m. On the Moody chart in Figure 7, the interval of the friction factor in the prototype pipeline has been represented in red, according to the calculated roughness coefficient. This can be considered as the "working region" of the pipeline. The solid orange line in Figure 7 is the theoretical curve according to the estimated roughness \**ε*, while the discrete red points represent the specific values of Re and *f* obtained from the measurements (via Equations (4) and (5), respectively), confirming a good parameterization of the Colebrook–White equation to fit the data.

**Figure 7.** Moody chart with the parameters computed in the prototype pipeline.

In the prototype pipeline, minor losses are primarily due to the elbows used to give it the serpentine shape, so that the equivalent length of each elbow is determined by

$$I\_{\text{elecow}} = (I\_{\text{total}} - I\_{\text{physical}})/n = (112.21 \,\text{m} - 84.58 \,\text{m})/18 = 1.535 \,\text{m},\tag{16}$$

where *n* is the number of elbows, and *<sup>L</sup>*physical is the true length, also termed "straight length" of the pipeline.

Finally, the minor loss coefficient for each elbow can be obtained from (9). As noted in Section 2, the *K* values change slightly with the operating point. For example, for the fifth operating point in Table 1 (corresponding to Re = 92881) it was obtained:

$$K\_{\text{ellow}} = f \frac{L\_{\text{ellow}}}{D} = 0.629. \tag{17}$$

These *K* values obtained for the elbows of the prototype pipeline are close to those obtained with the empirical formula in [16] and fall outside the interval suggested by [29]. Due to the proximity between each elbows pair, it might be desirable to assign combined loss coefficients in pairs, since possibly the energy loss at the inlet elbow is different from the energy loss at the outlet elbow. In this case, the combined loss coefficient for each flow return, *K*return, is twice that calculated by (17), since the number of elbows doubles the number of return bends.

## **6. Conclusions**

A technique for simultaneously estimating the roughness and minor loss coefficients in non-straight pipelines has been presented and tested. The results show that, within the accuracy conditioned by the sensors' measurement uncertainty, the proposed methodology produces a reasonable estimate of both coefficients. In this regard, the roughness coefficient estimate is more sensitive to measurement noise than the minor loss coefficient estimate by almost one order of magnitude.

In support of this calculation proposal, it should be mentioned that the described technique to compute the roughness and the equivalent length has been used in multiple tests to locate leaks using extended Kalman filters, reaching a location accuracy of close to 2% of the pipeline length. The leak location procedure is not described here but can be found published in [5].

The main limitation of the proposed technique is that it only allows the estimation of minor loss coefficients for a single type of fitting. When the pipeline presents considerable head losses in more than one type of fitting, it does not determine what fraction of the minor loss is attributed to each one. As future work, it is intended to modify or extend the proposed technique to allow the calculation of roughness and minor loss coefficients in branched pipelines, also considering valves and other fittings such as tees and wyes.

**Author Contributions:** Conceptualization, I.S.-R., F.-R.L.-E. and V.P.; methodology, I.S.-R.; software, I.S.-R.; validation, F.-R.L.-E., V.P. and G.V.-P.; formal analysis, G.V.-P.; data curation, I.S.-R.; writing—original draft preparation, I.S.-R.; writing—review and editing, F.-R.L.-E., V.P. and G.V.-P.; supervision, F.-R.L.-E. and V.P.; project administration, F.-R.L.-E. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the National Council for Science and Technology (CONACYT) of Mexico, under the program Atención a Problemas Nacionales, gran<sup>t</sup> number PN-2016/3595.

**Conflicts of Interest:** The authors declare no conflict of interest. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.
