# Pipe schedules (fluids.piping)

`fluids.piping.``gauge_from_t`(t, SI=True, schedule='BWG')

  Looks up the gauge of a given wire thickness of given schedule. Values are all non-linear, and tabulated internally.

  Parameters
    t float

      Thickness, [m]

    SI bool, optional

      If False, requires that the thickness is given in inches not meters

    schedule str

      Gauge schedule, one of ‘BWG’, ‘AWG’, ‘SWG’, ‘MWG’, ‘BSWG’, or ‘SSWG’

  Returns
    gauge float-like

      Wire Gauge, [-]

  Notes

  An internal variable, tol, is used in the selection of the wire gauge. If the next smaller wire gauge is within 10% of the difference between it and the previous wire gauge, the smaller wire gauge is selected. Accordingly, this function can return a gauge with a thickness smaller than desired in some circumstances.

  - Birmingham Wire Gauge (BWG) ranges from 0.2 (0.5 inch) to 36 (0.004 inch).

  - American Wire Gauge (AWG) ranges from 0.167 (0.58 inch) to 51 (0.00099 inch). These are used for electrical wires.

  - Steel Wire Gauge (SWG) ranges from 0.143 (0.49 inch) to 51 (0.0044 inch). Also called Washburn & Moen wire gauge, American Steel gauge, Wire Co. gauge, and Roebling wire gauge.

  - Music Wire Gauge (MWG) ranges from 0.167 (0.004 inch) to 46 (0.18 inch). Also called Piano Wire Gauge.

  - British Standard Wire Gage (BSWG) ranges from 0.143 (0.5 inch) to 51 (0.001 inch). Also called Imperial Wire Gage (IWG).

  - Stub’s Steel Wire Gage (SSWG) ranges from 1 (0.227 inch) to 80 (0.013 inch)

  References

  1

    Oberg, Erik, Franklin D. Jones, and Henry H. Ryffel. Machinery’s Handbook. Industrial Press, Incorporated, 2012.

  Examples

      >>> gauge_from_t(.5, SI=False, schedule='BWG')
      0.2

`fluids.piping.``nearest_pipe`(Do=None, Di=None, NPS=None, schedule='40')

  Searches for and finds the nearest standard pipe size to a given specification. Acceptable inputs are:

  - Nominal pipe size

  - Nominal pipe size and schedule

  - Outer diameter Do

  - Outer diameter Do and schedule

  - Inner diameter Di

  - Inner diameter Di and schedule

  Acceptable schedules are: ‘5’, ‘10’, ‘20’, ‘30’, ‘40’, ‘60’, ‘80’, ‘100’, ‘120’, ‘140’, ‘160’, ‘STD’, ‘XS’, ‘XXS’, ‘5S’, ‘10S’, ‘40S’, ‘80S’.

  Parameters
    Do float

      Pipe outer diameter, [m]

    Di float

      Pipe inner diameter, [m]

    NPS float

      Nominal pipe size, [-]

    schedule str

      String representing schedule size

  Returns
    NPS float

      Nominal pipe size, [-]

    Di float

      Pipe inner diameter, [m]

    Do float

      Pipe outer diameter, [m]

    t float

      Pipe wall thickness, [m]

  Notes

  Internal units within this function are mm. The imperial schedules are not quite identical to these value, but all rounding differences happen in the sub-0.1 mm level.

  References

  1

    American National Standards Institute, and American Society of Mechanical Engineers. B36.10M-2004: Welded and Seamless Wrought Steel Pipe. New York: American Society of Mechanical Engineers, 2004.

  2

    American National Standards Institute, and American Society of Mechanical Engineers. B36-19M-2004: Stainless Steel Pipe. New York, N.Y.: American Society of Mechanical Engineers, 2004.

  Examples

      >>> nearest_pipe(Di=0.021)
      (1, 0.02664, 0.0334, 0.0033799999999999998)
      >>> nearest_pipe(Do=.273, schedule='5S')
      (10, 0.26630000000000004, 0.2731, 0.0034)

`fluids.piping.``t_from_gauge`(gauge, SI=True, schedule='BWG')

  Looks up the thickness of a given wire gauge of given schedule. Values are all non-linear, and tabulated internally.

  Parameters
    gauge float-like

      Wire Gauge, []

    SI bool, optional

      If False, will return a thickness in inches not meters

    schedule str

      Gauge schedule, one of ‘BWG’, ‘AWG’, ‘SWG’, ‘MWG’, ‘BSWG’, or ‘SSWG’

  Returns
    t float

      Thickness, [m]

  Notes

  - Birmingham Wire Gauge (BWG) ranges from 0.2 (0.5 inch) to 36 (0.004 inch).

  - American Wire Gauge (AWG) ranges from 0.167 (0.58 inch) to 51 (0.00099 inch). These are used for electrical wires.

  - Steel Wire Gauge (SWG) ranges from 0.143 (0.49 inch) to 51 (0.0044 inch). Also called Washburn & Moen wire gauge, American Steel gauge, Wire Co. gauge, and Roebling wire gauge.

  - Music Wire Gauge (MWG) ranges from 0.167 (0.004 inch) to 46 (0.18 inch). Also called Piano Wire Gauge.

  - British Standard Wire Gage (BSWG) ranges from 0.143 (0.5 inch) to 51 (0.001 inch). Also called Imperial Wire Gage (IWG).

  - Stub’s Steel Wire Gage (SSWG) ranges from 1 (0.227 inch) to 80 (0.013 inch)

  References

  1

    Oberg, Erik, Franklin D. Jones, and Henry H. Ryffel. Machinery’s Handbook. Industrial Press, Incorporated, 2012.

  Examples

      >>> t_from_gauge(.2, False, 'BWG')
      0.5