npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@neutrium/pipe

v2.0.1

Published

The pipe module of the Neutrium library

Downloads

74

Readme

Neutrium.pipe

The pipe module of the Neutrium engineering library.

Breaking Changes

Version 2.*

Version 2 of this library saw the additon of the ASTM B88 standard and several breaking changes regarding naming conventions:

  • The SchedulePipe object has been renamed to ASME_B36_10_Pipe.
  • The PEPipe object has been renamed to ISO_11922_Pipe.

Getting Started

Installing

You can install NeutriumJS.Pipe using npm.

npm install @neutrium/pipe --save

Including

Typescript

You can include the NeutriumJS.Quantity module using an import statement in typescript:

import { Pipe } from "@neutrium/pipe"

let pipe = new Pipe();

This module is built with the declaration files so type hinting should work once the module has been imported.

Node

var Pipe = require("@neutrium/pipe");

Browsers

The Pipe module is currently a commonjs (node) package. To use it in a browser environment you will need to use a tool like browserify to convert it to a web bundle and expose the Pipe object.

Usage

General Pipe

Creation

You can create a general pipe object by specifying an outer diameter and wall thickness as @neutrium/quantity objects :

// Pipe(<outer diameter>, <wall thickness>)
let pipe = new Pipe(new Quantity("100mm"), new Quantity("6mm"));

Alternatively you can specify the outer diameter and wall thickness using strings that will be converted to Quantity objects internally:

let pipe = new Pipe("100mm", "6mm");

The pipe object will maintain unit consistency and where applicable will return all attributes in the units used to specify outer diameter.

Usage

Once the pipe object has been created you can access its attributes directly:

pipe.od 	// The pipe outer diameter
pipe.id 	// The pipe inner diameter
pipe.wt 	// The pipe wall thickness
pipe.icsa 	// The pipe internal cross sectional area
pipe.ecsa 	// The pipe external cross sectional area

Each of these attributes are Quantity objects and can be readily converted to a desired unit using the to() method, by default each quantity will have the units specified for od in the constructor with the exception of wt. No special checking is performed to ensure unit consistency and therefore od and wall thickness could be returned in different units at the users digression.

The underlying scalar value of the quantity can be accessed using the scalar property (e.g. pipe.od.scalar) which returns a @neutrium/math Decimal or as a plain old javascript numbers using pipe.od.scalar.toNumber().

While the big number implmentation of the Neutrium Decimal provides superior accuracy it has performance penalties. Therefore where maximum performance is required (i.e. for iterative hydraulic calculations) it is recommended to utilise the plain javascript object returned from the raw() method:

let raw = pipe.raw();

You can also specify the unit you want the attributes to be returned as (otherwise the units used for od will be used):

let raw = pipe.raw("m");

The object returned from the raw method has the following structure with each attribute being a javascript number:

raw = {
	id: number,
	od: number,
	wt: number,
	icsa: number
}

NPS/DN Schedule Pipe (ASME/ANSI B36.10/19)

Creation

A Schedule pipe object is a subclass of the general pipe and can be created by providing the size (sting | Quantity) and the schedule (string):

let pipe1 = ASME_B36_10_Pipe(new Quantity("100mm"), "40");
let pipe2 = ASME_B36_10_Pipe("4in", "40");

The units of the pipe size will dictate whether NPS or DN nominal size is used for lookup. If the nominal size is provided in inches NPS nominal size will be used, for all other units the size will be converted to mm and DN nominal size will be used. This is an important distinction as schedule pipe nominal size is not an exact conversion. For example 4" NPS is equivalent to DN 100mm pipe, not 101.6mm as one would expect from a direct conversion.

If you attempt to create a schedule pipe with a invalid size and schedule combination an Error will be thrown.

Usage

Once a schedule pipe has been created you can use it as you would a general pipe object, however the schedule pipe has some additional information:

pipe.schedule 		// The pipe schedule
pipe.dn 			// The DN nominal size (millimeters)
pipe.nps 			// The NPS nominal size (inches)

Polyethylene Pipe (ISO 11922 & AS/NZS4130)

Creation

The ISO_11922_Pipe class is a subclass of the general pipe, it can be created by providing a suitable outer diameter and PN grade:

let pipe = new ISO_11922_Pipe("25mm", "6");

You can also optionally supply the the compound type PE80 or PE100 (default):

let pipe = new ISO_11922_Pipe("200mm", "10", "PE80");

If you attempt to create a PE pipe with a invalid size and PN rating combination an Error will be thrown.

Usage

Once a ISO_11922_Pipe object has been created you can use it as you would a general pipe object, however the PE pipe has some additional properties:

pipe.pn 		// The nominal working pressure of the pipe/PN rating (in bar)
pipe.compound	// The material used for the pipe (either PE80 or PE100)
pipe.sdr		// The standard dimension ratio of the pipe

Seamless Copper Water Tube (ASTM B88)

Creation

Due to variations in nominal diameter and wall thickness specified in the imperial (ASTM B88) and metric (ASTM B88M) versions of ASTM B88 standard, seamless copper tube can be created by providing a suitable nominal diameter and type (K, L & M for B88 and A, B, C for B88M) for the respective standard:

// ASTM B88 - Imperial standard
let tube1 = new ASTM_B88_Tube("1in", "K");
// ASTM B88M - Metric version
let tube2 = new ASTM_B88M_Tube("22mm", "A");

If you attempt to create a ASTM B88 tube with an invalid size and/or type an Error will be thrown.

Usage

Once a ASTM_B88(M)_Tube object has been created you can use it as you would a general pipe object, however the ASTM_B88(M)_Tube pipe has some additional properties:

pipe.type 		// The ASTM B88/B88M type of the tube
pipe.nps		// The nominal size of the tube (reported in units consistent with corresponding standard)

Donations

NeutriumJS is free software, but you can support the developers by donating here.

Release Notes

| Version | Notes | |:-------:|:------| | 1.0.0 | Initial Release | | 2.0.0 | Addition of ASTM B88 and revision of API |

License

Creative Commons Attribution 4.0 International