Package 'pipenostics'

Title: Diagnostics, Reliability and Predictive Maintenance of Pipeline Systems
Description: Functions that represent some useful empirical and data-driven models for heat loss, corrosion diagnostics, and predictive maintenance of pipeline systems. The package is designed for data analysts and engineers who are involved in exploratory or routine calculations. Methods are described in Timashev et al. (2016) <doi:10.1007/978-3-319-25307-7>, A.C.Reddy (2017) <doi:10.1016/j.matpr.2017.07.081>, Minenergo (2008) <https://docs.cntd.ru/document/902148459>, Minenergo (2005) <https://docs.cntd.ru/document/1200035568>, Xing LU. (2014) <doi:10.1080/23744731.2016.1258371>.
Authors: Yuri Possokhov [aut, cre] (ORCID: <https://orcid.org/0000-0002-3570-4337>)
Maintainer: Yuri Possokhov <[email protected]>
License: GPL-3
Version: 0.3.0
Built: 2026-05-17 07:03:36 UTC
Source: https://github.com/omega1x/pipenostics

Help Index


pipenostics: Diagnostics, Reliability and Predictive Maintenance of Pipeline Systems

Description

Functions that represent some useful empirical and data-driven models for heat loss, corrosion diagnostics, and predictive maintenance of pipeline systems. The package is designed for data analysts and engineers who are involved in exploratory or routine calculations. Methods are described in Timashev et al. (2016) doi:10.1007/978-3-319-25307-7, A.C.Reddy (2017) doi:10.1016/j.matpr.2017.07.081, Minenergo (2008) https://docs.cntd.ru/document/902148459, Minenergo (2005) https://docs.cntd.ru/document/1200035568, Xing LU. (2014) doi:10.1080/23744731.2016.1258371.

Author(s)

Maintainer: Yuri Possokhov [email protected] (ORCID)

See Also

Useful links:


API 5L. Values of SMYS and UTS

Description

Data represents specified minimum yield strength (SMYS) and ultimate tensile strength (UTS) both achieved when producing line pipes according to regulatory specifications.

Usage

api5l3tdata

Format

A data frame with 57 rows and 4 variables:

grade

designation of standard grade of manufactured pipe. Type: assert_character.

smys

SMYS - specified minimum yield strength, [psi]. Type: assert_double.

uts

UTS - ultimate tensile strength, [psi]. Type: assert_double.

origin

Identifier for the information origin regarding the specifications of pipe, []:

10

API SPECIFICATION 5L .Table 3A

3

GOST 20295-85. Table 7

11

GOST 31443-2012 . Tables 6, 7

Type: assert_integer.

References

  1. API SPECIFICATION 5L. Specification for Line Pipe

  2. GOST 20295-85. Steel welded pipes for main gas-and-oil pipelines. Specifications

  3. GOST 31443-2012. Steel pipes for crafts pipelines. Specifications.

Examples

library(pipenostics)

head(api5l3tdata)

ASME B31G. Basic computer program CRVL.BAS

Description

Imitation of CVRL.BAS computer program presented in ASME B31G-1991 Appendix A for determining allowable length and allowable operating pressure

Usage

b31crvl(maop, d, wth, smys, def = 0.72, depth, l)

Arguments

maop

maximum allowable operating pressure - MAOP, [PSI]. Type: assert_double.

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

smys

specified minimum yield of stress (SMYS) as a characteristics of steel strength, [PSI]. Type: assert_double.

def

appropriate (combined) design factor from ASME B31.4, ASME B31.8, or ASME B31.11, []. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudinal length of the corroded area, [inch]. Type: assert_double.

Details

Columns maop, d, wth, smys, def, depth, l in the output data.frame come from function's input, other columns are calculated.

For univariate case (when lengths of all input vectors are one) messages that imitate CRVL.BAS console output are printed.

Value

Object of S3-class crvl which is a data.frame with the next numeric columns:

maop

maximum allowable operating pressure - MAOP, [PSI]. Type: assert_double.

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

smys

specified minimum yield of stress (SMYS) as a characteristics of steel strength, [PSI]. Type: assert_double.

def

appropriate (combined) design factor from ASME B31.4, ASME B31.8, or ASME B31.11, []. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudial length of corroded area, [inch]. Type: assert_double.

status

operational status of pipe: 1 - excellent, 2 - monitoring is recommended, 3 - alert! replace the pipe immediately! Type: assert_numeric.

design_pressure

design pressure of pipe, [PSI]. Type: assert_double.

safe_pressure

safe maximum pressure for the corroded area, [PSI]. Type: assert_double.

pressure_exceeding

whether operator's action is required to reduce MOAP lower than the maximum safe pressure of the corroded area. Type: assert_logical.

allowed_corrosion_depth

allowable depth of the corroded area, [inch]. Type: assert_double.

A

intermediate factor related to the geometry of the corroded area, []. Type: assert_double.

allowed_corrosion_length

allowable length of the corroded area, [inch]. Type: assert_double.

AP

another intermediate factor related to the geometry of the corroded area, []. Type: assert_double.

References

ASME B31 G-1991. Manual for determining the remaining strength of corroded pipelines. A supplement to ASME B31G code for pressure piping.

See Also

Other ASME B31G: b31gacd(), b31gacl(), b31gafr(), b31gdep(), b31gops(), b31gsap()

Examples

library(pipenostics)

## Further examples are inspired by those used in Appendix A of
## ASME B31G-1991 to verify correct entry of CRVL.BAS source code:

## Standard example 1
b31crvl(
  maop = 910, d = 30, wth = .438, smys = 52000, def  = .72, depth = .1,
  l = 7.5
)

## Standard example 2
b31crvl(
  maop = 400, d = 20, wth = .25, smys = 35000, def  = 0.5, depth = 0.18,
  l = 10
)

## Standard example 3
b31crvl(
  maop = 910, d = 24, wth = .432, smys = 52000, def  = .72, depth = 0.13,
  l = 30
)

## Standard example 4
b31crvl(
  maop = 910, d = 24, wth = .432, smys = 52000, def  = .72, depth = .3,
  l = 30
)

## Standard example 5
b31crvl(
  maop = 731, d = 24, wth = .281, smys = 52000, def  = 0.72, depth = 0.08,
  l = 15
)

## Standard example 6
b31crvl(
  maop = 1e3, d = 36, wth = .5, smys = 52000, def  = 0.72, depth = 0.41,
  l = 100
)

## Standard example 8
b31crvl(
  maop = 877, d = 12.625, wth = .5, smys = 35000, def  = .4, depth = .035,
  l = 3
)

## Standard example 9
b31crvl(
  maop = 790, d = 24, wth = .5, smys = 42000, def  = .5, depth = .125, l = 12
)

## TEST #1
b31crvl(
  maop = 790, d = 24, wth = .5, smys = 42000, def  = .5, depth = .179, l = 12
)

## TEST #1A
b31crvl(
  maop = 790, d = 24, wth = .5, smys = 42000, def  = .5, depth = .179,
  l = 12.182
)

## TEST #1B
b31crvl(
  maop = 790, d = 24, wth = .5, smys = 42000, def  = .5, depth = .180,
  l = 12.182
)

## TEST #2
b31crvl(
  maop = 790, d = 24, wth = .5, smys = 42000, def  = .5, depth = .179,
  l = 12.297
)

## All examples at once:
data(b31gdata)
with(b31gdata, b31crvl(maop, d, wth, smys, def, depth, l))

ASME B31G. Allowable corrosion depth in pipe

Description

Calculate allowable depth of the corroded area in the pipe.

Usage

b31gacd(dep, maop, d, wth, l)

Arguments

dep

design pressure of pipe, [PSI]. Type: assert_double.

maop

maximum allowable operating pressure - MAOP, [PSI]. Type: assert_double.

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [inch]. Type: assert_double.

Value

Allowable depth of the corroded area in the pipe, [inch]. Type: assert_double.

References

ASME B31G-1991. Manual for determining the remaining strength of corroded pipelines. A#' supplement to ASTME B31 code for pressure piping.

See Also

Other ASME B31G: b31crvl(), b31gacl(), b31gafr(), b31gdep(), b31gops(), b31gsap()

Examples

library(pipenostics)

b31gacd(1093, 910, 30, .438, 7.5)

ASME B31G. Allowable corrosion length in pipe

Description

Calculate allowable length of the corroded area in the pipe.

Usage

b31gacl(dep, maop, d, wth, depth, l)

Arguments

dep

design pressure of pipe, [PSI]. Type: assert_double.

maop

maximum allowable operating pressure - MAOP, [PSI]. Type: assert_double.

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudinal length of the corroded area, [inch]. Type: assert_double.

Value

Allowable length of the corroded area in the pipe, [inch]. Type: assert_double.

References

ASME B31G-1991. Manual for determining the remaining strength of corroded pipelines. A supplement to ASTME B31 code for pressure piping.

See Also

Other ASME B31G: b31crvl(), b31gacd(), b31gafr(), b31gdep(), b31gops(), b31gsap()

Examples

library(pipenostics)

# Corrosion is low, no limit for the corroded area length:
b31gacl(1093, 910, 30, .438, .1, 7.5)

# Finite allowed length of the corroded area
b31gacl(438, 400, 20, .25, .18, 10)

ASME B31G. A-factor

Description

Calculate intermediate factor related to the geometry of the corroded area.

Usage

b31gafr(d, wth, l)

Arguments

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

l

measured maximum longitudinal length of the corroded area, [inch]. Type: assert_double.

Value

Intermediate factor related to the geometry of the corroded area, []. Type: assert_double.

References

ASME B31G-1991. Manual for determining the remaining strength of corroded pipelines. A supplement to ASTME B31 code for pressure piping.

See Also

Other ASME B31G: b31crvl(), b31gacd(), b31gacl(), b31gdep(), b31gops(), b31gsap()

Examples

library(pipenostics)

# A-factor is less than 5, so the corrosion is not critical:
b31gafr(30, .438, 7.5)

ASME B31G. Corrosion state of 12 pipes

Description

Data represents examples used for verification of computer program CRVL.BAS listed in Appendix A of ASME B31G-1991.

Usage

b31gdata

Format

A data frame with 12 rows and 15 variables:

maop

maximum allowable operating pressure - MAOP, [PSI]. Type: assert_double.

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

smys

specified minimum yield of stress (SMYS) as a characteristics of steel strength, [PSI]. Type: assert_double.

def

appropriate (combined) design factor from ASME B31.4, ASME B31.8, or ASME B31.11, []. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [inch]. Type: assert_double.

status

operational status of pipe: 1 - excellent, 2 - monitoring is recommended, 3 - alert! replace the pipe immediately! Type: assert_numeric.

design_pressure

design pressure of pipe, [PSI]. Type: assert_double.

safe_pressure

safe maximum pressure for the corroded area, [PSI]. Type: assert_double.

pressure_exceeding

whether operator's action is required to reduce MOAP lower than the maximum safe pressure of the corroded area. Type: assert_logical.

allowed_corrosion_depth

allowable depth of the corroded area, [inch]. Type: assert_double.

A

intermediate factor related to the geometry of the corroded area, []. Type: assert_double.

allowed_corrosion_length

allowable length of the corroded area, [inch]. Type: assert_double.

AP

another intermediate factor related to the geometry of the corroded area, []. Type: assert_double.

Source

https://law.resource.org/pub/us/cfr/ibr/002/asme.b31g.1991.pdf

Examples

library(pipenostics)

head(b31gdata)

ASME B31G. Design pressure of pipe

Description

Calculate the design pressure that according to ASME B31G-1991 is the conditioned construction characteristic that should not in no way exceeded.

Usage

b31gdep(d, wth, smys, def)

Arguments

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

smys

specified minimum yield of stress (SMYS) as a characteristics of steel strength, [PSI]. Type: assert_double.

def

appropriate (combined) design factor from ASME B31.4, ASME B31.8, or ASME B31.11, []. Type: assert_double.

Value

Design pressure of pipe, [PSI]. Type: assert_double.

References

ASME B31G-1991. Manual for determining the remaining strength of corroded pipelines. A supplement to ASTME B31 code for pressure piping.

See Also

Other ASME B31G: b31crvl(), b31gacd(), b31gacl(), b31gafr(), b31gops(), b31gsap()

Examples

library(pipenostics)

b31gdep(30, .438, 52e3, .72)

ASME B31G. Failure pressure of the corroded pipe (modified)

Description

Calculate failure pressure of the corroded pipe according to Modified B31G,Level-1 algorithm listed in ASME B31G-2012.

The next assumption of corrosion shape is adopted by Modified B31G:

b31gmodpf.png

The dcord_{\text{cor}} value depicted in the figure above is represented by argument depth.

Usage

b31gmodpf(d, wth, smys, depth, l)

Arguments

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

smys

specified minimum yield of stress (SMYS) as a characteristics of steel strength, [PSI]. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [inch]. Type: assert_double.

Details

Since the definition of flow stress, Sflow, in ASME B31G-2012 is recommended with Level 1 as follows:

Sflow=1.1SMYSS_{\text{flow}} = 1.1\cdot\text{SMYS}

no other possibilities of its evaluation are incorporated.

For this code we avoid possible semantic optimization to preserve readability and correlation with original text description in ASME B31G-2012. At the same time source code for estimated failure pressure preserves maximum affinity with its semantic description in ASME B31G-2012.

Numeric NAs may appear in case prescribed conditions of use are offended.

Value

Estimated failure pressure of the corroded pipe, [PSI]. Type: assert_double.

References

  1. ASME B31G-2012. Manual for determining the remaining strength of corroded pipelines: supplement to B31 Code for pressure piping.

  2. S. Timashev and A. Bushinskaya, Diagnostics and Reliability of Pipeline Systems, Topics in Safety, Risk, Reliability and Quality 30, doi:10.1007/978-3-319-25307-7.

See Also

Other Failure estimation: b31gpf(), dnvpf(), mepof(), pcorrcpf(), shell92pf()

Examples

library(pipenostics)

## Example: maximum percentage disparity of original B31G
## algorithm and modified B31G showed on CRVL.BAS data
with(b31gdata, {
  original  <- b31gpf(d, wth, smys, depth, l)
  modified  <- b31gmodpf(d, wth, smys, depth, l)
  round(max(100 * abs(1 - original/modified), na.rm = TRUE), 4)
})

## Example: plot disparity of original B31G algorithm and
## modified B31G showed on CRVL data
with(b31gdata[-(6:7),], {
  b31g  <- b31gpf(d, wth, smys, depth, l)
  b31gmod  <- b31gmodpf(d, wth, smys, depth, l)
  axe_range <- range(c(b31g, b31gmod))
  plot(b31g, b31g, type = 'b', pch = 16,
       xlab = 'Pressure, [PSI]',
       ylab = 'Pressure, [PSI]',
       main = 'Failure pressure method comparison',
       xlim = axe_range, ylim = axe_range)
  inc <- order(b31g)
  lines(b31g[inc], b31gmod[inc], type = 'b', col = 'red')
  legend('topleft',
         legend = c('B31G Original',
                    'B31G Modified'),
         col = c('black', 'red'),
         lty = 'solid')
})

ASME B31G. Operational status of pipe

Description

Determine the operational status of pipe: is it excellent? or is technological control required? or is it critical situation?

Usage

b31gops(wth, depth)

Arguments

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

Value

Operational status of pipe as an integer value:

  • 1 - excellent

  • 2 - monitoring is recommended

  • 3 - alert! replace the pipe immediately!

Type: assert_numeric and assert_subset.

References

ASME B31G-1991. Manual for determining the remaining strength of corroded pipelines. A supplement to ASTME B31 code for pressure piping.

See Also

Other ASME B31G: b31crvl(), b31gacd(), b31gacl(), b31gafr(), b31gdep(), b31gsap()

Examples

library(pipenostics)

# Typical status for the most of pipes:
b31gops(.438, .1)

# Alert! Corrosion depth is too high! Replace the pipe!
b31gops(.5, .41)

ASME B31G. Failure pressure of the corroded pipe (original)

Description

Calculate failure pressure of the corroded pipe according to Original B31G, Level-1 algorithm listed in ASME B31G-2012.

The next assumption of the corrosion shape is adopted by ASME B31G-2012:

b31gpf.png

There (a) is a parabolic and (b) is a rectangular idealizations of a corroded area.

Usage

b31gpf(d, wth, smys, depth, l)

Arguments

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

smys

specified minimum yield of stress (SMYS) as a characteristics of steel strength, [PSI]. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [inch]. Type: assert_double.

Details

Since the definition of flow stress, Sflow, in ASME B31G-2012 is recommended with Level 1 as follows:

Sflow=1.1SMYSS_{\text{flow}} = 1.1\cdot\text{SMYS}

no other possibilities of its evaluation are incorporated.

For this code we avoid possible semantic optimization to preserve readability and correlation with original text description in ASME B31G-2012. At the same time source code for estimated failure pressure preserves maximum affinity with its semantic description in ASME B31G-2012 and slightly differs from that given by Timashev et al. The latter deviates up to 0.7 % on examples supplied with CRVL.BAS - (b31gdata).

Numeric NAs may appear in case prescribed conditions of use are offended.

Value

Estimated failure pressure of the corroded pipe, [PSI]. Type: assert_double.

References

  1. ASME B31G-2012. Manual for determining the remaining strength of corroded pipelines: supplement to B31 Code for pressure piping.

  2. S. Timashev and A. Bushinskaya, Diagnostics and Reliability of Pipeline Systems, Topics in Safety, Risk, Reliability and Quality 30, doi:10.1007/978-3-319-25307-7.

See Also

Other Failure estimation: b31gmodpf(), dnvpf(), mepof(), pcorrcpf(), shell92pf()

Examples

library(pipenostics)

## Example: maximum percentage disparity of original B31G
## algorithm and modified B31G showed on CRVL.BAS data
with(b31gdata, {
  original  <- b31gpf(d, wth, smys, depth, l)
  modified  <- b31gmodpf(d, wth, smys, depth, l)
  round(max(100 * abs(1 - original / modified), na.rm = TRUE), 4)
})

## Example: plot disparity of original B31G algorithm and
## modified B31G showed on CRVL data
with(b31gdata[-(6:7),], {
  b31g  <- b31gpf(d, wth, smys, depth, l)
  b31gmod  <- b31gmodpf(d, wth, smys, depth, l)
  axe_range <- range(c(b31g, b31gmod))
  plot(b31g, b31g, type = 'b', pch = 16,
       xlab = 'Pressure, [PSI]',
       ylab = 'Pressure, [PSI]',
       main = 'Failure pressure method comparison',
       xlim = axe_range, ylim = axe_range)
  inc <- order(b31g)
  lines(b31g[inc], b31gmod[inc], type = 'b', col = 'red')
  legend('topleft',
         legend = c('B31G Original',
                    'B31G Modified'),
         col = c('black', 'red'),
         lty = 'solid')
})

ASME B31G. Safe maximum pressure for the corroded area of pipe

Description

Calculate safe maximum pressure for the corroded area of pipe.

Usage

b31gsap(dep, d, wth, depth, l)

Arguments

dep

design pressure of pipe, [PSI]. Type: assert_double.

d

nominal outside diameter of pipe, [inch]. Type: assert_double.

wth

nominal wall thickness of pipe, [inch]. Type: assert_double.

depth

measured maximum depth of the corroded area, [inch]. Type: assert_double.

l

measured maximum longitudinal length of the corroded area, [inch]. Type: assert_double.

Value

Safe maximum pressure for the corroded area of pipe, [PSI]. Type: assert_double.

References

ASME B31G-1991.Manual for determining the remaining strength of corroded pipelines. A supplement to ASTME B31 code for pressure piping.

See Also

Other ASME B31G: b31crvl(), b31gacd(), b31gacl(), b31gafr(), b31gdep(), b31gops()

Examples

library(pipenostics)

# safe pressure is equal to design pressure:
b31gsap(1093, 30, .438, .1, 7.5)

# safe pressure is lower than design pressure due corrosion:
b31gsap(877, 24, .281, .08, 15)

ASME B36.10M. Verify the alignment between nominal pipe diameter and wall thickness

Description

Check the correspondence inside nominal diameter/wall thickness value pair for pipes manufactured in accordance with regulatory standards.

Verification is performed using reference values from the b36pipedata-table. So, the result is TRUE if d- and w-value combination can be found in rows of this dataset.

Usage

b36dwthv(d, wth)

Arguments

d

nominal (outside) diameter of pipe, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

Value

Verification status. Type: assert_logical.

See Also

Other ASME B36.10M: b36mass(), b36pipedata

Examples

library(pipenostics)

# All pipes in test bench of district heating network have strictly
# consistent diameters and wall thicknesses:

all(b36dwthv(m325nxdata[["d"]], m325nxdata[["wth"]]))

ASME B36.10M. Estimate pipe mass

Description

Estimate mass or geometric specifications of the manufactured pipes

Usage

b36mass(d, wth, len = 1, rho = 7.85, origin = NULL)

b36d(wth, mass, len = 1, rho = 7.85)

b36wth(d, mass, len = 1, rho = 7.85)

Arguments

d

nominal outside diameter of pipe, [mm]. Type: assert_double

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length, [m]. Type: assert_double.

rho

mass density of pipe material, [g/cm³]. Type: assert_double.

origin

identifier for the information origin regarding the specifications of pipe. Type: assert_integer.

mass

actual mass of pipe, [kg]. Type: assert_double.

Details

The mass of a one-meter pipe segment is determined by linear interpolation based on the tabular data provided in the specified origins (see b36pipedata). If the origin of the initial data is NULL (default), the mass of the pipe is calculated using a formula:

M=103πρw(dw)lM = 10^{-3} \pi \rho w \left(d - w \right ) \cdot l

where

  • MM - mass of a pipe, [kg]

  • ρ\rho - mass density of pipe material, [g/cm³]

  • ww - nominal wall thickness of the manufactured pipe, [mm]

  • dd - nominal outside diameter of the manufactured pipe, [mm]

  • ll - actual pipe length, [m]

For origin in c(1, 2, 4, 5) the values provided in the b36pipedata match the calculated values obtained from the formula with an accuracy of 1 %.

Inverse calculations b36wth and b36d are performed using algebraically derived formulas.

Value

for b36mass

pipe mass, [kg]

for b36wth

pipe wall thickness, [mm]

for b36d

outside diameter of pipe, [mm]

See Also

Other ASME B36.10M: b36dwthv(), b36pipedata

Examples

library(pipenostics)

# Since some specification origins provide the mass of a one-meter pipe
# segment taking into account possible deviations during its production
# process, when the user specifies the origin ID directly, the mass values
# are calculated using linear interpolation:
b36mass(68, 13, rho = 7.9, origin = 7L)

# The discrepancy with the calculations based on the formula can be more
# than 7 %:
b36mass(68, 13, rho = 7.9, origin = NULL)

# For origins which are ASME B36 standards such differences should be
# minimal:
b36mass(965, 10.31, origin = 1L) - b36mass(965, 10.31, origin = NULL)

# The calculations of diameter and wall thickness are straightforward and
# use only inverse formulas without origin references:
b36d(10.31, 242.74)

b36wth(965, 242.74)

ASME B36.10M. Specifications of the manufactured pipes

Description

Data represents the nominal specifications of steel pipes produced by the industry according to regulatory standards.

Usage

b36pipedata

Format

A data frame with 6064 rows and 5 variables:

d

Nominal outside diameter of the manufactured pipe, [mm]. Type: assert_double.

wth

Nominal wall thickness of the manufactured pipe, [mm]. Type: assert_double.

rho

Nominal mass density of the steel rank applied in the pipe manufacturing, [g/cm³]. Type: assert_double.

mass

Nominal mass of one-meter length pipe segment, [kg]. Type: assert_double.

origin
1

ASME B36.10M-2018

2

ASME B36.19M-2018

3

GOST 20295-85. Table 1

4

GOST 33229-2015. Table 1

5

GOST 33229-2015. Table 2

6

GOST R 57423-2017. Table 1

7

GOST R 57423-2017. Table 2

8

GOST R 57423-2017. Table 3

9

GOST R 57423-2017. Table 4

Type: assert_integer.

NOTE! Due to numerous typos in origins with identifiers 4, 5 all mass values in those origins are the recalculations made with formula

M=0.02466w(dw)M = 0.02466 \cdot w\left(d - w \right )

where

  • MM - mass of one-meter pipe segment, [kg]

  • dd - nominal outside diameter of the manufactured pipe, [mm]

  • ww (wth) - nominal wall thickness of the manufactured pipe, [mm]

References

  1. ASME B36.10M-2018. Welded and seamless wrought steel pipe.

  2. ASME B36.19M-2018. Stainless steel pipe.

  3. GOST 20295-85. Steel welded pipes for main gas-and-oil pipelines. Specifications.

  4. GOST 33229-2015. Tubes for boiler and heat exchanging equipment. Technical specifications. Part 1. Seamless steel pipes to work under pressure. not more than 6,4 MPa and at temperatures not exceeding 400 °C

  5. GOST R 57423-2017. Tubes for boiler and heat exchanging equipment. Part 2. Seamless steel tubes for pressure purposes more 6.4 MPa and temperatures exceeding 400 °C. Specifications.

See Also

Other ASME B36.10M: b36dwthv(), b36mass()

Examples

library(pipenostics)

head(b36pipedata)

Convert to Celsius scale

Description

Convert temperature measured in Kelvin- or Fahrenheit-scale to Celsius (°C).

Usage

c_k(x)

c_f(x)

Arguments

x

temperature in initial scale:

Type: assert_double.

Value

Temperature in Celsius-scale, [°C]. Type: assert_double.

See Also

k_c and f_c for converting from Celsius-scale.

Other Measurement Unit Converter: f_k(), inch_mm(), k_c(), kgf_mpa(), loss_flux(), mm_inch(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

# Convert from Kelvin to Celsius:
c_k(c(0, 373.15))

# Convert from Fahrenheit to Celsius:
c_f(c(-459.67, 212))

DNV-RP-F101. Failure pressure of the corroded pipe

Description

Calculate failure pressure of the corroded pipe according to Section 8.2 of DNV-RP-F101. The estimation is valid for single isolated metal loss defects of the corrosion/erosion type and when only internal pressure loading is considered.

The next assumption of the corrosion shape is adopted by DNV-RP-F101:

dnvpf.png

There dcor represents argument depth.

Usage

dnvpf(d, wth, uts, depth, l)

Arguments

d

nominal outside diameter of pipe, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

uts

ultimate tensile strength (UTS) or specified minimum tensile strength (SMTS) as a characteristic of steel strength, [MPa]. Type: assert_double.

depth

measured maximum depth of the corroded area, [mm]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [mm]. Type: assert_double.

Details

In contrast to ASME B31G-2012 property of pipe metal is characterized by specified minimum tensile strength - SMTS, [N/mm²], and SI is default unit system. SMTS is given in the line pipe steel material specifications (e.g. API 5L) for each material grade.

At the same time Timashev et al. used ultimate tensile strength - UTS in place of SMTS. So, for the case those quantities may be used in interchangeable way.

Numeric NAs may appear in case prescribed conditions of use are offended.

Value

Estimated failure pressure of the corroded pipe, [MPa]. Type: assert_double.

References

  1. Recommended practice DNV-RP-F101. Corroded pipelines. DET NORSKE VERITAS, October 2010.

  2. ASME B31G-2012. Manual for determining the remaining strength of corroded pipelines: supplement to B31 Code for pressure piping.

  3. S. Timashev and A. Bushinskaya, Diagnostics and Reliability of Pipeline Systems, Topics in Safety, Risk, Reliability and Quality 30, doi:10.1007/978-3-319-25307-7.

See Also

Other Failure estimation: b31gmodpf(), b31gpf(), mepof(), pcorrcpf(), shell92pf()

Examples

library(pipenostics)

# Consider two pipes with the next specifications:
d     <- c(812.8, 219.0)  # [mm]
wth   <- c( 19.1,  14.5)  # [mm]
uts   <- c(530.9, 455.1)  # [N/mm²]
l     <- c(203.2, 200.0)  # [mm]
depth <- c( 13.4,   9.0)  # [mm]

# Get the failure pressure for that pipes:
dnvpf(d, wth, uts, depth, l)

Flow rate drop in pipe

Description

Calculate drop or recovery of flow rate in pipe using geometric factors.

The calculated value may be positive or negative. When it is positive they have the drop, i.e. the decrease of flow rate in the outlet of pipe under consideration. When the calculated value is negative they have the recovery, i.e. the increase of flow rate in the outlet of pipe under consideration. In both cases to calculate flow rate on the outlet of pipe under consideration simply subtract the calculated value from the sensor-measured flow rate on the inlet.

Usage

dropg(adj = 0, d = 700, flow_rate = 250)

Arguments

adj

diameters of adjacent pipes through which discharges to and recharges from network occur, [mm].

Types:

assert_double

total diameter of all adjacent pipes (total diameter case)

assert_list of assert_double

a set of diameters of adjacent pipes (particular diameter case)

Positive values of diameters of adjacent pipes correspond to discharging process through those pipe, whereas negative values of diameters mean recharging. See Details and Examples for further explanations.

d

diameter of pipe under consideration, [mm]. Type: assert_double.

flow_rate

sensor-measured amount of heat carrier (water) that is transferred through the inlet of pipe during a period, [ton/h]. Type: assert_double.

Details

It is common that sensor-measured flow rate undergoes discharges to network and recharges from it. For calculation of flow rate drop or recovery the next configuration of district heating network segment is assumed:

dropg.png

Usually, there are no additional sensors that could measure flow rate in each flow fork. In that case they only may operate with geometric factors, i.e. assuming that flow rate is proportional to square of pipe diameter.

The simple summation of flow rates over all adjacent pipes produces the required flow rate drop or recovery located on the outlet of the pipe under consideration. Since there is concurrency between discharges and recharges the diameters of discharge pipes are regarded positive whereas diameters of recharge pipes must be negative.

Be careful when dealing with geometric factors for large amount of recharges from network: there are no additional physical constraints and thus the calculated value of recovery may have non-sense.

Value

Flow rate drop or recovery at the outlet of pipe, [ton/h], numeric vector. The value is positive for drop, whereas for recovery it is negative. In both cases to calculate flow rate on the outlet of pipe under consideration simply subtract the calculated value from the sensor-measured flow rate on the inlet. Type: assert_double.

See Also

Other Regime tracing: dropp(), dropt(), m325tracebw(), m325tracefw(), m325traceline(), tracebw(), tracefw(), traceline()

Examples

library(pipenostics)

# Let consider pipes according to network segment scheme depicted in figure
# in [?dropg] help-page.

# Typical large diameters of pipes under consideration, [mm]:
d <- as.double(unique(subset(pipenostics::m325nhldata, d > 700)$d))

# Let sensor-measured flow rate in the inlet of pipe
# under consideration be proportional to d, [ton/h]:
flow_rate <- .125 * d

# Let consider total diameter case when total diameters of adjacent pipes are
# no more than d, [mm]:
adj <- c(450, -400, 950, -255, 1152)

# As at may be seen for the second and fourth cases they predominantly have
# recharges from network.
# Let calculate flow rate on the outlet of the pipe under consideration,
# [ton/h]

flow_rate - dropg(adj, d, flow_rate)

Pressure drop in pipe

Description

Calculate pressure drop in straight cylindrical steel pipe of district heating system (where water is a heat carrier) that is a result of pipe orientation in space (hydrostatic component), and friction between water and internal wall of pipe.

Usage

dropp(
  temperature = 130,
  pressure = mpa_kgf(6),
  flow_rate = 1276,
  d = 1,
  len = 1,
  roughness = 0.006,
  inlet = 0,
  outlet = 0,
  method = "romeo"
)

Arguments

temperature

temperature of heat carrier (water) inside the pipe, [°C]. Type: assert_double.

pressure

absolute pressure of heat carrier (water) measured at the entrance (inlet) of pipe, [MPa]. Type: assert_double.

flow_rate

amount of heat carrier (water) that is transferred by pipe during a period, [ton/h]. Type: assert_double.

d

internal diameter of pipe, [m]. Type: assert_double.

len

pipe length, [m]. Type: assert_double.

roughness

roughness of internal wall of pipe, [m]. Type: assert_double.

inlet

elevation of pipe inlet, [m]. Type: assert_double.

outlet

elevation of pipe outlet, [m]. Type: assert_double.

method

method of determining Darcy friction factor. Type: assert_choice. (see Details)

Details

The underlying engineering model for calculation of pressure drop considers only two contributions (components):

  1. Pressure drop due to gravity (hydrostatic component).

  2. Pressure drop due to friction.

The model does not consider any size changes of pipe and presence of fittings.

For the first component that depends on pipe position in space the next figure illustrates adopted disposition of pipe.

dropp.png

So, the expression for the first component can be written as:

gρ(oi)g \rho (o - i)

where gg - is gravity factor, m/s², and ρ\rho - density of water (heat carrier), kg/m³; ii (inlet) and oo (outlet) are appropriate pipe elevations (under sea or any other adopted level), m.

The second component comes from Darcy–Weisbach equation and is calculated using heating carrier regime parameters (temperature,pressure, flow_rate). Temperature and pressure values of heat carrier define water properties according to IAPWS formulation.

Several methods for calculating of Darcy friction factor are possible and limited to the next direct approximations of Colebrook equation:

romeo

Romeo, Royo and Monzon, 2002

vatankhah

Vatankhah and Kouchakzadeh, 2009

buzzelli

Buzzelli, 2008

According to Brkic, 2011 approximations errors of those methods do not exceed 0.15 % for the most combinations of Reynolds numbers and actual values of internal wall roughness of pipe.

Value

Pressure drop at the outlet of pipe, [MPa]. Type: assert_double.

References

  • W.Wagner et al. The IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam, J. Eng. Gas Turbines Power. Jan 2000, 122(1): 150-184 (35 pages).

  • M.L.Huber et al.New International Formulation for the Viscosity of H2OH_2O, Journal of Physical and Chemical Reference Data 38, 101 (2009).

  • D.Brkic. Journal of Petroleum Science and Engineering, Vol. 77,Issue 1, April 2011, Pages 34-48.

  • Romeo, E., Royo, C., Monzon, A., 2002. Improved explicit equation for estimation of friction factor in rough and smooth pipes. Chem. Eng. J. 86 (3), 369–374.

  • Vatankhah, A.R., Kouchakzadeh, S., 2009. Discussion: Exact equations for pipe-flow problems, by P.K. Swamee and P.N. Rathie. J. Hydraul. Res. IAHR 47 (7), 537–538.

  • Buzzelli, D., 2008. Calculating friction in one step. Mach. Des. 80 (12), 54–55.

See Also

dropt for calculating temperature drop in pipe

Other Regime tracing: dropg(), dropt(), m325tracebw(), m325tracefw(), m325traceline(), tracebw(), tracefw(), traceline()

Examples

library(pipenostics)

# Typical pressure drop for horizontal pipeline segments
# in high-way heating network in Novosibirsk:

dropp(len = c(200, 300))

Temperature drop in cylindrical steel pipe due heat loss

Description

Calculate temperature drop in steel pipe of district heating system (where water is a heat carrier) that is a result of heat loss through pipe wall and insulation.

Usage

dropt(
  temperature = 130,
  pressure = mpa_kgf(6),
  flow_rate = 250,
  loss_power = 7000
)

Arguments

temperature

temperature of heat carrier (water) inside the pipe measured at the inlet of pipe, [°C]. Type: assert_double.

pressure

absolute pressure of heat carrier (water) inside the pipe, [MPa]. Type: assert_double.

flow_rate

amount of heat carrier (water) that is transferred by pipe during a period, [ton/h]. Type: assert_double.

loss_power

power of heat loss - heat loss through area of pipe wall per hour, [kcal/h]. Type: assert_double.

Details

Specific isobaric heat capacity used in calculations is calculated according to IAPWS R7-97(2012) for Region 1 since it is assumed that state of water in district heating system is always in that region.

Value

Temperature drop at the outlet of pipe, [°C]. Type: assert_double.

See Also

Other Regime tracing: dropg(), dropp(), m325tracebw(), m325tracefw(), m325traceline(), tracebw(), tracefw(), traceline()

Examples

library(pipenostics)

# Calculate normative temperature drop based on Minenergo-325 for pipe
# segment
pipeline <- list(
  year   = 1968,
  laying = "channel",
  d      = 700, # [mm]
  len    = 1000 # [m]
)

regime <- list(
  temperature = c(130, 150), # [°C]
  pressure    = .588399,     # [MPa]
  flow_rate   = 250          # [ton/h]
)

pipe_loss_power <- do.call(
    m325nhl,
    c(pipeline, temperature = list(regime[["temperature"]]), duration = 1)
)

temperature_drop <- dropt(
  temperature = regime[["temperature"]], # [°C]
  loss_power  = pipe_loss_power          # [kcal/h]
)                                        # [°C]

print(temperature_drop)

Convert to Fahrenheit scale

Description

Convert temperature measured in Kelvin- or Celsius-scale to Fahrenheit (°F).

Usage

f_k(x)

f_c(x)

Arguments

x

temperature in initial scale:

  • for f_k(x) - in Kelvin-scale, [K]

  • for f_c(x) - in Celsius-scale, [°C]

Type: assert_double.

Value

Temperature in Fahrenheit-scale, [°F]. Type: assert_double.

See Also

k_f and c_f for converting from Fahrenheit-scale.

Other Measurement Unit Converter: c_k(), inch_mm(), k_c(), kgf_mpa(), loss_flux(), mm_inch(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

# Convert from Kelvin to Fahrenheit:
f_k(c(0, 373.15))

# Convert from Celsius to Fahrenheit:
f_c(c(-273.15, 100))

List all possible flow paths in district heating network

Description

Find and list all possible paths of heat carrier flow (water) in the given topology of district heating system.

Usage

flowls(sender = "A", acceptor = "B", use_cluster = FALSE)

Arguments

sender

identifier of the node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

identifier of the node which heat carrier flows in. According to topology of test bench considered this identifier should be unique. Type: any type that can be painlessly coerced to character by as.character.

use_cluster

utilize functionality of parallel processing on multi-core CPU. Type: assert_flag.

Details

Only branched topology without cycles is considered where no more than one incoming edge exists for every acceptor node. For instance, m325nxdata has permitted topology.

Though input arguments are natively vectorized their individual values all relate to common part of district heating network, i.e. associated with common object. It is due to isomorphism between vector representation and directed graph of this network. For more details of isomorphic topology description see m325nxdata.

Value

Named list that contains integer vectors as its elements. The name of each element in the list is the name of acceptor associated with terminal node of district heating network. Each vector in the list represents an ordered sequence of indexes in acceptor that enumerates incoming edges from starting node to terminal one. The length of returned link{list} is equal to number of terminal nodes for topology considered. Type: assert_list.

See Also

m325nxdata for example of topology of district heating system

Examples

library(pipenostics)

# Find path from A to B in trivial line topology:
flowls("A", "B")

# More complex example with two terminal nodes D and E:
flowls(c("A", "B", "B"), c("B", "D", "E"))

# All possible flow paths in test bench illustrated in `?m325nxdata`:
all_paths <- list(
  c(12, 13, 11, 8, 4, 1),  # hereinafter indexes of acceptor nodes
  c(12, 13, 11, 8, 4, 2),
  c(12, 13, 11, 8, 6, 5,  3),
  c(12, 13, 11, 8, 6, 7),
  c(12, 13, 11, 8, 6, 9),
  c(12, 13, 11, 10),
  c(12, 13, 14, 15),
  c(12, 13, 16, 17),
  c(12, 13, 16, 18, 20, 19),
  c(12, 13, 16, 18, 20, 21),
  c(12, 13, 16, 18, 22, 24),
  c(12, 13, 16, 18, 22, 25),
  c(12, 13, 16, 18, 20, 23, 26)
)

# find those paths:
with(m325nxdata, flowls(sender, acceptor))

Estimate pipe friction factor with Buzzelli formula

Description

Estimate Darcy friction factor explicitly with extremely accurate Buzzelli approximation of Colebrook equation.

Usage

fric_buzzelli(reynolds, roughness = 0, strict = FALSE)

Arguments

reynolds

Reynolds number, []. Type: assert_double.

roughness

relative roughness, []. Type: assert_double.

strict

calculate only inside the precision region. Type: assert_flag.

Details

Buzzelli's formula is reported to be extremely accurate in the region:

  • 3.0e3 <= reynolds <= 3.0e8

  • 0 <= roughness <= 0.05

In strict = TRUE mode argument values outside this precision region are not allowed, whereas in strict = FALSE either NAs are generated in that case or calculation for laminar flow is performed when reynolds < 2100.0.

Value

Pipe friction factor, []. Type: assert_double.

References

  1. Offor, U. and Alabi, S. (2016) An Accurate and Computationally Efficient Explicit Friction Factor Model. Advances in Chemical Engineering and Science, 6, pp. 237-245. doi:10.4236/aces.2016.63024.

  2. Buzzelli, D. (2008) Calculating friction in one step. Machine Design, 80 (12), pp. 54–55.

See Also

Other Fluid properties: fric_romeo(), fric_vatankhan(), re_u()

Examples

library(pipenostics)

fric_buzzelli(c(2118517, 2000, 2118517), c(1e-6, 70e-3/1, 7e-3/1))

fric_buzzelli(c(2118517, 5500, 2118517), c(1e-6, 50e-3/1, 7e-3/1), TRUE)

Estimate pipe friction factor with Romeo's formula

Description

Estimate Darcy friction factor explicitly with extremely accurate Romeo-Royo-Monzón approximation of Colebrook equation.

Usage

fric_romeo(reynolds, roughness = 0, strict = FALSE)

Arguments

reynolds

Reynolds number, []. Type: assert_double.

roughness

relative roughness, []. Type: assert_double.

strict

calculate only inside the precision region. Type: assert_flag.

Details

Romeo's formula is reported to be extremely accurate in the region:

  • 3.0e3 <= reynolds <= 1.5e8

  • 0.0 <= roughness <= 0.05

In strict = TRUE mode argument values outside this precision region are not allowed, whereas in strict = FALSE either NAs are generated in that case or calculation for laminar flow is performed when reynolds < 2100.0.

Value

Pipe friction factor, []. Type: assert_double.

References

  1. Offor, U. and Alabi, S. (2016) An Accurate and Computationally Efficient Explicit Friction Factor Model. Advances in Chemical Engineering and Science, 6, pp. 237-245. doi:10.4236/aces.2016.63024.

  2. Eva Romeo, Carlos Royo, Antonio Monzón, Improved explicit equations for estimation of friction factor in rough and smooth pipes, Chemical Engineering Journal, Volume 86, Issue 3, 2002, Pages 369-374, ISSN 1385-8947. doi:10.1016/S1385-8947(01)00254-6.

See Also

Other Fluid properties: fric_buzzelli(), fric_vatankhan(), re_u()

Examples

library(pipenostics)

fric_romeo(c(2118517, 2000, 2118517), c(0, 70e-3/1, 7e-3/1))

fric_romeo(c(2118517, 3030, 2118517), c(0, 50e-3/1, 7e-3/1), TRUE)

Estimate pipe friction factor with Vatankhah formula

Description

Estimate Darcy friction factor explicitly with extremely accurate Vatankhah-Kouchakzadeh approximation of Colebrook equation.

Usage

fric_vatankhan(reynolds, roughness = 0, strict = FALSE)

Arguments

reynolds

Reynolds number, []. Type: assert_double.

roughness

relative roughness, []. Type: assert_double.

strict

calculate only inside the precision region. Type: assert_flag.

Details

Vatankhah's formula is reported to be extremely accurate in the region:

  • 5.0e3 <= reynolds <= 1.0e8

  • 1e-6 <= roughness <= 0.05

In strict = TRUE mode argument values outside this precision region are not allowed, whereas in strict = FALSE either NAs are generated in that case or calculation for laminar flow is performed when reynolds < 2100.0.

Value

Pipe friction factor, []. Type: assert_double.

References

  1. Offor, U. and Alabi, S. (2016) An Accurate and Computationally Efficient Explicit Friction Factor Model.Advances in Chemical Engineering and Science, 6, pp. 237-245. doi:10.4236/aces.2016.63024.

  2. Ali R. Vatankhah, Salah Kouchakzadeh (2009) Exact equations for pipe-flow problems.Journal of Hydraulic Research, 47:4, pp. 537-538, doi:10.1080/00221686.2009.9522031.

See Also

Other Fluid properties: fric_buzzelli(), fric_romeo(), re_u()

Examples

library(pipenostics)

fric_vatankhan(c(2118517, 2000, 2118517), c(1e-6, 70e-3/1, 7e-3/1))

fric_vatankhan(c(2118517, 5500, 2118517), c(1e-6, 50e-3/1, 7e-3/1), TRUE)

Calculate geographical metrics

Description

Calculate geographical metrics (distance, area) for two or three geographical locations.

Usage

geoarea(lat1, lon1, lat2, lon2, lat3, lon3, earth = 6371008.7714)

geodist(lat1, lon1, lat2, lon2, earth = 6371008.7714)

Arguments

lat1

latitude of the first geographical location, [DD]. Type: assert_double.

lon1

longitude of the first geographical location, [DD]. Type: assert_double.

lat2

latitude of the second geographical location, [DD]. Type: assert_double.

lon2

longitude of the second geographical location, [DD]. Type: assert_double.

lat3

latitude of the third geographical location, [DD]. Type: assert_double.

lon3

longitude of the third geographical location, [DD]. Type: assert_double.

earth

Earth radius, [m]. See Details. Type: assert_numeric.

Details

geodist calculates distance between two geographical locations on Earth, whereas geoarea calculates the area of spherical triangle between three geographical locations. Both functions use absolute positions of geographical locations described by geographical coordinate system in decimal degrees units denoted as DD. The haversine formula is applied to calculate the distance, and so the spherical model of Earth is considered in both functions.

Since several variants of Earth radius can be accepted, the user is welcome to provide its own value. WGS-84 mean radius of semi-axes,R1R_1, is the default value.

The resulting distance is expressed in metres (m), whereas the area is expressed in square kilometers (km²).

Value

For geodist:

distance between two geographical locations, [m].

For geoarea:

area of spherical triangle between three geographical locations, [km²].

Type: assert_double.

See Also

Other Geo Information: meteos(), mgtdhid()

Examples

library(pipenostics)

# Consider the longest linear pipeline segment in Krasnoyarsk, [DD]:
pipe <- list(
  lat1 = 55.98320350, lon1 = 92.81257226,
  lat2 = 55.99302417, lon2 = 92.80691885
)

# and some official Earth radii, [m]:
R <- c(
  nominal_zero_tide_equatorial = 6378100.0000,
  nominal_zero_tide_polar      = 6356800.0000,
  equatorial_radius            = 6378137.0000,
  semiminor_axis_b             = 6356752.3141,
  polar_radius_of_curvature    = 6399593.6259,
  mean_radius_R1               = 6371008.7714,
  same_surface_R2              = 6371007.1810,
  same_volume_R3               = 6371000.7900,
  WGS84_ellipsoid_axis_a       = 6378137.0000,
  WGS84_ellipsoid_axis_b       = 6356752.3142,
  WGS84_ellipsoid_curvature_c  = 6399593.6258,
  WGS84_ellipsoid_R1           = 6371008.7714,
  WGS84_ellipsoid_R2           = 6371007.1809,
  WGS84_ellipsoid_R3           = 6371000.7900,
  GRS80_axis_a                 = 6378137.0000,
  GRS80_axis_b                 = 6356752.3141,
  spherical_approx             = 6366707.0195,
  meridional_at_the_equator    = 6335439.0000,
  Chimborazo_maximum           = 6384400.0000,
  Arctic_Ocean_minimum         = 6352800.0000,
  Averaged_center_to_surface   = 6371230.0000
)

# Calculate length of the pipeline segment for different radii:
len <- with(
  pipe, vapply(
    R, geodist, double(1), lat1 = lat1, lon1 = lon1, lat2 = lat2, lon2 = lon2
  )
)

range(len)

# Consider some remarkable objects on Earth, [DD]:
objects <- rbind(
  Mount_Kailash      = c(lat = 31.069831297551982, lon =  81.31215667724196),
  Easter_Island_Moai = c(lat =-27.166873910247862, lon =-109.37092217323053),
  Great_Pyramid      = c(lat = 29.979229451772856, lon =  31.13418110843685),
  Antarctic_Pyramid  = c(lat = -79.97724194984573, lon = -81.96170583068950),
  Stonehendge        = c(lat = 51.179036665131870, lon =-1.8262150017463086)
)

# Consider all combinations of distances between them:
path <- t(combn(rownames(objects), 2))

d <- geodist(
  lat1 = objects[path[, 1], "lat"],
  lon1 = objects[path[, 1], "lon"],
  lat2 = objects[path[, 2], "lat"],
  lon2 = objects[path[, 2], "lon"]
) * 1e-3

cat(
  paste(
    sprintf("%s <--- %1.4f km ---> %s", path[, 1], d, path[, 2]),
    collapse = "\n"
)
)

# Consider two areas
#         * Bermuda triangle     * Polynesian Triangle
lat1 <- c(Miami   =  25.789106,  Hawaii       =   19.820680)
lon1 <- c(Miami   = -80.226529,  Hawaii       = -155.467989)

lat2 <- c(Bermuda =  32.294887,  NewZeland    =  -43.443219)
lon2 <- c(Bermuda = -64.781380,  NewZeland    =  170.271360)

lat3 <- c(SanJuan =  18.466319,  EasterIsland =  -27.112701)
lon3 <- c(SanJuan = -66.105743,  EasterIsland = -109.349668)

# Area provided by manually operated Google Earth:
GETriangleArea <- c(
  Bermuda    =  1147627.48,  # [km²]
  Polynesian = 28775517.77   # [km²]
)

# Show the discrepancy in calculations, [km²]:
geoarea(lat1, lon1, lat2, lon2, lat3, lon3) - GETriangleArea

Millimeters to inches

Description

Convert length measured in millimeters (mm) to inches

Usage

inch_mm(x)

Arguments

x

length measured in millimeters, [mm]. Type: assert_double.

Value

Length in inches, [inch]. Type: assert_double.

See Also

mm_inch for converting inches to mm

Other Measurement Unit Converter: c_k(), f_k(), k_c(), kgf_mpa(), loss_flux(), mm_inch(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

inch_mm(c(25.4, 1))

Covert to Kelvin scale

Description

Convert temperature measured in Celsius- or Fahrenheit-scale to Kelvin (K).

Usage

k_c(x)

k_f(x)

Arguments

x

temperature in initial scale:

Type: assert_double.

Value

Temperature in Kelvin-scale, [K]. Type: assert_double.

See Also

c_k and f_k for converting from Kelvin-scale.

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), kgf_mpa(), loss_flux(), mm_inch(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

# Convert from Celsius to Kelvin:
k_c(c(-273.15, 100))

# Convert from Fahrenheit to Kelvin:
k_f(c(-459.67, 212))

Megapascals to kilogram-force per square

Description

Convert pressure (stress) measured in megapascals (MPa) to kilogram-force per square cm (kgf/cm²).

Usage

kgf_mpa(x)

Arguments

x

pressure (stress) measured in megapascals, [MPa]. Type: assert_double.

Value

Pressure (stress) in kilogram-force per square cm, [kgf/cm²]. Type: assert_double.

See Also

mpa_kgf for converting kilogram-force per square cm to megapascals

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), k_c(), loss_flux(), mm_inch(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

kgf_mpa(c(0.0980665, 1))

Convert heat flux to specific heat loss power

Description

Convert heat flux measured for a cylindrical steel pipe to specific heat loss power of pipe.

Usage

loss_flux(x, d = 720)

flux_loss(x, d = 720)

Arguments

x

value of

  • heat flux, [W/m²], for loss_flux(x, d, wth)

  • specific heat loss power, [kcal/m/h], for flux_loss(x, d, wth)(x)

Type: assert_double.

d

nominal (outside) diameter of pipe, [mm]. Type: assert_double.

Value

Value of

  • specific heat loss power, [kcal/m/h], for loss_flux(x, d, wth)

  • heat flux, [W/m²], for flux_loss(x, d, wth)(x)

Type: assert_double.

See Also

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), k_c(), kgf_mpa(), mm_inch(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

# Consider pipes with nominal (outside) diameters:
d <- c(998, 1395)  # [mm]

# Then maximum possible normative neat loss according (Minenergo-325) is
loss_max <- c(218, 1040)  # [kcal/m/h]

# The appropriate flux is
flux <- flux_loss(loss_max, d)
print(flux)

stopifnot(all.equal(loss_flux(flux, d), loss_max, tolerance = 1e-5))

Minenergo-278. Normative heat loss of open-air pipe

Description

Calculate normative heat loss through the thermal insulation of the open-air supplying pipe as a function of construction, operation, and technical condition specifications according to Appendix 5.1 of Minenergo Method 278.

This type of calculations is usually made on design stage of district heating network (where water is a heat carrier) and is closely related to building codes and regulations.

Usage

m278hlair(
  t1 = 110,
  t2 = 60,
  t0 = 5,
  insd1 = 0.1,
  insd2 = insd1,
  d1 = 0.25,
  d2 = d1,
  lambda1 = 0.09,
  lambda2 = 0.07,
  k1 = 1,
  k2 = k1,
  lambda0 = 26,
  len = 1,
  duration = 1
)

Arguments

t1

temperature of heat carrier (water) inside the supplying pipe, [°C]. Type: assert_double.

t2

temperature of heat carrier (water) inside the returning pipe, [°C]. Type: assert_double.

t0

temperature of environment, [°C]. In case of open-air pipe this is the ambient temperature. Type: assert_double.

insd1

thickness of the insulator which covers the supplying pipe, [m]. Type: assert_double.

insd2

thickness of the insulator which covers the returning pipe, [m]. Type: assert_double.

d1

outside diameter of supplying pipe, [m]. Type: assert_double.

d2

outside diameter of returning pipe, [m]. Type: assert_double.

lambda1

thermal conductivity of insulator which covers the supplying pipe [W/m/°C]. Type: assert_double.

lambda2

thermal conductivity of insulator which covers the returning pipe [W/m/°C]. assert_double.

k1

technical condition factor for insulator of supplying pipe, []. Type: assert_double.

k2

technical condition factor for insulator of returning pipe, []. Type: assert_double.

lambda0

thermal conductivity of environment, [W/m/°C]. In case of overhead laying this is the thermal conductivity of open air. Type: assert_double.

len

length of supplying pipe, [m]. Type: assert_double.

duration

duration of heat loss, [h]. Type: assert_double.

Details

Details on using k1 and k2 are the same as for m278hlcha.

Value

Normative heat loss of the open-air laid supplying cylindrical pipe during duration, [kcal]. If len of pipe is 1 m (meter) as well as duration is set to 1 h (hour) (default values) then the return value is also the specific heat loss power, [kcal/m/h] and so comparable with those prescribed by Minenergo Order 325. Type: assert_double.

See Also

Other Minenergo: m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

m278hlair()

Minenergo-278. Normative heat loss of pipe in channel

Description

Calculate normative heat loss through the thermal insulation of the supplying pipe mounted in underground channel as a function of construction, operation, and technical condition specifications according to Appendix 5.1 of Minenergo Method 278.

This type of calculations is usually made on design stage of district heating network (where water is a heat carrier) and is closely related to building codes and regulations.

Usage

m278hlcha(
  t1 = 110,
  t2 = 60,
  t0 = 5,
  insd1 = 0.1,
  insd2 = insd1,
  d1 = 0.25,
  d2 = d1,
  lambda1 = 0.09,
  lambda2 = 0.07,
  k1 = 1,
  k2 = k1,
  lambda0 = 1.74,
  z = 2,
  b = 0.5,
  h = 0.5,
  len = 1,
  duration = 1
)

Arguments

t1

temperature of heat carrier (water) inside the supplying pipe, [°C]. Type: assert_double.

t2

temperature of heat carrier (water) inside the returning pipe, [°C]. Type: assert_double.

t0

temperature of environment, [°C]. In case of channel laying this is the temperature of subsoil. Type: assert_double.

insd1

thickness of the insulator which covers the supplying pipe, [m]. Type: assert_double.

insd2

thickness of the insulator which covers the returning pipe, [m]. Type: assert_double.

d1

outside diameter of supplying pipe, [m]. Type: assert_double.

d2

outside diameter of returning pipe, [m]. Type: assert_double.

lambda1

thermal conductivity of insulator which covers the supplying pipe [W/m/°C]. Type: assert_double.

lambda2

thermal conductivity of insulator which covers the returning pipe [W/m/°C]. Type: assert_double.

k1

technical condition factor for insulator of supplying pipe, []. Type: assert_double.

k2

technical condition factor for insulator of returning pipe, []. Type: assert_double.

lambda0

thermal conductivity of environment, [W/m/°C]. In case of channel laying this is the thermal conductivity of subsoil. Type: assert_double.

z

channel laying depth, [m]. Type: assert_double.

b

channel width, [m]. Type: assert_double.

h

channel height, [m]. Type: assert_double.

len

length of supplying pipe, [m]. Type: assert_double.

duration

duration of heat loss, [h]. Type: assert_double.

Details

k1 and k2 factor values equal to 1 mean the best technical condition of insulation of appropriate pipes, whereas for poor technical state factor values tends to 5 or more.

Nevertheless, when k1 and k2 both equal to 1 the calculated specific heat loss power [kcal/m/h] is sometimes higher than that listed in Minenergo Order 325. One should consider that situation when choosing method for heat loss calculations.

Value

Normative heat loss of supplying cylindrical pipe mounted in channel during duration, [kcal]. If len of pipe is 1 m (meter) as well as duration is set to 1 h (hour) (default values) then the return value is also the specific heat loss power, [kcal/m/h] and so comparable with those prescribed by Minenergo Order 325. Type: assert_double.

See Also

Other Minenergo: m278hlair(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

m278hlcha()

## Naive way to find out technical state (factors k1 and k2) for pipe
## segments constructed in 1980:
optim(
  par = c(1.5, 1.5),
  fn = function(x) {
  # functional to optimize
    abs(
        m278hlcha(k1 = x[1], k2 = x[2]) -
        m325nhl(
          year = 1980, laying = "channel", d = 250, temperature = 110
        )
    )
  },
  method = "L-BFGS-B",
  lower = 1.01, upper = 4.4
)$par

Minenergo-278. Normative heat loss of underground pipe

Description

Calculate normative heat loss through the thermal insulation of the supplying underground pipe as a function of construction, operation, and technical condition specifications according to Appendix 5.1 of Minenergo Method 278.

This type of calculations is usually made on design stage of district heating network (where water is a heat carrier) and is closely related to building codes and regulations.

Usage

m278hlund(
  t1 = 110,
  t2 = 60,
  t0 = 5,
  insd1 = 0.1,
  insd2 = insd1,
  d1 = 0.25,
  d2 = d1,
  lambda1 = 0.09,
  lambda2 = 0.07,
  k1 = 1,
  k2 = k1,
  lambda0 = 1.74,
  z = 2,
  s = 0.55,
  len = 1,
  duration = 1
)

Arguments

t1

temperature of heat carrier (water) inside the supplying pipe, [°C]. Type: assert_double.

t2

temperature of heat carrier (water) inside the returning pipe, [°C]. Type: assert_double.

t0

temperature of environment, [°C]. For underground pipe this is the temperature of subsoil. Type: assert_double.

insd1

thickness of the insulator which covers the supplying pipe, [m]. Type: assert_double.

insd2

thickness of the insulator which covers the returning pipe, [m]. Type: assert_double.

d1

outside diameter of supplying pipe, [m]. Type: assert_double.

d2

outside diameter of returning pipe, [m]. Type: assert_double.

lambda1

thermal conductivity of insulator which covers the supplying pipe [W/m/°C]. Type: assert_double.

lambda2

thermal conductivity of insulator which covers the returning pipe [W/m/°C]. Type: assert_double.

k1

technical condition factor for insulator of supplying pipe, []. Type: assert_double.

k2

technical condition factor for insulator of returning pipe, []. Type: assert_double.

lambda0

thermal conductivity of environment, [W/m/°C]. For underground pipe this is the thermal conductivity of subsoil. Type: assert_double.

z

underground laying depth of supplying pipe, [m]. Type: assert_double.

s

distance between supplying and returning pipes, [m]. Type: assert_double.

len

length of supplying pipe, [m]. Type: assert_double.

duration

duration of heat loss, [h]. Type: assert_double.

Details

Details on using k1 and k2 are the same as for m278hlcha.

Value

Normative heat loss of supplying underground cylindrical pipe during duration, [kcal]. If len of pipe is 1 m (meter) as well as duration is set to 1 h (hour) (default values) then the return value is also the specific heat loss power, [kcal/m/h] and so comparable with those prescribed by Minenergo Order 325. Type: assert_double.

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

m278hlund()

Minenergo-278. Thermal conductivity terms of pipe insulation materials

Description

Data represent values of terms (intercept and factor) for calculating thermal conductivity of pipe insulation as a linear function of temperature of heat carrier (water).

Usage

m278insdata

Format

A data frame with 39 rows and 4 variables:

id

Number of insulation material table 5.1 of Appendix 5.3 in Minenergo Method 278. Type: assert_integerish.

material

Designation of insulation material more or less similar to those in table 5.1 of Appendix 5.3 in Minenergo Method 278. Type: assert_character.

lambda

Value for intercept, [mW/m/°C]. Type: assert_integer.

k

Value for factor. Type: assert_integer.

Details

Those values are set for different insulation materials in Appendix 5.3 of Minenergo Method 278 as norms.

Usually the data is not used directly. Instead use function m278inshcm.

Source

https://docs.cntd.ru/document/1200035568

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

head(m278insdata)

Minenergo-278. Thermal conductivity of pipe insulation materials

Description

Get normative values of thermal conductivity of pipe insulation materials affirmed by Minenergo Method 278 as a function of temperature of heat carrier (water).

Usage

m278inshcm(temperature = 110, material = "aerocrete")

Arguments

temperature

temperature of heat carrier (water) inside the pipe, [°C]. Type: assert_double.

material

designation of insulation material as it stated in m278insdata. Type: assert_subset.

Value

Thermal conductivity of insulation materials at given set of temperatures, [W/m/°C], [W/m/K]. Type: assert_double.

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278soildata, m325beta(), m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

# Range of thermal conductivity of pipe insulation at 110 °C:

range(m278inshcm(110, m278insdata[["material"]]))

Minenergo-278. Thermal conductivity of subsoil surrounding pipe

Description

Data represent normative values of thermal conductivity of subsoils which can surround pipes according to Table 5.3 of Appendix 5.3 in Minenergo Method 278.

Usage

m278soildata

Format

A data frame with 15 rows and 3 variables:

subsoil

Geological name of subsoil. Type: assert_character.

state

The degree of water penetration to the subsoil. Type: assert_character.

lambda

Value of thermal conductivity of subsoil regarding water penetration, [W/m/°C]. Type: assert_double.

Source

https://docs.cntd.ru/document/1200035568

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m325beta(), m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

head(m278soildata)

Minenergo-325. Local heat loss coefficient

Description

Calculate β\beta - local heat loss coefficient according to rule 11.3.3 of Minenergo Order 325. Local heat loss coefficient is used to increase normative heat loss of pipe by taking into account heat loss of fittings (shut-off valves, compensators and supports). This coefficient is applied mostly as a factor during the summation of heat losses of pipes in pipeline leveraging formula 14 of Minenergo Order 325.

Usage

m325beta(laying = "channel", d = 700)

Arguments

laying

type of pipe laying depicting the position of pipe in space:

  • air,

  • channel,

  • room,

  • tunnel,

  • underground.

Type: assert_subset.

d

nominal (outside) diameter of pipe, [mm]. Type: assert_double.

Value

Two possible values of β\beta: 1.2 or 1.15 depending on pipe laying and its diameter. Type: assert_double.

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325nhl(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

norms <- within(m325nhldata, {
  beta <- m325beta(laying, as.double(d))
})
unique(norms$beta)

Minenergo-325. Normative heat loss of pipe

Description

Calculate normative heat loss of pipe through the thermal insulation that is legally affirmed by Minenergo Order 325.

Usage

m325nhl(
  year = 1986,
  laying = "underground",
  exp5k = TRUE,
  insulation = 0,
  d = 700,
  temperature = 110,
  len = 1,
  duration = 1,
  beta = FALSE,
  extra = 2
)

Arguments

year

year when the pipe is put in operation after laying or total overhaul. Type: assert_integerish

laying

type of pipe laying depicting the position of pipe in space:

  • air,

  • channel,

  • room,

  • tunnel,

  • underground.

Type: assert_subset.

exp5k

pipe regime flag: is pipe operated more that 5000 hours per year? Type: assert_logical.

insulation

insulation that covers the exterior of pipe:

0

no insulation

1

foamed polyurethane or analogue

2

polymer concrete

Type: assert_integer and assert_subset.

d

nominal (outside) diameter of pipe, [mm]. Type: assert_double.

temperature

temperature of heat carrier (water) inside the pipe, [°C]. Type: assert_double.

len

length of pipe, [m]. Type: assert_double.

duration

duration of heat loss, [h]. Type: assert_double.

beta

should they consider additional heat loss of fittings? Type: assert_logical.

extra

number of points used for temperature extrapolation: 2, 3, or 4. Type: assert_choice.

Details

Temperature extrapolation and pipe diameter interpolation are leveraged for better accuracy. Both are linear as it dictated by Minenergo Order 325. Nevertheless, one could control the extrapolation behaviour by extra argument: use lower values of extra for soft curvature near extrapolation edges, and higher values for more physically reasoned behaviour in far regions of extrapolation.

Value

Normative heat loss of cylindrical pipe during duration, [kcal]. If len of pipe is 1 m (meter) as well as duration is set to 1 h (hour) (default values) then the return value is also the specific heat loss power, [kcal/m/h], prescribed by Minenergo Order 325. Type: assert_double.

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhldata, m325nvl(), m325nxdata

Examples

library(pipenostics)

## Consider a one-meter length pipe with
pipe_diameter <-  700.0  # [mm]
pipe_dating   <- 1980
pipe_laying   <- "underground"


## Linear extrapolation adopted in Minenergo's Order 325 using last two
## points:
operation_temperature <- seq(0, 270, 10)

qs <- m325nhl(
  year = pipe_dating, laying = pipe_laying, d = pipe_diameter,
  temperature = operation_temperature
)  # [kcal/m/h]

plot(
    operation_temperature,
    qs,
    type = "b",
    main = "Minenergo's Order 325. Normative heat loss of pipe",
    sub = sprintf(
      "%s pipe of (outside) diameter %i [mm] laid in %i",
       pipe_laying, pipe_diameter, pipe_dating
    ),
    xlab = "Temperature, [°C]",
    ylab = "Specific heat loss power, [kcal/m/h]"
  )


## Consider heat loss due fittings:
operation_temperature <- 65  # [°C]

m325nhl(
  year = pipe_dating, laying = pipe_laying, d = pipe_diameter,
  temperature = operation_temperature, beta = c(FALSE, TRUE)
)  # [kcal/m/h]

Minenergo-325. Normative heat loss data

Description

Data represent values of specific heat loss power through the thermal insulation officially accepted by Minenergo Order 325 as norms. Those values are maximums which are legally affirmed to contribute to normative heat loss QNHLQ_{NHL} of district heating systems with water as a heat carrier.

Usage

m325nhldata

Format

A data frame with 17328 rows and 8 variables:

source

Identifier of data source: identifiers suited with glob t?p? mean appropriate table ?.? in Minenergo Order 325; identifier sgc means that values are additionally postulated (see Details). Type: assert_character.

epoch

Year depicting the epoch when the pipe is put in operation after laying or total overhaul. Type: assert_integer.

laying

Type of pipe laying depicting the position of pipe in space. Only five types of pipe laying are considered:

  • air,

  • channel,

  • room,

  • tunnel,

  • underground.

Type: assert_character.

exp5k

Logical indicator for pipe regime: if TRUE pipe is operated more that 5000 hours per year. Type: assert_logical.

insulation

Identifier of insulation that covers the exterior of pipe:

0

no insulation

1

foamed polyurethane or analogue

2

polymer concrete

Type: assert_integerish.

d

Nominal (outside) diameter of pipe, [mm]. Type: assert_double.

temperature

Operational temperature of pipe, [°C]. Type: assert_double.

loss

Normative value of specific heat loss power equal to heat flux output by one-meter length steel pipe during an hour, [kcal/m/h]. Type: assert_double.

Details

Data is organized as a full factorial design, whereas for some factorial combinations Minenergo Order 325 does not provide values. For that cases values are postulated by practical reasons in Siberian cities and marked with source label sgc.

Usually the data is not used directly. Instead use function m325nhl.

Source

https://docs.cntd.ru/document/902148459

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nvl(), m325nxdata

Examples

library(pipenostics)

head(m325nhldata)

Minenergo-325. Normative material loss of pipe

Description

Calculate normative material loss of heat carrier (water) from cylindrical pipe according to rule 10.1.2 of Minenergo Order 325.

Usage

m325nvl(a = 0, d = 720, wth = 12, len = 1)

m325nml(
  temperature = 130,
  pressure = mpa_kgf(6),
  a = 0,
  d = 720,
  wth = 12,
  len = 1
)

Arguments

a

heat carrier (water) volume loss factor of cylindrical pipe, [h⁻¹]. Type: assert_double.

d

nominal (outside) diameter of pipe, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length, [m]. Type: assert_double.

temperature

temperature of heat carrier (water) inside the pipe, [°C]. Type: assert_double.

pressure

absolute pressure of heat carrier (water) inside the pipe, [MPa]. Type: assert_double.

Details

The calculations are based on the a-factor, which may be treated as the maximum allowed rate of heat carrier (water) volume loss per hour. So, its value varies from 0.0 h⁻¹ (no loss of heat carrier) up to 0.0025 h⁻¹ (maximum possible loss allowed). The cylindrical form of pipe is always assumed in calculations.

Value

For m325nvl

volume loss of heat carrier per hour, [m³/h].

For m325nml

mass loss of heat carrier per hour, [ton/h].

Type: assert_double.

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nhldata, m325nxdata

Examples

library(pipenostics)

# According to Minenergo-325 it may be granted to loose right up to the next
# value of tons of heat carrier (water) per year (nine-month heating season)
# for the typical supplying 100-meter length pipe:
m325nml(a = 0.0025, len = 100) * 24 * 90

Minenergo-325. Test bench of district heating network

Description

Data describes a virtual test bench of branched district heating network by exposing parameters associated with Minenergo Order 325. They treat data as a snapshot of network state and use it primarily for static thermal-hydraulic computations and topology effects.

Usage

m325nxdata

Format

A data frame with 26 rows (number of nodes and incoming edges) and 17 variables:

sender

An identifier of node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

An identifier of node which heat carrier flows in. According to topology of test bench considered this identifier should be unique for every row. Type: any type that can be painlessly coerced to character by as.character.

temperature

Snapshot of thermal-hydraulic regime state: temperature of heat carrier (water) sensor-measured on terminal acceptor node, [°C]. Type: assert_double. NAs are introduced for nodes without temperature sensor.

pressure

Snapshot of thermal-hydraulic regime state: sensor-measured absolute pressure of heat carrier (water) inside the pipe (i.e. acceptor's incoming edge), [MPa]. Type: assert_double. NAs are introduced for nodes without pressure sensor.

flow_rate

Snapshot of thermal-hydraulic regime state: sensor-measured amount of heat carrier (water) on terminal node that is transferred by pipe (i.e. acceptor's incoming edge) during a period, [ton/h]. Type: assert_double. NAs are introduced for nodes without flow rate sensor.

a

Heat carrier (water) volume loss factor of cylindrical pipe, [h⁻¹]. Type: assert_double.

d

nominal (outside) diameter of pipe (i.e.diameter of acceptor's incoming edge), [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length (i.e. length of acceptor's incoming edge), [m]. Type: assert_double.

year

year when the pipe (i.e. acceptor's incoming edge) is put in operation after laying or total overhaul. Type: assert_integerish.

insulation

identifier of insulation that covers the exterior of pipe (i.e. acceptor's incoming edge):

0

no insulation

1

foamed polyurethane or analogue

2

polymer concrete

Type: assert_integerish.

laying

type of pipe laying depicting the position of pipe in space. Only five types of pipe laying are considered:

  • air,

  • channel,

  • room,

  • tunnel,

  • underground.

Type: assert_character.

beta

logical indicator: should they consider additional heat loss of fittings located on this pipe (i.e. acceptor's incoming edge)? Type: assert_logical.

exp5k

logical indicator for regime of pipe (i.e. acceptor's incoming edge): if TRUE pipe is operated more that 5000 hours per year. Type: assert_logical.

roughness

roughness of internal wall of pipe (i.e. acceptor's incoming edge), [m]. Type: assert_double.

inlet

elevation of pipe inlet, [m]. Type: assert_double.

outlet

elevation of pipe outlet, [m]. Type: assert_double.

Details

The test bench has the next configuration:

m325nxdata.png

As it may be seen from the figure there is a particularity in topology of the provided directed graph: each node has only single ancestor. Hence one of isomorphic representation of such directed graph is a data.frame in which each row describes a node along with its incoming edge and each column contains an attribute value for that node or an attribute value for its incoming edge.

Since they deal with incoming edges and hence nodes are all flow acceptors the natural enumeration of nodes is by acceptor id.

Note that to leverage igraph functionality for plotting there is a zero sender of flow.

See Also

Other Minenergo: m278hlair(), m278hlcha(), m278hlund(), m278insdata, m278inshcm(), m278soildata, m325beta(), m325nhl(), m325nhldata, m325nvl()

Examples

library(pipenostics)

# Do not hesitate to use `data.table` and `igraph` for larger chunks of
# network.

# Check for declared topology isomorphism:
stopifnot(
  all(!duplicated(m325nxdata$acceptor))
)

# Do all terminal nodes have sensor-measured regime parameters?:
terminal_nodes <- subset(m325nxdata, !(acceptor %in% sender))
stopifnot(
  all(
    !is.na(
      subset(terminal_nodes, select = c(temperature, pressure, flow_rate))
    )
  )
)

Minenergo-325. Massively trace backwards thermal-hydraulic regime for district heating network

Description

Trace values of thermal-hydraulic regime (temperature, pressure, flow rate, and other) in the bunched pipeline against the flow direction using norms of heat loss values prescribed by Minenergo Order 325.

Algorithm also suits for partially measurable district heating network with massive data lack conditions, when there are no temperature and pressure sensor readings on the majority of terminal nodes.

Usage

m325tracebw(
  sender = 6,
  acceptor = 7,
  temperature = 70,
  pressure = pipenostics::mpa_kgf(6),
  flow_rate = 20,
  a = 0,
  d = 100,
  wth = 6.5,
  len = 72.446,
  year = 1986,
  insulation = 0,
  laying = "tunnel",
  beta = FALSE,
  exp5k = TRUE,
  roughness = 0.001,
  inlet = 0.5,
  outlet = 1,
  method = "romeo",
  opinion = "median",
  strict_sizes = FALSE,
  verbose = TRUE,
  csv = FALSE,
  file = "m325tracebw.csv"
)

Arguments

sender

identifier of the node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

identifier of the node which heat carrier flows in. According to topology of test bench considered this identifier should be unique for every row. Type: any type that can be painlessly coerced to character by as.character.

temperature

sensor-measured temperature of heat carrier (water) sensor-measured on the terminal acceptor node, [°C]. Use NA_float_s for (terminal) nodes without temperature sensor. Type: assert_double.

pressure

sensor-measured absolute pressure of heat carrier (water) inside the pipe (i.e. acceptor's incoming edge), [MPa]. Type: assert_double.

flow_rate

sensor-measured amount of heat carrier (water) on terminal node that is transferred by pipe (i.e. acceptor's incoming edge) during a period, [ton/h]. Type: assert_double. Use NA_float_s for nodes without flow rate sensor.

a

heat carrier volume loss factor of pipe: 0 - no loss of heat carrier; 0.0025 - maximum possible loss of heat carrier allowed. Type: assert_double.

d

nominal (outside) diameter of pipe (i.e.diameter of acceptor's incoming edge), [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length (i.e. length of acceptor's incoming edge), [m]. Type: assert_double.

year

year when the pipe (i.e. acceptor's incoming edge) is put in operation after laying or total overhaul. Type: assert_integerish.

insulation

identifier of insulation that covers the exterior of pipe (i.e. acceptor's incoming edge):

0

no insulation

1

foamed polyurethane or analogue

2

polymer concrete

Type: assert_subset.

laying

type of pipe laying depicting the position of pipe in space. Only five types of pipe laying are considered:

  • air,

  • channel,

  • room,

  • tunnel,

  • underground.

Type: assert_subset.

beta

logical indicator: should they consider additional heat loss of fittings located on this pipe (i.e. acceptor's incoming edge)? Type: assert_logical.

exp5k

logical indicator for regime of pipe (i.e. acceptor's incoming edge): if TRUE pipe is operated more that 5000 hours per year. Type: assert_logical.

roughness

roughness of internal wall of pipe (i.e. acceptor's incoming edge), [m]. Type: assert_double.

inlet

elevation of pipe inlet, [m]. Type: assert_double.

outlet

elevation of pipe outlet, [m]. Type: assert_double.

method

method of determining Darcy friction factor:

  • romeo

  • vatankhah

  • buzzelli

Type: assert_choice. For more details see dropp.

opinion

method for aggregating values of regime parameters on each node for the next tracing step:

mean

values of parameter are averaged before the next tracing step

median

median of parameter values are used for the next tracing step

Type: assert_choice.

strict_sizes

verify diameter and wall thickness with the actual pipe specifications produced. Type: assert_flag.

verbose

logical indicator: should they watch tracing process on console? Type: assert_flag.

csv

logical indicator: should they incrementally dump results to csv- file while tracing? Type: assert_flag.

file

name of csv-file which they dump results to. Type: assert_character of length 1 that can be used safely to create a file and write to it.

Details

They consider the topology of district heating network represented by m325nxdata:

m325tracebw0.png

The network may be partially sensor-equipped too:

m325tracebwp.png

In latter case no more than two nodes must be equipped with pressure and temperature sensors whereas for other nodes only flow rate sensors must be installed.

Tracing starts from sensor-equipped nodes and goes backwards, i.e against the flow direction.

Though some input arguments are natively vectorized their individual values all relate to common part of district heating network, i.e. associated with common object. It is due to isomorphism between vector representation and directed graph of this network. For more details of isomorphic topology description see m325nxdata.

Before tracing starts for the next node, previously calculated values of thermal-hydraulic parameters are aggregated by either averaging or by median. The latter seems more robust for avoiding strong influence of possible outliers which may come from actual heating transfer anomalies, erroneous sensor readings or wrong pipeline specifications.

Aggregation for values of flow rate at the node is always sum.

Optional verification of pipe diameters and wall thicknesses is performed against b36pipedata data.

Value

A data.frame containing results (detailed log) of tracing in narrow format:

node

Tracing job. Identifier of the node which regime parameters is calculated for. Values in this vector are identical to those in argument acceptor. Type: assert_character.

tracing

Tracing job. Identifiers of nodes from which regime parameters are traced for the given node. Identifier sensor is used when values of regime parameters for the node are sensor readings. Type: assert_character.

backward

Tracing job. Identifier of tracing direction. It constantly equals to TRUE. Type: assert_logical.

aggregation

Tracing job. Identifier of aggregation method: span, median, mean, or identity. Type: assert_character.

loss

Traced thermal hydraulic regime. Normative specific heat loss power of adjacent pipe, [kcal/m/h]. Type: assert_double.

flux

Traced thermal hydraulic regime. Normative heat flux of adjacent pipe, [W/m²]. Type: assert_double.

Q

Traced thermal hydraulic regime. Normative heat loss of adjacent pipe per day, [kcal]. Type: assert_character.

temperature

Traced thermal hydraulic regime. Traced temperature of heat carrier (water) that is associated with the node, [°C]. Type: assert_double.

pressure

Traced thermal hydraulic regime. Traced pressure of heat carrier (water) that is associated with the node, [MPa]. Type: assert_double.

flow_rate

Traced thermal hydraulic regime. Traced flow rate of heat carrier (water) that is associated with the node, [ton/h]. Type: assert_double.

job

Tracing job. Value of tracing job counter. Type: assert_count.

Type: assert_data_frame.

See Also

Other Regime tracing: dropg(), dropp(), dropt(), m325tracefw(), m325traceline(), tracebw(), tracefw(), traceline()

Examples

library(pipenostics)

## It is possible to run without specification of argument values:
m325tracebw()

## Consider isomorphic representation of District Heating Network graph:
DHN <- m325nxdata

## Distinct options for opinion aggregation lead to distinct traced
## temperature and pressure:

## * When aggregation is by mean:
output_mean <- do.call(
  "m325tracebw", c(as.list(DHN), verbose = FALSE, opinion = "mean")
)

## * When aggregation is by median:
output_median <- do.call(
  "m325tracebw", c(as.list(DHN), verbose = FALSE, opinion = "median")
)

## It is possible to process partially measurable District Heating Network:

## * Simulate lack of temperature and pressure sensors:
DHN[c(7, 10, 21, 24), c("temperature", "pressure")] <- NA_real_

## * Trace thermal-hydraulic regime:
do.call("m325tracebw", c(as.list(DHN), verbose = FALSE))

Minenergo-325. Massively trace forwards thermal-hydraulic regime for district heating network

Description

Trace values of thermal-hydraulic regime (temperature, pressure, flow rate, and other) in the bunched pipeline along the flow direction using norms of heat loss values prescribed by Minenergo Order 325.

Usage

m325tracefw(
  sender = c(0, 1),
  acceptor = c(1, 2),
  temperature = c(70, NA_real_),
  pressure = c(pipenostics::mpa_kgf(6), NA_real_),
  flow_rate = c(20, NA_real_),
  a = c(0, 0),
  d = c(100, 100),
  wth = c(12, 12),
  len = c(72.446, 72.446),
  year = c(1986, 1986),
  insulation = c(0, 0),
  laying = c("tunnel", "tunnel"),
  beta = c(FALSE, FALSE),
  exp5k = c(TRUE, TRUE),
  roughness = c(0.001, 0.001),
  inlet = c(0.5, 1),
  outlet = c(1, 1),
  elev_tol = 0.1,
  method = "romeo",
  strict_sizes = FALSE,
  verbose = TRUE,
  csv = FALSE,
  file = "m325tracefw.csv",
  use_cluster = FALSE
)

Arguments

sender

identifier of the node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

identifier of the node which heat carrier flows in. According to topology of test bench considered this identifier should be unique for every row. Type: any type that can be painlessly coerced to character by as.character.

temperature

sensor-measured temperature of heat carrier (water) sensor-measured on the root node, [°C]. Use NA_float_s for nodes without temperature sensor. Type: assert_double.

pressure

sensor-measured absolute pressure of heat carrier (water) inside the pipe on the root node, [MPa]. Use NA_float_s for nodes without pressure sensor. Type: assert_double.

flow_rate

sensor-measured amount of heat carrier (water) on root node that is transferred by pipe during a period, [ton/h]. Type: assert_double. Use NA_float_s for nodes without flow rate sensor.

a

heat carrier (water) volume loss factor of cylindrical pipe, [h⁻¹]. Type: assert_double.

d

nominal (outside) diameter of pipe (i.e.diameter of acceptor's incoming edge), [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length (i.e. length of acceptor's incoming edge), [m]. Type: assert_double.

year

year when the pipe (i.e. acceptor's incoming edge) is put in operation after laying or total overhaul. Type: assert_integerish.

insulation

identifier of insulation that covers the exterior of pipe (i.e. acceptor's incoming edge):

0

no insulation

1

foamed polyurethane or analogue

2

polymer concrete

Type: assert_subset.

laying

type of pipe laying depicting the position of pipe in space. Only five types of pipe laying are considered:

  • air,

  • channel,

  • room,

  • tunnel,

  • underground.

Type: assert_subset.

beta

logical indicator: should they consider additional heat loss of fittings located on this pipe (i.e. acceptor's incoming edge)? Type: assert_logical.

exp5k

logical indicator for regime of pipe (i.e. acceptor's incoming edge): if TRUE pipe is operated more that 5000 hours per year. Type: assert_logical.

roughness

roughness of internal wall of pipe (i.e. acceptor's incoming edge), [m]. Type: assert_double.

inlet

elevation of pipe inlet, [m]. Type: assert_double.

outlet

elevation of pipe outlet, [m]. Type: assert_double.

elev_tol

maximum allowed discrepancy between adjacent outlet and inlet elevations of two subsequent pipes in the traced path, [m]. Type: assert_number.

method

method of determining Darcy friction factor:

  • romeo

  • vatankhah

  • buzzelli

Type: assert_choice. For more details see dropp.

strict_sizes

verify diameter and wall thickness with the actual pipe specifications produced. Type: assert_flag.

verbose

logical indicator: should they watch tracing process on console? Type: assert_flag.

csv

logical indicator: should they incrementally dump results to csv- file while tracing? Type: assert_flag.

file

name of csv-file which they dump results to. Type: assert_character of length 1 that can be used safely to create a file and write to it.

use_cluster

utilize functionality of parallel processing on multi-core CPU. Type: assert_flag.

Details

The calculated (values of) regime may be considered as representation of district heating process in conditions of hypothetically perfect technical state of pipe walls and insulation.

They consider the topology of district heating network represented by m325nxdata:

m325tracefw.png

Tracing starts from sensor-equipped root node and goes forward, i.e along the flow direction. Function m325traceline serves under the hood for tracing identified linear segments from root node to every terminal node. Hence they only need root node to be equipped with sensors. Sensors at other nodes are redundant in forward tracing, since the tracing algorithm by no means consider them for tracing.

Moreover in the forward tracing algorithm they assume the flow of heat carrier is distributed proportionally to the cross-sectional area of the outgoing pipeline. Actually, a lot of reasons may cause significant deviations from this assumption. As a result, the sequence of paired backward/forward tracing may be divergent for regime parameters.

Though some input arguments are natively vectorized their individual values all relate to common part of district heating network, i.e. associated with common object. It is due to isomorphism between vector representation and directed graph of this network. For more details of isomorphic topology description see m325nxdata.

They are welcome to couple the algorithm with functionality of data.table.

Optional verification of pipe diameters and wall thicknesses is performed against b36pipedata data.

Value

A data.frame containing results (detailed log) of tracing in narrow format:

node

Tracing job. Identifier of the node which regime parameters is calculated for. Values in this vector are identical to those in argument acceptor. Type: assert_character.

tracing

Tracing job. Identifiers of nodes from which regime parameters are traced for the given node. Identifier sensor is used when values of regime parameters for the node are sensor readings. Type: assert_character.

backward

Tracing job. Identifier of tracing direction. It constantly equals to FALSE. Type: assert_logical.

aggregation

Tracing job. Identifier of the aggregation method associated with traced values. For forward tracing the only option is identity. Type: assert_character.

loss

Traced thermal hydraulic regime. Normative specific heat loss power of adjacent pipe, [kcal/m/h]. Type: assert_double.

flux

Traced thermal hydraulic regime. Normative heat flux of adjacent pipe, [W/m²]. Type: assert_double.

Q

Traced thermal hydraulic regime. Normative heat loss of adjacent pipe per day, [kcal]. Type: assert_character.

temperature

Traced thermal hydraulic regime. Traced temperature of heat carrier (water) that is associated with the node, [°C]. Type: assert_double.

pressure

Traced thermal hydraulic regime. Traced pressure of heat carrier (water) that is associated with the node, [MPa]. Type: assert_double.

flow_rate

Traced thermal hydraulic regime. Traced flow rate of heat carrier (water) that is associated with the node, [ton/h]. Type: assert_double.

job

Tracing job. Value of tracing job counter. For forward tracing value of job counts the number of traced paths from root node. Type: assert_count.

Type: assert_data_frame.

See Also

Other Regime tracing: dropg(), dropp(), dropt(), m325tracebw(), m325traceline(), tracebw(), tracefw(), traceline()

Examples

library(pipenostics)

# Minimum two nodes should be in district heating network graph:
m325tracefw(verbose = FALSE)

# Consider isomorphic representation of District Heating Network graph:
DHN <- m325nxdata

# * avoid using numeric identifiers for nodes:
DHN$sender   <- sprintf("N%02i", DHN$sender)
DHN$acceptor <- sprintf("N%02i", DHN$acceptor)

# Perform backward tracing to get regime on root node:
bw_report <- do.call("m325tracebw", c(as.list(DHN), verbose = FALSE))

# Put the traced values to the root node of test bench:
root_node_idx <- 12
root_node <- sprintf("N%02i", root_node_idx)
regime_param  <- c("temperature", "pressure", "flow_rate")
DHN[root_node_idx, regime_param] <-
  subset(bw_report,
         node == root_node & aggregation == "median",
         regime_param)
rm(root_node, root_node_idx)

# Trace the test bench forward for the first time:
fw_report <- do.call(
  "m325tracefw", c(as.list(DHN), verbose = FALSE, elev_tol = .5)
)

# Let's compare traced regime at terminal nodes back to test bench:
report <- subset(
  rbind(bw_report, fw_report),
  node %in% subset(DHN, !(acceptor %in% sender))$acceptor &
    aggregation == "identity"
)

regime_delta <- colMeans(
  subset(report, backward, regime_param) -
    subset(report, !backward, regime_param)
)
print(regime_delta)

stopifnot(sqrt(regime_delta %*% regime_delta) < 0.5)

# To address the problem of possible norm losses of the heat carrier,
# they could roughly define the leaks as follows:
DHN[, "a"] <- 0.0025 * (365 - 90) / 365

# so that forward tracing
fw_report_loss <- do.call(
  "m325tracefw", c(as.list(DHN), verbose = FALSE, elev_tol = .5)
)

# produces slightly different results [kcal/m/h]:
max(abs(fw_report[, "loss"] - fw_report_loss[, "loss"]), na.rm = TRUE)

Minenergo-325. Trace thermal-hydraulic regime for linear segment of district heating network

Description

Trace values of thermal-hydraulic regime (temperature, pressure, flow_rate, and other) along the adjacent linear segments of pipeline using norms of heat loss values prescribed by Minenergo Order 325.

Usage

m325traceline(
  temperature = 130,
  pressure = mpa_kgf(6),
  flow_rate = 250,
  g = 0,
  a = 0,
  d = 711,
  wth = 12.7,
  len = c(600, 530, 300, 350),
  year = 1986,
  insulation = 0,
  laying = "underground",
  beta = FALSE,
  exp5k = TRUE,
  roughness = 0.006,
  inlet = 0,
  outlet = 0,
  elev_tol = 0.1,
  method = "romeo",
  forward = TRUE,
  absg = TRUE,
  strict_sizes = FALSE
)

Arguments

temperature

Traced thermal hydraulic regime. Sensor-measured temperature of heat carrier (water) inside the pipe sensor-measured at the inlet (forward tracing) or at the outlet (backward tracing) of path, [°C]. Type: assert_number.

pressure

Traced thermal hydraulic regime. Sensor-measured absolute pressure of heat carrier (water) sensor-measured at the inlet (forward tracing) or at the outlet (backward tracing) of path, [MPa].Type: assert_number.

flow_rate

Traced thermal hydraulic regime. Amount of heat carrier (water) sensor-measured at the inlet (forward tracing) or at the outlet (backward tracing) of path, [ton/h]. Type: assert_number.

g

amount of heat carrier discharge to network for each pipe segment in the tracing path enumerated along the direction of flow. If flag absg is TRUE then they treat argument g as absolute value in [ton/h], otherwise they do as percentage of flow_rate in the pipe segment. Type: assert_double.

a

heat carrier (water) volume loss factor of cylindrical pipe, [h⁻¹]. Type: assert_double.

d

nominal (outside) diameters of subsequent pipes in tracing path that are enumerated along the direction of flow, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

len

length of subsequent pipes in tracing path that are enumerated along the direction of flow, [m]. Type: assert_double.

year

year when pipe is put in operation after laying or total overhaul for each pipe in tracing path enumerated along the direction of flow. Type: assert_integerish.

insulation

insulation that covers the exterior of pipe:

0

no insulation

1

foamed polyurethane or analogue

2

polymer concrete

for each pipe in tracing path enumerated along the direction of flow. Type: assert_numeric and assert_subset.

laying

type of pipe laying depicting the position of pipe in space:

  • air

  • channel

  • room

  • tunnel

  • underground

for each pipe in tracing path enumerated along the direction of flow. Type: assert_character and assert_subset.

beta

logical indicator: should they consider additional heat loss of fittings? Logical value for each pipe in tracing path enumerated along the direction of flow. Type: assert_logical.

exp5k

logical indicator for regime of pipe: is pipe operated more that 5000 hours per year? Logical value for each pipe in tracing path enumerated along the direction of flow. Type: assert_logical.

roughness

roughness of internal wall for each pipe in tracing path enumerated along the direction of flow, [m]. Type: assert_double.

inlet

elevation of pipe inlet for each pipe in tracing path enumerated along the direction of flow, [m]. Type: assert_double.

outlet

elevation of pipe outlet for each pipe in tracing path enumerated along the direction of flow, [m]. Type: assert_double.

elev_tol

maximum allowed discrepancy between adjacent outlet and inlet elevations of two subsequent pipes in the traced path, [m]. Type: assert_number.

method

method of determining Darcy friction factor

  • romeo

  • vatankhah

  • buzzelli

Type: assert_choice. For more details see dropp.

forward

tracing direction flag: is it a forward direction of tracing? If FALSE the backward tracing is performed. Type: assert_flag.

absg

whether argument g (amount of heat carrier discharge to network) is an absolute value in [ton/h] (TRUE) or is it a percentage of flow rate in the pipe segment (FALSE)? Type: assert_flag.

strict_sizes

verify diameter and wall thickness with the actual pipe specifications produced. Type: assert_flag.

Details

They consider only simple tracing paths which do not contain rings and any kind of parallelization. At the same time bidirectional (forward and backward) tracing is possible in accordance with sensor position. They also may consider discharges to network at the inlet of each pipeline segment as an approximation of actual forks of flows.

Relevant illustration of the adopted assumptions for 4-segment tracing path is depicted on the next figure.

m325regtrace.png

They make additional check for consistency of inlet and outlet values for subsequent pipe segments. Discrepancy of appropriate elevations cannot be more than elev_tol.

They also may consider some normative volume loss of heat carrier (water) by tuning volume loss factor a in range 0.0 – 0.0025 h⁻¹.

Optional verification of pipe diameters and wall thicknesses is performed against b36pipedata data.

Value

A list containing results (detailed log) of tracing for each pipe in tracing path enumerated along the direction of flow:

temperature

Traced thermal hydraulic regime. Traced temperature of heat carrier (water), [°C]. Type: assert_double.

pressure

Traced thermal hydraulic regime. Traced pressure of heat carrier (water) for each pipe in tracing path enumerated along the direction of flow, [MPa]. Type: assert_double.

flow_rate

Traced thermal hydraulic regime. Traced flow rate of heat carrier (water) for each pipe in tracing path enumerated along the direction of flow, [ton/h]. Type: assert_double.

loss

Traced thermal hydraulic regime. Normative specific heat loss power for each pipe in tracing path enumerated along the direction of flow, [kcal/m/h]. Type: assert_double.

flux

Traced thermal hydraulic regime. Normative heat flux for each pipe in tracing path enumerated along the direction of flow, [W/m²]. Type: assert_double.

Q

Traced thermal hydraulic regime. Normative heat loss for each pipe in tracing path enumerated along the direction of flow per day, [kcal]. Type: assert_double.

Type: assert_list.

See Also

Other Regime tracing: dropg(), dropp(), dropt(), m325tracebw(), m325tracefw(), tracebw(), tracefw(), traceline()

Examples

library(pipenostics)

# Consider 4-segment tracing path depicted.
# First, let sensor readings for forward tracing:
t_fw <- 130  # [°C]
p_fw <- mpa_kgf(6) * all.equal(.588399, mpa_kgf(6))  # [MPa]
g_fw <- 250  # [ton/h]

# Let discharges to network for each pipeline segment are somehow determined
# as
discharges <- seq(0, 30, 10)  # [ton/h]

# Then the calculated regime (red squares) for forward tracing is
m325traceline(t_fw, p_fw, g_fw, discharges, forward = TRUE)

# Next consider values of traced regime as sensor readings for backward
# tracing:
t_bw <- 127.3367  # [°C]
p_bw <- .5870330  # [MPa]
g_bw <- 190  # [ton/h]

# Then the calculated regime (red squares) for backward tracing is
regime_bw <- m325traceline(t_bw, p_bw, g_bw, discharges, forward = FALSE)
print(regime_bw)

# Let compare sensor readings with backward tracing results:
with(regime_bw, {
  lambda <- function(val, constraint)
    c(val, constraint, constraint - val,
      abs(constraint - val) * 100/constraint)
  first <- 1
  structure(
    rbind(
      lambda(temperature[first], t_fw),
      lambda(pressure[first],    p_fw),
      lambda(flow_rate[first],   g_fw)
    ),
    dimnames = list(
      c("temperature", "pressure", "flow_rate"),
      c("sensor.value", "traced.value", "abs.discr", "rel.discr")
    )
  )
})

# To address the problem of possible norm losses of the heat carrier,
# they could roughly define the leaks as follows:

# * maximum value prescribed to heat carrier loss factor, [h⁻¹],
#   multiplied by heating season relative duration:
a <- 0.0025 * ( (365 - 90)/365 )

# * length of subsequent pipes, [m]:
l <- c(600, 530, 300, 350)

# * nominal (outside) diameters of subsequent pipes, [m]:
D <- rep.int(700, 4) * 1e-3

# * average year volumes of heat carrier (no heat carrier for 90 days in
#   summer), [m³]
V <- pi * D^2 / 4 * l

# * finally they get,  [ton/h]:
discharges <- a * V * drop(iapws::if97("rho", mpa_kgf(6), k_c(130))) * 1e-3

# * and the calculated regime (red squares) for forward tracing becomes
m325traceline(g = discharges, forward = TRUE)

# Let's compare it with more formal calculations:
m325traceline(a = a, forward = TRUE)

Probability of failure of the corroded pipe within maximum entropy

Description

Calculate probability of failure (POF) of the corroded pipe taking into account its actual level of defectiveness and exploiting Monte-Carlo simulation within Principle of maximum entropy.

Consistent estimate of POF for pipeline systems plays a critical role in optimizing their operation. To prevent pipeline failures due to actively growing defects it is necessary to be able to assess the pipeline system failure operation probability during a certain period, taking into account its actual level of defectiveness. The pipeline limit state comes when the burst pressure, considered as a random variable, reaches an unacceptable level, or when the defect depth, also a random variable, exceeds the predetermined limit value.

That is why in the method they consider two possible failures for a single pipeline cross section with the on-surface and longitudinally oriented defect of metal-loss type:

rupture

a decrease of value of failure pressure down to the operating pressure.

leak

increase of corrosion depth (defect) up to the specified ultimate permissible fraction of pipe wall thickness.

Since up to now no methods existed which would give absolutely correct POF assessments they suggest simple fiddling with random values of affecting factors without deeping into intrinsic mechanisms of corrosion. For this purpose they choose classical Monte-Carlo simulation within the Principle of maximum entropy. The latter allows to avoid doubtful and excessive preferences and detalization when choosing probability distribution models for failure factors and for inline inspection measurements.

Usage

mepof(
  depth = seq(0, 10, length.out = 100),
  l = seq(40, 50, length.out = 100),
  d = rep.int(762, 100),
  wth = rep.int(10, 100),
  strength = rep.int(358.5274, 100),
  pressure = rep.int(0.588, 100),
  temperature = rep.int(150, 100),
  rar = function(n) stats::runif(n, 0.01, 0.3)/365,
  ral = function(n) stats::runif(n, 0.01, 0.3)/365,
  days = 0,
  k = 0.8,
  method = "b31g",
  n = 1e+06
)

Arguments

depth

maximum depth of the corroded area measured during inline inspection, [mm]. Type: assert_double.

l

maximum longitudinal length of corroded area measured during inline inspection, [mm]. Type: assert_double.

d

nominal outside diameter of pipe, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

strength

one of the next characteristics of steel strength, [MPa]:

  • specified minimum yield of stress (SMYS) for use with b31gpf and b31gmodpf.

  • ultimate tensile strength (UTS) or specified minimum tensile strength (SMTS) for use with other failure pressure codes (dnvpf, pcorrcpf, shell92pf).

Type: assert_double.

pressure

absolute pressure of substance (i.e. heat carrier) inside the pipe measured near defect position, [MPa]. In most cases this is a nominal operating pressure. Type: assert_double.

temperature

temperature of substance (i.e. heat carrier) inside the pipe measured near defect position, [°C]. In case of district heating network this is usually a calculated value according to actual or normative thermal-hydraulic regime. Type: assert_double.

rar

random number generator for simulating of distribution of radial corrosion rate in pipe wall, [mm/day]. The only argument n of the function should be the number of observations to generate. Type: assert_function.

ral

random number generator for simulating of distribution of longitudinal corrosion rate in pipe wall, [mm/day]. The only argument n of the function should be the number of observations to generate. Type: assert_function.

days

number of days that have passed after or preceded the inline inspection, []. Negative values are for retrospective assumptions whereas positives are for failure prognosis. Type: assert_int.

k

alarm threshold for leakage failure. It usually 0.6, 0.7, or 0.8, []. If set to 1 no alarm before failure occurs. Type: assert_number.

method

method for calculating failure pressure:

Type: assert_choice.

n

number of observations to generate for Monte-Carlo simulations , Type: assert_count.

Details

Since for all influence factors they can more or less assume range limits, the uniform distribution gets the maximum entropy in this context (see JCGM 101:2008 ). That is why parameters of corrosion defects measured during the inline inspection as well as regime parameters and engineering characteristics of pipe segment - all they are simulated by runif.

runif-limits for depth of corrosion defect are associated with precision of commonly applied measurement instruments. For traditionally exploited ultrasonic control those limits are well-known and can reach up to 10 % of pipe wall thickness. Whereas uncertainty of defect longitudinal length may be more than enough constrained with 5 %.

Recommendations for choosing stochastic characteristics of pipe engineering factors (i.e. cross section diameter, wall thickness and material strength) are taken from aggregated review of Timashev et al. but gently transformed for compatibility with Principle of maximum entropy, i.e. runif.

Uncertainties of regime parameters in stochastic models are set minimized by regarding only precision of metering devices which commonly applied in district heating networks. For temperature it is about 2 °C.

Since the rate of corrosion processes in the pipe wall is a consequence of physical and chemical processes occurring at the atomic scale, it depends on a large number of environmental factors differently and ambiguously. That is why various deterministic and stochastic models can be potentially involved in POF assessment. For that purpose radial and longitudinal corrosion rate can be independently formulated as random value generation functions. They only admit that change in depth and length of corrosion defects in time is close to linear for the generated value of corrosion rate.

Value

Probability of pipe failure for each corroded area measured during inline inspection. Type: assert_double. If NAs returned use another method for calculating failure pressure.

References

  1. S. Timashev and A. Bushinskaya, Diagnostics and Reliability of Pipeline Systems, Topics in Safety, Risk, Reliability and Quality 30, doi:10.1007/978-3-319-25307-7.

  2. BIPM. Guides in Metrology (GUM). JCGM 101:2008 . Evaluation of measurement data – Supplement 1 to the Guide to the expression of uncertainty in measurement – Propagation of distributions using a Monte Carlo method.

See Also

Other Failure estimation: b31gmodpf(), b31gpf(), dnvpf(), pcorrcpf(), shell92pf()

Examples

library(pipenostics)

# Let's consider a pipe in district heating network with
diameter           <- 762         # [mm]
wall_thickness     <-  10         # [mm]
UTS                <- 434.3697    # [MPa]

# which transfers heat-carrier (water) at
operating_pressure <-   0.588399  # [MPa].
temperature        <-  95         # [°C]

# During inline inspection four corroded areas (defects) are detected with:
depth  <- c(2.45,  7.86,   7.93,   8.15)  # [mm]

# whereas the length of all defects is not greater 200 mm:
length <- rep(200, 4)  # [mm]

# Corrosion rates in radial and in longitudinal directions are not well-known
# and may vary in range .01 - .30 mm/year:
rar = function(n) stats::runif(n, .01, .30) / 365
ral = function(n) stats::runif(n, .01, .30) / 365

# Then POFs related to each corroded area are near:
pof <- mepof(
  depth, length, rep(diameter, 4), rep(wall_thickness, 4),
  rep(UTS, 4), rep(operating_pressure, 4), rep(temperature, 4),
  rar, ral, method = "dnv"
)
print(pof)

# So, the POF of pipe is near
max(pof)

# The value of POF changes in time. So, in a year after inline inspection of
# the pipe we can get something near
pof <- mepof(
  depth, length, rep(diameter, 4), rep(wall_thickness, 4),
  rep(UTS, 4), rep(operating_pressure, 4), rep(temperature, 4),
  rar, ral, method = "dnv", days = 365
)
print(pof)

# for entire pipe we get something near:
max(pof)

# Two years ago before inline inspection the pipe state was rather good:
pof <- mepof(
  depth, length, rep(diameter, 4), rep(wall_thickness, 4),
  rep(UTS, 4), rep(operating_pressure, 4), rep(temperature, 4),
  rar, ral, method = "dnv", days = -2 * 365
)

print(pof)

# for entire pipe we get something near:
max(pof)

Get list of weather stations (meteos)

Description

Get a list of weather stations located primarily in the central and northern parts of Eurasia. For each weather station, the following information is provided: an integer station ID, geographic coordinates, altitude, and the mean annual ground temperature averaged over depth.

Usage

meteos()

Value

List of weather stations (meteos) with the next fields:

station_id

Weather station unique identifier. Type: assert_integer.

name

Human-readable name of weather station. Type: assert_character.

lat

Geographical position of weather station. Latitude, [DD]. Type: assert_double.

lon

Geographical position of weather station. Longitude, [DD]. Type: assert_double.

alt

Altitude - position of weather station above sea level, [m]. Type: assert_double.

avg

Mean annual ground temperature averaged over depth, [°C]. Type: assert_double.

Type: assert_data_frame.

References

Climate Change Investigation Laboratory. Description of the array of daily data on soil temperature at depths up to 320 cm by meteorological stations of the Russian Federation.

See Also

mgtdhid to get hourly ground temperature values at different depths measured at the listed weather stations.

Other Geo Information: geoarea(), mgtdhid()

Examples

library(pipenostics)

head(meteos())

Get ground temperature

Description

Get the undisturbed (median) value of ground temperature at different depths at a specified time leveraging Modified Ground Temperature Double Harmonic Model (MGTDH-model).

Usage

mgtdhid(id, tau = 1440L, depth = 2.4)

mgtdhidt(tau, id = 28434L, depth = 2.4)

mgtdhgeo(lat, lon, tau = 1440L, depth = 2.4, use_cluster = FALSE)

mgtdhgeot(tau, lat = 57, lon = 57, depth = 2.4)

Arguments

id

weather station unique identifier. Only identifiers from meteos dataset are accepted. Type: assert_integer. For mgtdhidt acceptable length is 1.

tau

time point for which it is necessary to obtain the value of the soil temperature; it can be specified as an integer, representing the number of hours that have passed since the beginning of the year, or as a value of POSIXct type. Type: assert_count, or assert_posixct. For mgtdhid acceptable length is 1.

depth

depth at which the ground temperature is calculated, [m]. Type: assert_number.

lat

latitude of the geographical location where the value of soil temperature needs to be determined, [DD]. Type: assert_double. For mgtdhgeot acceptable length is 1.

lon

longitude of the geographical location where the value of soil temperature needs to be determined, [DD]. Type: assert_double. For mgtdhgeot acceptable length is 1.

use_cluster

utilize functionality of parallel processing on multi-core CPU. Type: assert_flag.

Details

The MGTDH-model is a modified solution of the thermal conductivity equation for soil and can be expressed by the formula

t(τ,d)=βer1A1cos(2πωτ+r1P1)+βr2A2dcos(4πωτ+r2P2)t\left( \tau, d \right) = \beta e^{r_1} \cdot A_1 \cos(2 \pi \omega \tau + r_1 - P_1) + \beta r_2^{A_2 \cdot d} \cos(4 \pi \omega \tau + r_2 - P_2)

where

t(τ,d)t\left( \tau, d \right)

undisturbed (median) ground temperature [°C] at specified depth dd [m], and time τ\tau [h].

τ\tau

time point (tau) calculated in hours since the beginning of the year, [h].

dd

depth (depth) at which the ground temperature should be calculated, [m].

β=1\beta = -1

shift constant, [].

r1(d)=1000dπωαsDr_1(d) = -1000 d \sqrt{\frac{\pi \omega}{\alpha_s D}}, r2(d)=r1(d)2r_2(d) = r_1(d) \sqrt{2}

temperature diffusivity factors, [].

ω=18760\omega = \frac{1}{8760}

rate of rotation of the Earth, expressed with an accuracy equal to the inverse of an hour, [h⁻¹].

αs\alpha_s

soil diffusivity, [mm²/s].

D=86400D = 86400

constant that represents the number of seconds in one day, [s/day].

A1A_1, A2A_2

harmonic temperature amplitudes, [°C].

P1P_1, P2P_2

phase shifts, depending on the geographical location, [].

Soil diffusivity, αs\alpha_s, harmonic temperature amplitudes, A1A_1, A2A_2, and phase shifts P1P_1, P2P_2 are geographically dependent parameters which values were established for each weather station listed in meteos-dataset.

For the convenience of using the MGTDH-model, several interface functions have been provided. Each function generates a vector of type assert_double as an output.

The mgtdhid and mgtdhidt functions are used to obtain ground temperature data from specific meteorological stations.

The functions mgtdhgeo and mgtdhgeot provide ground temperatures at any geographical location, but note that their usage is primarily limited to the Northern Asian part of Eurasia, as most meteorological stations and parameters for the MGTDH-model are established there. Ground temperature at the specified location is obtained by linear interpolation using barycentric coordinates formed in the system of the three nearest meteorological stations.

Value

Undisturbed (median) ground temperature value calculated with the MGTDH-model, specifically for the location of the user-specified meteorological station, at specified depth, and time, [°C]. Type: assert_double.

References

Lu Xing & Jeffrey D. Spitler (2017) Prediction of undisturbed ground temperature using analytical and numerical modeling. Part I: Model development and experimental validation. Science and Technology for the Built Environment, 23:5, 787-808, doi:10.1080/23744731.2016.1258371.

See Also

Other Geo Information: geoarea(), meteos()

Examples

library(pipenostics)

# Let consider the next geographical positions:
lat <- c(s28434 = 56.65, s28418 = 56.47, s23711 = 62.70, ControlPoint = 57)
lon <- c(s28434 = 57.78, s28418 = 53.73, s23711 = 56.20, ControlPoint = 57)

# * ground temperatures at first three locations on 02 March 2023
#   at depth 3 m:
mgtdhgeo(
  head(lat, 3), head(lon, 3), tau = as.POSIXct("2023-03-02"), depth = 3
)

# * it is the same as obtaining ground temperatures from weather stations:
mgtdhid(
  id = c(28434L, 28418L, 23711L), tau = as.POSIXct("2023-03-02"), depth = 3
)

# * undisturbed ground temperature plot at Control Point:
days <- as.POSIXct("2023-01-01") + 3600 * 24 * (seq.int(1, 365) - 1)
plot(
  days,
  mgtdhgeot(days, lat[["ControlPoint"]], lon[["ControlPoint"]]),
  type = "l",
  ylab = "Temperature, °C"
)

Inches to mm

Description

Convert length measured in inches to millimeters (mm)

Usage

mm_inch(x)

Arguments

x

length measured in inches, [inch]. Type: assert_double.

Value

Length in millimeters, [mm]. Type: assert_double.

See Also

inch_mm for converting mm to inches

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), k_c(), kgf_mpa(), loss_flux(), mpa_kgf(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

mm_inch(c(0.03937008, 1))

Kilogram-force per square cm to megapascals

Description

Convert pressure (stress) measured in kilogram-force per square cm (kgf/cm²) to megapascals (MPa)

Usage

mpa_kgf(x)

Arguments

x

pressure (stress) measured in kilogram-force per square cm, [kgf/cm²]. Type: assert_double.

Value

Pressure (stress) in megapascals, [MPa]. Type: assert_double.

See Also

kgf_mpa for converting megapascals to kilogram-force per square cm

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), k_c(), kgf_mpa(), loss_flux(), mm_inch(), mpa_psi(), psi_mpa()

Examples

library(pipenostics)

mpa_kgf(c(10.1971619998, 1))

Pounds per square inch to megapascals

Description

Convert pressure (stress) measured in pounds per square inch (PSI) to megapascals (MPa)

Usage

mpa_psi(x)

Arguments

x

pressure (stress) measured in pounds per square inch (PSI). Type: assert_double.

Value

Pressure (stress) in megapascals (MPa). Type: assert_double.

See Also

psi_mpa for converting megapascals to pounds per square inch

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), k_c(), kgf_mpa(), loss_flux(), mm_inch(), mpa_kgf(), psi_mpa()

Examples

library(pipenostics)

mpa_psi(c(145.03773800721814, 1))

PCORRC. Failure pressure of the corroded pipe

Description

Calculate failure pressure of the corroded pipe according to PCORRC model.

PCORRC methodology was developed on the basis of studying the mechanism of destruction of pipes, material of which has improved or high fracture toughness, and on the high-precision modelling of the finite element pipe models performed at the Battelle Institute. According to field test results of a large number of actual pipe segments, the destruction mechanism for defective pipeline segment depends on the pipe material fracture toughness. These tests also showed that only pipes made out of steel with improved or high fracture toughness fail a result of plastic fracture. In determining the Folias factor the effect of increased stress concentration and steel hardening in the plastic deformation zone at the start of the defect failure process was taken into account.

This code should be applied only to

  • a single cross section of the pipeline containing a longitudinally oriented, flat bottom surface defect of corrosion/erosion type;

  • pipelines, which operate at temperatures exceeding the temperature of pipe material ductile–brittle transition, and for pipe material with the impact energy of Charpy 61 [J] and above.

Usage

pcorrcpf(d, wth, uts, depth, l)

Arguments

d

nominal outside diameter of pipe, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

uts

ultimate tensile strength (UTS) or specified minimum tensile strength (SMTS) as a characteristic of steel strength, [MPa]. Type: assert_double.

depth

measured maximum depth of the corroded area, [mm]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [mm]. Type: assert_double.

Value

Estimated failure pressure of the corroded pipe, [MPa]. Type: assert_double.

References

  1. S. Timashev and A. Bushinskaya, Diagnostics and Reliability of Pipeline Systems, Topics in Safety, Risk, Reliability and Quality 30, doi:10.1007/978-3-319-25307-7.

  2. A.C.Reddy, Safety Failure Criteria of Fluorocarbon Plastic Pipes for Dry Chlorine Transport using Finite Element Analysis Materials today: proceedings, Vol. 4(8), 2017, pp. 7498-7506. doi:10.1016/j.matpr.2017.07.081.

See Also

Other Failure estimation: b31gmodpf(), b31gpf(), dnvpf(), mepof(), shell92pf()

Examples

library(pipenostics)

# Consider two pipes with the next specifications:
d     <- c(812.8, 219.0)  # [mm]
wth   <- c( 19.1,  14.5)  # [mm]
uts   <- c(530.9, 455.1)  # [N/mm²]
l     <- c(203.2, 200.0)  # [mm]
depth <- c( 13.4,   9.0)  # [mm]

# Get the failure pressure for that pipes:
pcorrcpf(d, wth, uts, depth, l)

Megapascals to pounds per square inch

Description

Convert pressure (stress) measured in megapascals (MPa) to pounds per square inch (PSI)

Usage

psi_mpa(x)

Arguments

x

pressure (stress) measured in megapascals. [MPa]. Type: assert_double.

Value

Pressure (stress) in pounds per square inch, [PSI]. Type: assert_double.

See Also

mpa_psi for converting pounds per square inch to megapascals

Other Measurement Unit Converter: c_k(), f_k(), inch_mm(), k_c(), kgf_mpa(), loss_flux(), mm_inch(), mpa_kgf(), mpa_psi()

Examples

library(pipenostics)

psi_mpa(c(6.89475728e-3, 1))

Estimate Reynolds number

Description

Estimate Reynolds number for fluid flow in a cylindrical pipe.

Usage

re_u(d, mu, u, rho)

re_v(d, mu, v, rho)

re_m(d, mu, m)

Arguments

d

internal diameter of pipe, [m]. Type: assert_double.

mu

dynamic viscosity of fluid in pipe, [kg/m/s]. Type: assert_double.

u

mean velocity of fluid in pipe, [m/s]. Type: assert_double.

rho

mass density of fluid in pipe, [kg/m³]. Type: assert_double.

v

volumetric flow rate of fluid in pipe, [m³/s]. Type: assert_double.

m

mass flow rate of fluid in pipe, [kg/s]. Type: assert_double.

Details

The calculation of Reynolds number is bounded by physically reasonable limits of fluid properties found in domain specificity of the package.

Value

Reynolds number - a dimensionless quantity that reveals the ratio between inertial and viscous forces in the fluid, []. Type: assert_double.

See Also

Other Fluid properties: fric_buzzelli(), fric_romeo(), fric_vatankhan()

Examples

library(pipenostics)

# Reynolds numbers for typical district heating water flows at temperature
# near 25 °C in a set of pipes with different sizes:

range(re_u(seq(.25, 1, 0.05), .89, 1, 1000))

Shell92. Failure pressure of the corroded pipe

Description

Calculate failure pressure of the corroded pipe according to Shell92 code.

This code should be applied only to

  • single cross section of the pipeline containing a longitudinally oriented, flat bottom surface defect of corrosion/erosion type;

  • defects which depth is less than 85 % of pipe wall thickness.

The estimation is valid for single isolated metal loss defects of the corrosion/erosion type and when only internal pressure loading is considered.

As in the case of dnvpf, the defect is approximated by a rectangular form.

Usage

shell92pf(d, wth, uts, depth, l)

Arguments

d

nominal outside diameter of pipe, [mm]. Type: assert_double.

wth

nominal wall thickness of pipe, [mm]. Type: assert_double.

uts

ultimate tensile strength (UTS) or specified minimum tensile strength (SMTS) as a characteristic of steel strength, [MPa]. Type: assert_double.

depth

measured maximum depth of the corroded area, [mm]. Type: assert_double.

l

measured maximum longitudinal length of corroded area, [mm]. Type: assert_double.

Details

Numeric NAs may appear in case prescribed conditions of use are offended.

Value

Estimated failure pressure of the corroded pipe, [MPa]. Type: assert_double.

References

Timashev and A. Bushinskaya, Diagnostics and Reliability of Pipeline Systems, Topics in Safety, Risk, Reliability and Quality 30, doi:10.1007/978-3-319-25307-7.

See Also

Other Failure estimation: b31gmodpf(), b31gpf(), dnvpf(), mepof(), pcorrcpf()

Examples

library(pipenostics)

# Consider two pipes with the next specifications:
d     = c(812.8, 219.0)  # [mm]
wth   = c( 19.1,  14.5)  # [mm]
uts  = c(530.9, 455.1)   # [N/mm²]
l     = c(203.2, 200.0)  # [mm]
depth = c( 13.4,   9.0)  # [mm]

# Get the failure pressure for that pipes:
shell92pf(d, wth, uts, depth, l)

DNV-RP-F101. De-rate yield stress and tensile strength of pipe due to temperature

Description

Temperature is highly influence on pipe material properties and especially on its strength. Since in API SPECIFICATION 5L values of SMYS or UTS are postulated at room conditions, in case of higher temperature magnitudes they should be corrected. For that purpose DNV-RP-F101 offers linear de-rating for SMYS or UTS according to figure 2-3.

Usage

strderate(x, temperature = 24.3)

Arguments

x

specified minimum yield of stress (SMYS), or ultimate tensile strength (UTS), or specified minimum tensile strength (SMTS) as a characteristic of steel strength at room temperature, [MPa]. Type: assert_double.

temperature

temperature of pipe wall, [°C]. Type: assert_double.

Value

De-rated value of x, i.e. of appropriate pipe material property, [MPa] . Type: assert_double.

Examples

library(pipenostics)

pipe_specs <- api5l3tdata[api5l3tdata$origin == 10,]

# De-rate SMYS for a single value of temperature:
with(pipe_specs, strderate(mpa_psi(smys), 53))

# De-rate UTS for a set of temperature values:
with(
  pipe_specs,
  strderate(mpa_psi(uts),seq(0, 250, length.out = length(uts)))
)

Massively trace backwards thermal-hydraulic regime for district heating network

Description

Trace values of thermal-hydraulic regime (temperature, pressure, flow rate, and other) in the bunched pipeline against the flow direction using user-provided values of specific heat loss power.

Algorithm also suits for partially measurable district heating network with massive data lack conditions, when there are no temperature and pressure sensor readings on the majority of terminal nodes.

Usage

tracebw(
  sender = 6,
  acceptor = 7,
  temperature = 70,
  pressure = pipenostics::mpa_kgf(6),
  flow_rate = 20,
  d = 100,
  wth = 8,
  len = 72.446,
  loss = 78.4,
  roughness = 0.001,
  inlet = 0.5,
  outlet = 1,
  method = "romeo",
  opinion = "median",
  verbose = TRUE,
  csv = FALSE,
  file = "tracebw.csv"
)

Arguments

sender

identifier of the node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

identifier of the node which heat carrier flows in. According to topology of test bench considered this identifier should be unique for every row. Type: any type that can be painlessly coerced to character by as.character.

temperature

sensor-measured temperature of heat carrier (water) sensor-measured on the terminal acceptor node, [°C]. Use NA_float_s for (terminal) nodes without temperature sensor. Type: assert_double.

pressure

sensor-measured absolute pressure of heat carrier (water) inside the pipe (i.e. acceptor's incoming edge), [MPa]. Type: assert_double.

flow_rate

sensor-measured amount of heat carrier (water) on terminal node that is transferred by pipe (i.e. acceptor's incoming edge) during a period, [ton/h]. Type: assert_double. Use NA_float_s for nodes without flow rate sensor.

d

outside diameter of pipe (i.e.diameter of acceptor's incoming edge), [mm]. Type: assert_double.

wth

wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length (i.e. length of acceptor's incoming edge), [m]. Type: assert_double.

loss

user-provided value of specific heat loss power for each pipe, [kcal/m/h]. Values of the argument can be obtained experimentally, or taken from regulatory documents. Type: assert_double.

roughness

roughness of internal wall of pipe (i.e. acceptor's incoming edge), [m]. Type: assert_double.

inlet

elevation of pipe inlet, [m]. Type: assert_double.

outlet

elevation of pipe outlet, [m]. Type: assert_double.

method

method of determining Darcy friction factor:

  • romeo

  • vatankhah

  • buzzelli

Type: assert_choice. For more details see dropp.

opinion

method for aggregating values of regime parameters on each node for the next tracing step:

mean

values of parameter are averaged before the next tracing step

median

median of parameter values are used for the next tracing step

Type: assert_choice.

verbose

logical indicator: should they watch tracing process on console? Type: assert_flag.

csv

logical indicator: should they incrementally dump results to csv- file while tracing? Type: assert_flag.

file

name of csv-file which they dump results to. Type: assert_character of length 1 that can be used safely to create a file and write to it.

Details

They consider the topology of district heating network represented by m325nxdata:

m325tracebw0.png

The network may be partially sensor-equipped too:

m325tracebwp.png

In latter case no more than two nodes must be equipped with pressure and temperature sensors whereas for other nodes only flow rate sensors must be installed.

Tracing starts from sensor-equipped nodes and goes backwards, i.e against the flow direction.

Though some input arguments are natively vectorized their individual values all relate to common part of district heating network, i.e. associated with common object. It is due to isomorphism between vector representation and directed graph of this network. For more details of isomorphic topology description see m325nxdata.

Before tracing starts for the next node, previously calculated values of thermal-hydraulic parameters are aggregated by either averaging or by median. The latter seems more robust for avoiding strong influence of possible outliers which may come from actual heating transfer anomalies, erroneous sensor readings or wrong pipeline specifications.

Aggregation for values of flow rate at the node is always sum.

Value

data.frame containing results (detailed log) of tracing in narrow format:

node

Tracing job. Identifier of the node which regime parameters is calculated for. Values in this vector are identical to those in argument acceptor. Type: assert_character.

tracing

Tracing job. Identifiers of nodes from which regime parameters are traced for the given node. Identifier sensor is used when values of regime parameters for the node are sensor readings. Type: assert_character.

backward

Tracing job. Identifier of tracing direction. It constantly equals to TRUE. Type: assert_logical.

aggregation

Tracing job. Identifier of aggregation method: span, median, mean, or identity. Type: assert_character.

loss

Traced thermal hydraulic regime. Normative specific heat loss power of adjacent pipe, [kcal/m/h]. Type: assert_double.

flux

Traced thermal hydraulic regime. Normative heat flux of adjacent pipe, [W/m²]. Type: assert_double.

Q

Traced thermal hydraulic regime. Normative heat loss of adjacent pipe per day, [kcal]. Type: assert_character.

temperature

Traced thermal hydraulic regime. Traced temperature of heat carrier (water) that is associated with the node, [°C]. Type: assert_double.

pressure

Traced thermal hydraulic regime. Traced pressure of heat carrier (water) that is associated with the node, [MPa]. Type: assert_double.

flow_rate

Traced thermal hydraulic regime. Traced flow rate of heat carrier (water) that is associated with the node, [ton/h]. Type: assert_double.

job

Tracing job. Value of tracing job counter. Type: assert_count.

Type: assert_data_frame.

See Also

Other Regime tracing: dropg(), dropp(), dropt(), m325tracebw(), m325tracefw(), m325traceline(), tracefw(), traceline()

Examples

library(pipenostics)

# It is possible to run without specification of argument values:
tracebw()

# Consider isomorphic representation of District Heating Network graph:
DHN <- m325nxdata

# * Adapt node identifiers for ordering representation simplification:
DHN[["sender"]]   <- sprintf("N%02i", DHN[["sender"]])
DHN[["acceptor"]] <- sprintf("N%02i", DHN[["acceptor"]])

# * Provided actual values of specific heat loss power
#   (say, field measurements) for each pipe in DHN, [kcal/m/h]:
 actual_loss <- c(
   96.2360000000000,  96.2880000000000,  70.5840000000000,
  116.0449431257620,  70.7340165868372,  96.2114863150603,
   78.4000000000000, 116.0158816197730,  28.1152000000000,
   24.9182000000000, 116.6790503515620, 152.8311474487970,
  152.7893321276950,  96.7331745004449,  96.6000000000000,
  116.6668284940720,  24.9596000000000, 115.9228232554340,
   28.1658000000000,  96.1226072815915,  77.8240000000000,
  115.9455144867840,  70.6899252508703,  96.1840000000000,
   96.2360000000000,  70.5400000000000
)

# * Remove inappropriate attributes of the graph:
DHN.1 <- DHN[,
  setdiff(
    colnames(DHN),
    c("a", "year", "insulation", "laying", "beta", "exp5k")
  )
]

# * Trace thermal-hydraulic regime for DHN:
tracebw_report <- do.call(
  "tracebw", c(as.list(DHN.1), list(loss = actual_loss), verbose = FALSE)
)

# * If the actual values of specific heat loss power presented above are
#   close to those in Minenergo-325, then the results of regime tracing match
#   the normative procedure:

m325_report <- do.call("m325tracebw", c(as.list(DHN), verbose = FALSE))

stopifnot(
  all.equal(tracebw_report$temperature, m325_report$temperature, tol = 1e-4),
  all.equal(tracebw_report$pressure,    m325_report$pressure,    tol = 1e-4),
  all.equal(tracebw_report$flow_rate,   m325_report$flow_rate,   tol = 1e-4)
)

Massively trace forwards thermal-hydraulic regime for district heating network

Description

Trace values of thermal-hydraulic regime (temperature, pressure, flow rate, and other) in the bunched pipeline along the flow direction using user-provided values of specific heat loss power.

Usage

tracefw(
  sender = c(0, 1),
  acceptor = c(1, 2),
  temperature = c(70, NA_real_),
  pressure = c(0.588399, NA_real_),
  flow_rate = c(20, NA_real_),
  d = c(100, 100),
  wth = c(8, 8),
  len = c(72.446, 72.446),
  loss = c(78.4, 78.4),
  roughness = c(0.001, 0.001),
  inlet = c(0.5, 1),
  outlet = c(1, 1),
  elev_tol = 0.1,
  method = "romeo",
  verbose = TRUE,
  csv = FALSE,
  file = "tracefw.csv",
  use_cluster = FALSE
)

Arguments

sender

identifier of the node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

identifier of the node which heat carrier flows in. According to topology of test bench considered this identifier should be unique for every row. Type: any type that can be painlessly coerced to character by as.character.

temperature

sensor-measured temperature of heat carrier (water) sensor-measured on the root node, [°C]. Use NA_float_s for nodes without temperature sensor. Type: assert_double.

pressure

sensor-measured absolute pressure of heat carrier (water) inside the pipe on the root node, [MPa]. Use NA_float_s for nodes without pressure sensor. Type: assert_double.

flow_rate

sensor-measured amount of heat carrier (water) on root node that is transferred by pipe during a period, [ton/h]. Type: assert_double. Use NA_float_s for nodes without flow rate sensor.

d

outside diameter of pipe (i.e.diameter of acceptor's incoming edge), [mm]. Type: assert_double.

wth

wall thickness of pipe, [mm]. Type: assert_double.

len

pipe length (i.e. length of acceptor's incoming edge), [m]. Type: assert_double.

loss

user-provided value of specific heat loss power for each pipe in tracing path, [kcal/m/h]. Values of the argument can be obtained experimentally, or taken from regulatory documents. Type: assert_double.

roughness

roughness of internal wall of pipe (i.e. acceptor's incoming edge), [m]. Type: assert_double.

inlet

elevation of pipe inlet, [m]. Type: assert_double.

outlet

elevation of pipe outlet, [m]. Type: assert_double.

elev_tol

maximum allowed discrepancy between adjacent outlet and inlet elevations of two subsequent pipes in the traced path, [m]. Type: assert_number.

method

method of determining Darcy friction factor:

  • romeo

  • vatankhah

  • buzzelli

Type: assert_choice. For more details see dropp.

verbose

logical indicator: should they watch tracing process on console? Type: assert_flag.

csv

logical indicator: should they incrementally dump results to csv- file while tracing? Type: assert_flag.

file

name of csv-file which they dump results to. Type: assert_character of length 1 that can be used safely to create a file and write to it.

use_cluster

utilize functionality of parallel processing on multi-core CPU. Type: assert_flag.

Details

They consider the topology of district heating network represented by m325nxdata:

tracefw.png

Tracing starts from sensor-equipped root node and goes forward, i.e along the flow direction. Function traceline serves under the hood for tracing identified linear segments from root node to every terminal node. Hence they only need root node to be equipped with sensors. Sensors at other nodes are redundant in forward tracing, since the tracing algorithm by no means consider them for tracing.

Moreover in the forward tracing algorithm they assume the flow of heat carrier is distributed proportionally to the cross-sectional area of the outgoing pipeline. Actually, a lot of reasons may cause significant deviations from this assumption. As a result, the sequence of paired backward/forward tracing may be divergent for regime parameters.

Though some input arguments are natively vectorized their individual values all relate to common part of district heating network, i.e. associated with common object. It is due to isomorphism between vector representation and directed graph of this network. For more details of isomorphic topology description see m325nxdata.

They are welcome to couple the algorithm with functionality of data.table.

Value

data.frame containing results (detailed log) of tracing in narrow format:

node

Tracing job. Identifier of the node which regime parameters is calculated for. Values in this vector are identical to those in argument acceptor. Type: assert_character.

tracing

Tracing job. Identifiers of nodes from which regime parameters are traced for the given node. Identifier sensor is used when values of regime parameters for the node are sensor readings. Type: assert_character.

backward

Tracing job. Identifier of tracing direction. It constantly equals to FALSE. Type: assert_logical.

aggregation

Tracing job. Identifier of the aggregation method associated with traced values. For forward tracing the only option is identity. Type: assert_character.

loss

Traced thermal hydraulic regime. Normative specific heat loss power of adjacent pipe, [kcal/m/h]. Type: assert_double.

flux

Traced thermal hydraulic regime. Normative heat flux of adjacent pipe, [W/m²]. Type: assert_double.

Q

Traced thermal hydraulic regime. Normative heat loss of adjacent pipe per day, [kcal]. Type: assert_character.

temperature

Traced thermal hydraulic regime. Traced temperature of heat carrier (water) that is associated with the node, [°C]. Type: assert_double.

pressure

Traced thermal hydraulic regime. Traced pressure of heat carrier (water) that is associated with the node, [MPa]. Type: assert_double.

flow_rate

Traced thermal hydraulic regime. Traced flow rate of heat carrier (water) that is associated with the node, [ton/h]. Type: assert_double.

job

Tracing job. Value of tracing job counter. For forward tracing value of job counts the number of traced paths from root node. Type: assert_count.

Type: assert_data_frame.

See Also

Other Regime tracing: dropg(), dropp(), dropt(), m325tracebw(), m325tracefw(), m325traceline(), tracebw(), traceline()

Examples

library(pipenostics)

# Minimum two nodes should be in district heating network graph:
tracefw(verbose = FALSE)

# Consider isomorphic representation of District Heating Network graph:
DHN <- m325nxdata

# * remove irrelevant parameters from the test bench:
DHN[c("a", "year", "insulation", "laying", "beta", "exp5k")] <- NULL
DHN[c("temperature", "pressure", "flow_rate")] <- NA_real_

# * avoid using numeric identifiers for nodes:
DHN$sender   <- sprintf("N%02i", DHN$sender)
DHN$acceptor <- sprintf("N%02i", DHN$acceptor)

# * provide current regime parameters for root node:
root_node <- 12
DHN[root_node, "temperature"] <-  70.4942576978  # [°C]
DHN[root_node, "pressure"]    <-   0.6135602014  # [MPa]
DHN[root_node, "flow_rate"]   <- 274.0           # [ton/h]
rm(root_node)

# * provide actual values of specific heat loss power, [kcal/m/h], for each
# segment N01 - N26. Since N12 is a root node, the specific heat loss
# power for this acceptor is set to 0 (or may be any other numeric value).
actual_loss <- c(
  96.8,  96.8,  71.2, 116.7, 71.3,  96.8, 78.5, 116.7, 28.6, 24.5,
 116.7,   0.0, 153.2,  96.8, 96.8, 116.7, 24.5, 116.7, 28.6, 96.8,
  78.5, 116.7,  71.3,  96.8, 96.8,  71.1
)

# Trace the test bench forward for the first time:
do.call(
  "tracefw",
  c(as.list(DHN), list(loss = actual_loss), verbose = FALSE, elev_tol = .5)
)

Trace thermal-hydraulic regime for linear segment of district heating network

Description

Trace values of thermal-hydraulic regime (temperature, pressure, flow_rate, and other) along the adjacent linear segments of pipeline using user-provided values of specific heat loss power.

Usage

traceline(
  temperature = 130,
  pressure = mpa_kgf(6),
  flow_rate = 250,
  g = 0,
  d = 720,
  wth = 12,
  len = c(600, 530, 300, 350),
  loss = c(348, 347.1389, 346.3483, 345.861),
  roughness = 0.006,
  inlet = 0,
  outlet = 0,
  elev_tol = 0.1,
  method = "romeo",
  forward = TRUE,
  absg = TRUE
)

Arguments

temperature

Traced thermal hydraulic regime. Sensor-measured temperature of heat carrier (water) inside the pipe sensor-measured at the inlet (forward tracing) or at the outlet (backward tracing) of path, [°C]. Type: assert_number.

pressure

Traced thermal hydraulic regime. Sensor-measured absolute pressure of heat carrier (water) sensor-measured at the inlet (forward tracing) or at the outlet (backward tracing) of path, [MPa]. Type: assert_number.

flow_rate

Traced thermal hydraulic regime. Amount of heat carrier (water) sensor-measured at the inlet (forward tracing) or at the outlet (backward tracing) of path, [ton/h]. Type: assert_number.

g

amount of heat carrier discharge to network for each pipe segment in the tracing path enumerated along the direction of flow. If flag absg is TRUE then they treat argument g as absolute value in [ton/h], otherwise they do as percentage of flow_rate in the pipe segment. Type: assert_double.

d

outside diameters of subsequent pipes in tracing path that are enumerated along the direction of flow, [mm]. Type: assert_double.

wth

wall thickness of pipe, [mm]. Type: assert_double.

len

length of subsequent pipes in tracing path that are enumerated along the direction of flow, [m]. Type: assert_double.

loss

user-provided value of specific heat loss power for each pipe in tracing path enumerated along the direction of flow, [kcal/m/h]. Values of the argument can be obtained experimentally, or taken from regulatory documents. Type: assert_double.

roughness

roughness of internal wall for each pipe in tracing path enumerated along the direction of flow, [m]. Type: assert_double.

inlet

elevation of pipe inlet for each pipe in tracing path enumerated along the direction of flow, [m]. Type: assert_double.

outlet

elevation of pipe outlet for each pipe in tracing path enumerated along the direction of flow, [m]. Type: assert_double.

elev_tol

maximum allowed discrepancy between adjacent outlet and inlet elevations of two subsequent pipes in the traced path, [m]. Type: assert_number.

method

method of determining Darcy friction factor

  • romeo

  • vatankhah

  • buzzelli

Type: assert_choice. For more details see dropp.

forward

tracing direction flag: is it a forward direction of tracing? If FALSE the backward tracing is performed. Type: assert_flag.

absg

Whether argument g (amount of heat carrier discharge to network) is an absolute value in [ton/h] (TRUE) or is it a percentage of flow rate in the pipe segment (FALSE)? Type: assert_flag.

Details

They consider only simple tracing paths which do not contain rings and any kind of parallelization. At the same time bidirectional (forward and backward) tracing is possible in accordance with sensor position. They also may consider discharges to network at the inlet of each pipeline segment as an approximation of actual forks of flows. Relevant illustration of adopted assumptions for 4-segment tracing path is depicted on the next figure.

regtrace.png

They make additional check for consistency of inlet and outlet values for subsequent pipe segments. Discrepancy of appropriate elevations cannot be more than elev_tol.

Since inner diameter of the pipe is used as input, the the thickness of the pipe wall additionally considered in heat flux calculations. Pipe wall thickness is derived from pipe diameter using GOST 30732 specifications.

Value

list containing results (detailed log) of tracing for each pipe in tracing path enumerated along the direction of flow:

temperature

Traced thermal hydraulic regime. Traced temperature of heat carrier (water), [°C]. Type: assert_double.

pressure

Traced thermal hydraulic regime. Traced pressure of heat carrier (water) for each pipe in tracing path enumerated along the direction of flow, [MPa]. Type: assert_double.

flow_rate

Traced thermal hydraulic regime. Traced flow rate of heat carrier (water) for each pipe in tracing path enumerated along the direction of flow, [ton/h]. Type: assert_double.

loss

User-provided specific heat loss power for each pipe in tracing path enumerated along the direction of flow, [kcal/m/h], - copy of input. Type: assert_double.

flux

Heat flux for each pipe in tracing path enumerated along the direction of flow, [W/m²]. Type: assert_double.

Q

Heat loss for each pipe in tracing path enumerated along the direction of flow per day, [kcal]. Type: assert_double.

Type: assert_list.

See Also

Other Regime tracing: dropg(), dropp(), dropt(), m325tracebw(), m325tracefw(), m325traceline(), tracebw(), tracefw()

Examples

library(pipenostics)

# Consider 4-segment tracing path.
# First, let sensor readings for forward tracing:
t_fw <- 130         # [°C]
p_fw <- mpa_kgf(6)  # [MPa]
g_fw <- 250         # [ton/h]

# Let discharges to network for each pipeline segment are somehow determined
# as
discharges <- seq(0, 30, 10)  # [ton/h]

# Experimentally obtained values of specific heat loss power are
actual_loss <- c(348.0000, 347.1389, 346.3483, 345.8610)  # [kcal/m/h]

# Then the calculated regime (red squares) for forward tracing is
traceline(
  t_fw, p_fw, g_fw, discharges, loss = actual_loss, forward = TRUE
)

# Next consider values of traced regime as sensor readings for backward
# tracing:
t_bw <- 127.3367  # [°C]
p_bw <- .5870330  # [MPa]
g_bw <- 190       # [ton/h]

# Then the calculated regime (red squares) for backward tracing is
regime_bw <- traceline(
  t_bw, p_bw, g_bw, discharges, loss = actual_loss, forward = FALSE
)
print(regime_bw)

# Let compare sensor readings with backward tracing results:
with(regime_bw, {
  lambda <- function(val, constraint)
    c(val, constraint, constraint - val,
      abs(constraint - val) * 100/constraint)
  first <- 1
  structure(
    rbind(
      lambda(temperature[first], t_fw),
      lambda(pressure[first],    p_fw),
      lambda(flow_rate[first], g_fw)
    ),
    dimnames = list(
      c("temperature", "pressure", "flow_rate"),
      c("sensor.value", "traced.value", "abs.discr", "rel.discr")
    )
  )
})