Pipes

This file contains functions which convert between the nominal, inner, and outer diameters of pipes based on their standard dimension ratio (SDR).

Note: added to pipe database for schedule 80, 120 and 160 using https://www.engineersedge.com/pipe_schedules.htm

class aguaclara.core.pipes.SCH(value)[source]

An enumeration.

class aguaclara.core.pipes.Pipe(nd, sdr)[source]

A pipe using the SDR system, represented by its nominal diameter (ND) and standard dimension ratio (SDR)

property od

The outer diameter of the pipe.

property id_sdr

The inner diameter of the pipe, calculated using the pipe’s OD and SDR.

property id_sch40

id_sch40 is deprecated; use id_sch instead.

id_sch(schedule)[source]

The inner diameter of this pipe, based on schedule and nominal diameter :param schedule: the schedule of the pipe (Ex: pipes.SCH.SCH40) :type schedule: pipes.SCH

Returns:

The inner diameter of the pipe

Return type:

u.inch

sch(NDarr=None, SCHarr=None)[source]

The nominal diameter and schedule that best fits this pipe’s criteria and NDarr and SCHarr :param NDarr: an array of preferred nominal diameters (Ex: [10]*u.inch). Default: None :type NDarr: numpy.array * u.inch :param SCHarr: an array of preferred schedules (Ex: [pipes.SCH.SCH160, pipes.SCH.SCH40]). Default: None :type SCHarr: pipes.SCH list

Returns:

(nominal diameter, schedule) tuple or None

Return type:

(u.inch, SCH) or None

aguaclara.core.pipes.makePipe_ND_SDR(ND, SDR)[source]

Return a Pipe object, given a ND (nominal diameter) and SDR (standard diameter ratio).

Parameters:
  • ND (u.inch) – nominal diameter of pipe

  • SDR (float) – standard diameter ratio of pipe

Returns:

a pipe with the given ND and SDR

Return type:

Pipe

aguaclara.core.pipes.makePipe_minID_SDR(minID, SDR)[source]

Return a new pipe, given its minID (minimum inner diameter) and SDR (standard diameter ratio).

Parameters:
  • minID (u.inch) – minimum inner diameter of pipe

  • SDR (float) – standard diameter ratio of pipe

Returns:

a pipe with SDR and ND calculated from given minID and SDR

Return type:

Pipe

aguaclara.core.pipes.OD(ND)[source]

Return a pipe’s outer diameter according to its nominal diameter. :param ND: nominal diameter of pipe :type ND: u.inch :return: outer diameter of pipe, in inches :rtype: u.inch

aguaclara.core.pipes.OD_SDR(ID, SDR)[source]

Return the minimum OD that is available given ID and SDR. raises: ValueError if SDR is 2.

Parameters:
  • ID (u.inch) – inner diameter of pipe

  • SDR (float) – the standard dimension ratio of the pipe

Returns:

minimum outer diameter available

Return type:

u.inch

aguaclara.core.pipes.fitting_od(pipe_nd, fitting_sdr=41)[source]

Return the OD of a fitting given SDR and the ND of the pipe it will be fitted around

Parameters:
  • pipe_nd (u.inch) – ND of the pipe to be fitted around

  • fitting_sdr (float) – SDR of the pipe to be fitted around

Returns:

the outer diameter of a fitting

Return type:

u.inch

aguaclara.core.pipes.ID_SDR(ND, SDR)[source]

Return the inner diameter of a pipe given its nominal diameter and SDR (standard dimension ratio).

Parameters:
  • ND (u.inch) – the nominal diameter

  • SDR (float) – the outer diameter divided by the wall thickness.

Returns:

inner diameter of a pipe

Return type:

u.inch

aguaclara.core.pipes.ID_sch(ND, schedule)[source]

Return the inner diameter of this pipe, given the ND and desired schedule :param ND: the nominal diameter of the pipe :type ND: u.inch :param schedule: the schedule of the pipe (use SCH.SCH40, SCH.SCH80, etc) :type schedule: pipes.SCH

Returns:

inner diameter of pipe

Return type:

u.inch

aguaclara.core.pipes.ND_all_available()[source]

Return an array of available nominal diameters.

NDs available are those commonly used as based on the ‘Used’ column in the pipedb.

Returns:

an array of available nominal diameters

Return type:

numpy.array * u.inch

aguaclara.core.pipes.OD_all_available()[source]

Return an array of available outer diameters.

NDs available are those commonly used as based on the ‘Used’ column in the pipedb.

Returns:

an array of available outer diamters

Return type:

numpy.array * u.inch

aguaclara.core.pipes.ID_SDR_all_available(SDR)[source]

Return an array of inner diameters with a given SDR.

IDs available are those commonly used based on the ‘Used’ column in the pipedb.

Parameters:

SDR (float) – the standard dimension ratio

Returns:

an array of inner diamers

Return type:

numpy.array * u.inch

aguaclara.core.pipes.SCH_all_available(minID, maxSDR, NDarr=None, SCHarr=[<SCH.SCH40: 'SCH40Wall'>, <SCH.SCH80: 'SCH80Wall'>, <SCH.SCH120: 'SCH120Wall'>, <SCH.SCH160: 'SCH160Wall'>])[source]

Return a list of tuples (nominal diameter, schedule) representing schedule pipes that fit the criteria. Meeting criteria means: has at least minID, has at most maxSDR, and whose ND and/or SCH are in NDarr and SCHarr respectively. Default: NDarr looks through all available ND, SCHarr looks through all schedules

Parameters:
  • minID (u.inch) – the minimum inner diameter required

  • maxSDR (float) – the maximum SDR required

  • NDarr (numpy.array * u.inch) – the preferred list of NDs to look through

  • SCHarr (pipes.SCH list) – the preferred list of schedules to look through

Returns:

list of tuples in the form (nominal diameter, schedule). Example: (10*u.inch, “SCH160”)

Return type:

(float*u.inch, string) list

aguaclara.core.pipes.ND_SDR_available(ID, SDR)[source]

Return an available ND given an ID and a schedule.

Takes the values of the array, compares to the ID, and finds the index of the first value greater or equal.

Parameters:
  • ID (u.inch) – the inner diameter

  • SDR (float) – the standard dimension ratio

Returns:

an available ND

Return type:

u.inch

aguaclara.core.pipes.ND_available(NDguess)[source]

Return the minimum ND that is available.

Parameters:

NDguess (u.inch) – the lower bound nominal diameter

Returns:

the minimum ND available greater than NDguess

Return type:

u.inch

aguaclara.core.pipes.OD_available(ODguess)[source]

Return the minimum OD that is available.

Parameters:

ODguess (u.inch) – the lower bound outer diameter

Returns:

the minimum OD available greater than ODguess

Return type:

u.inch

aguaclara.core.pipes.socket_depth(ND)[source]

Return the socket depth given ND

Parameters:

ND (u.inch) – the nominal diameter

Returns:

the socket depth

Return type:

u.inch (or the type of ND)

aguaclara.core.pipes.cap_thickness(ND)[source]

Return the cap thickness given ND

Parameters:

ND (u.inch) – the nominal diameter

Returns:

the cap thickness

Return type:

u.inch