@neutrium/pipe
Version:
The pipe module of the Neutrium library
28 lines (27 loc) • 1.09 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var quantity_1 = require("@neutrium/quantity");
var Pipe = /** @class */ (function () {
// @param {number | Quantity} od - The outer diameter
// @param {number | Quantity} wt - The pipe wall thickness
function Pipe(od, wt) {
this.od = new quantity_1.Quantity(od);
this.wt = new quantity_1.Quantity(wt);
// Calculate the rest of the properties
this.id = this.od.sub(this.wt.mul(2));
this.icsa = this.id.mul(this.id).mul(Math.PI / 4);
this.ecsa = this.od.mul(this.od).mul(Math.PI / 4);
}
Pipe.prototype.raw = function (unit) {
var units = unit || this.od.units();
return {
"id": this.id.to(units).scalar.toNumber(),
"od": this.od.to(units).scalar.toNumber(),
"wt": this.wt.to(units).scalar.toNumber(),
"icsa": this.icsa.to(units + "^2").scalar.toNumber(),
"ecsa": this.ecsa.to(units + "^2").scalar.toNumber()
};
};
return Pipe;
}());
exports.Pipe = Pipe;