Class: Pressure

PD.Units. Pressure

Provides tools to convert between different pressure units.

Use static methods for arbitrary conversions and instance methods when converting to and/or from a specific unit multiple times. The available pressure unit types are: PD.Units.PASCAL, PD.Units.KILOPASCAL, PD.Units.MILLIMETERS_MERCURY, PD.Units.INCHES_MERCURY, PD.Units.POUNDS_PER_SQUARE_INCH, PD.Units.ATMOSPHERES and PD.Units.BAR.


new Pressure( [units])

Creates a new pressure converter.

Parameters:
Name Type Argument Description
units number <optional>

The units type identifier, defaults to PD.Units.PASCAL.

Members


:number

units

The numeric identifier defining the type of stored units.

The value of this property should equate to PD.Units.PASCAL, PD.Units.KILOPASCAL, PD.Units.MILLIMETERS_MERCURY, PD.Units.INCHES_MERCURY, PD.Units.POUNDS_PER_SQUARE_INCH, PD.Units.ATMOSPHERES and PD.Units.BAR. Any other value is assumed to be Pascal.

Type
  • number

Methods


fromAtmospheres(pa)

Converts from Atmospheres (atm) to the current units.

Parameters:
Name Type Description
pa number

The value to convert in Atmospheres (atm).

Returns:

Returns the value converted to the current units.

Type
number

fromBar(pa)

Converts from Bar (bar) to the current units.

Parameters:
Name Type Description
pa number

The value to convert in Bar (bar).

Returns:

Returns the value converted to the current units.

Type
number

fromInchesMercury(pa)

Converts from inches of mercury (inHg) to the current units.

Parameters:
Name Type Description
pa number

The value to convert in inches of mercury (inHg).

Returns:

Returns the value converted to the current units.

Type
number

fromKiloPascal(kpa)

Converts from kilo-Pascal (kPa) to the current units.

Parameters:
Name Type Description
kpa number

The value to convert in kilo-Pascal (kPa).

Returns:

Returns the value converted to the current units.

Type
number

fromMillimetersMercury(pa)

Converts from millimeters of mercury (mmHg) to the current units.

Parameters:
Name Type Description
pa number

The value to convert in millimeters of mercury (mmHg).

Returns:

Returns the value converted to the current units.

Type
number

fromPascal(pa)

Converts from Pascal (Pa) to the current units.

Parameters:
Name Type Description
pa number

The value to convert in Pascal (Pa).

Returns:

Returns the value converted to the current units.

Type
number

fromPoundsPerSquareInch(pa)

Converts from pounds per square inch (Psi) to the current units.

Parameters:
Name Type Description
pa number

The value to convert in pounds per square inch (Psi).

Returns:

Returns the value converted to the current units.

Type
number

getAbbrev()

Retrieve the abbreviation of the stored units.

Depending on the current units, this method returns one of the following string values: 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm' or 'bar'.

Returns:

Returns the abbreviation of the current units.

Type
string

getName()

Retrieve the full name of the stored units.

Depending on the current units, this method returns one of the following string values: 'Pascal', 'kilo-Pascal', 'Millimeters Mercury', 'Inches Mercury', 'Pounds Force Per Square Inch', 'Atmospheres' or 'Bar'.

Returns:

Returns the full name of the current units.

Type
string

getUnitsId()

Retrieves the currently units identifier as a numeric value.

Returns:

Returns the current units identifier.

Type
number

set(units)

Sets the current pressure unit and updates conversions.

Parameters:
Name Type Description
units number

The new units identifier (PD.Units.PASCAL | KILOPASCAL | MILLIMETERS_MERCURY | INCHES_MERCURY | POUNDS_PER_SQUARE_INCH | ATMOSPHERES | BAR).

Returns:

Returns this Pressure object to support method chaining.

Type
object

toAtmospheres(value)

Converts the given value to Atmospheres (atm).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

toBar(value)

Converts the given value to Bar (bar).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to Bar (bar).

Type
number

toInchesMercury(value)

Converts the given value to inches of mercury (inHg).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

toKiloPascal(value)

Converts the given value to kilo-Pascal (kPa).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

toMillimetersMercury(value)

Converts the given value to millimeters of mercury (mmHg).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

toPascal(value)

Converts the given value to Pascal (Pa).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to Pascal (Pa).

Type
number

toPoundsPerSquareInch(value)

Converts the given value to pounds per square inch (Psi).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertAtmospheresToBar(atm) <static>

Converts a value in Atmospheres (atm) to Bar (bar).

Parameters:
Name Type Description
atm number

The value to convert, in Atmospheres (atm).

Returns:

Returns the value converted to Bar (bar).

Type
number

convertAtmospheresToInchesMercury(atm) <static>

Converts a value in Atmospheres (atm) to inches of mercury (inHg).

Parameters:
Name Type Description
atm number

The value to convert, in Atmospheres (atm).

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

convertAtmospheresToKiloPascal(atm) <static>

Converts a value in Atmospheres (atm) to kilo-Pascal (kPa).

Parameters:
Name Type Description
atm number

The value to convert, in Atmospheres (atm).

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

convertAtmospheresToMillimetersMercury(atm) <static>

Converts a value in Atmospheres (atm) to millimeters of mercury (mmHg).

Parameters:
Name Type Description
atm number

The value to convert, in Atmospheres (atm).

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

convertAtmospheresToPascal(atm) <static>

Converts a value in Atmospheres (atm) to Pascal (Pa).

Parameters:
Name Type Description
atm number

The value to convert, in Atmospheres (atm).

Returns:

Returns the value converted to Pascal (Pa).

Type
number

convertAtmospheresToPoundsPerSquareInch(atm) <static>

Converts a value in Atmospheres (atm) to pounds per square inch (Psi).

Parameters:
Name Type Description
atm number

The value to convert, in Atmospheres (atm).

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertBarToAtmospheres(bar) <static>

Converts a value in Bar (bar) to Atmospheres (atm).

Parameters:
Name Type Description
bar number

The value to convert, in Bar (bar).

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

convertBarToInchesMercury(bar) <static>

Converts a value in Bar (bar) to inches of mercury (inHg).

Parameters:
Name Type Description
bar number

The value to convert, in Bar (bar).

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

convertBarToKiloPascal(bar) <static>

Converts a value in Bar (bar) to kilo-Pascal (kPa).

Parameters:
Name Type Description
bar number

The value to convert, in Bar (bar).

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

convertBarToMillimetersMercury(bar) <static>

Converts a value in Bar (bar) to millimeters of mercury (mmHg).

Parameters:
Name Type Description
bar number

The value to convert, in Bar (bar).

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

convertBarToPascal(bar) <static>

Converts a value in Bar (bar) to Pascal (Pa).

Parameters:
Name Type Description
bar number

The value to convert, in Bar (bar).

Returns:

Returns the value converted to Pascal (Pa).

Type
number

convertBarToPoundsPerSquareInch(bar) <static>

Converts a value in Bar (bar) to pounds per square inch (Psi).

Parameters:
Name Type Description
bar number

The value to convert, in Bar (bar).

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertInchesMercuryToAtmospheres(inhg) <static>

Converts a value in inches of mercury (inHg) to Atmospheres (atm).

Parameters:
Name Type Description
inhg number

The value to convert, in inches of mercury (inHg).

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

convertInchesMercuryToBar(inhg) <static>

Converts a value in inches of mercury (inHg) to Bar (bar).

Parameters:
Name Type Description
inhg number

The value to convert, in inches of mercury (inHg).

Returns:

Returns the value converted to Bar (bar).

Type
number

convertInchesMercuryToKiloPascal(inhg) <static>

Converts a value in inches of mercury (inHg) to kilo-Pascal (kPa).

Parameters:
Name Type Description
inhg number

The value to convert, in inches of mercury (inHg).

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

convertInchesMercuryToMillimetersMercury(inhg) <static>

Converts a value in inches of mercury (inHg) to millimeters of mercury (mmHg).

Parameters:
Name Type Description
inhg number

The value to convert, in inches of mercury (inHg).

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

convertInchesMercuryToPascal(inhg) <static>

Converts a value in inches of mercury (inHg) to Pascal (Pa).

Parameters:
Name Type Description
inhg number

The value to convert, in inches of mercury (inHg).

Returns:

Returns the value converted to Pascal (Pa).

Type
number

convertInchesMercuryToPoundsPerSquareInch(inhg) <static>

Converts a value in inches of mercury (inHg) to pounds per square inch (Psi).

Parameters:
Name Type Description
inhg number

The value to convert, in inches of mercury (inHg).

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertKiloPascalToAtmospheres(kpa) <static>

Converts a value in kilo-Pascal (kPa) to Atmospheres (atm).

Parameters:
Name Type Description
kpa number

The value to convert, in kilo-Pascal (kPa).

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

convertKiloPascalToBar(kpa) <static>

Converts a value in kilo-Pascal (kPa) to Bar (bar).

Parameters:
Name Type Description
kpa number

The value to convert, in kilo-Pascal (kPa).

Returns:

Returns the value converted to Bar (bar).

Type
number

convertKiloPascalToInchesMercury(kpa) <static>

Converts a value in kilo-Pascal (kPa) to inches of mercury (inHg).

Parameters:
Name Type Description
kpa number

The value to convert, in kilo-Pascal (kPa).

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

convertKiloPascalToMillimetersMercury(kpa) <static>

Converts a value in kilo-Pascal (kPa) to millimeters of mercury (mmHg).

Parameters:
Name Type Description
kpa number

The value to convert, in kilo-Pascal (kPa).

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

convertKiloPascalToPascal(kpa) <static>

Converts a value in kilo-Pascal (kPa) to Pascal (Pa).

Parameters:
Name Type Description
kpa number

The value to convert, in kilo-Pascal (kPa).

Returns:

Returns the value converted to Pascal (Pa).

Type
number

convertKiloPascalToPoundsPerSquareInch(kpa) <static>

Converts a value in kilo-Pascal (kPa) to pounds per square inch (Psi).

Parameters:
Name Type Description
kpa number

The value to convert, in kilo-Pascal (kPa).

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertMillimetersMercuryToAtmospheres(mmhg) <static>

Converts a value in millimeters of mercury (mmHg) to Atmospheres (atm).

Parameters:
Name Type Description
mmhg number

The value to convert, in millimeters of mercury (mmHg).

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

convertMillimetersMercuryToBar(mmhg) <static>

Converts a value in millimeters of mercury (mmHg) to Bar (bar).

Parameters:
Name Type Description
mmhg number

The value to convert, in millimeters of mercury (mmHg).

Returns:

Returns the value converted to Bar (bar).

Type
number

convertMillimetersMercuryToInchesMercury(mmhg) <static>

Converts a value in millimeters of mercury (mmHg) to inches of mercury (inHg).

Parameters:
Name Type Description
mmhg number

The value to convert, in millimeters of mercury (mmHg).

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

convertMillimetersMercuryToKiloPascal(mmhg) <static>

Converts a value in millimeters of mercury (mmHg) to kilo-Pascal (kPa).

Parameters:
Name Type Description
mmhg number

The value to convert, in millimeters of mercury (mmHg).

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

convertMillimetersMercuryToPascal(mmhg) <static>

Converts a value in millimeters of mercury (mmHg) to Pascal (Pa).

Parameters:
Name Type Description
mmhg number

The value to convert, in millimeters of mercury (mmHg).

Returns:

Returns the value converted to Pascal (Pa).

Type
number

convertMillimetersMercuryToPoundsPerSquareInch(mmhg) <static>

Converts a value in millimeters of mercury (mmHg) to pounds per square inch (Psi).

Parameters:
Name Type Description
mmhg number

The value to convert, in millimeters of mercury (mmHg).

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertPascalToAtmospheres(pa) <static>

Converts a value in Pascal (Pa) to Atmospheres (atm).

Parameters:
Name Type Description
pa number

The value to convert, in Pascal (Pa).

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

convertPascalToBar(pa) <static>

Converts a value in Pascal (Pa) to Bar (bar).

Parameters:
Name Type Description
pa number

The value to convert, in Pascal (Pa).

Returns:

Returns the value converted to Bar (bar).

Type
number

convertPascalToInchesMercury(pa) <static>

Converts a value in Pascal (Pa) to inches of mercury (inHg).

Parameters:
Name Type Description
pa number

The value to convert, in Pascal (Pa).

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

convertPascalToKiloPascal(pa) <static>

Converts a value in Pascal (Pa) to kilo-Pascal (kPa).

Parameters:
Name Type Description
pa number

The value to convert, in Pascal (Pa).

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

convertPascalToMillimetersMercury(pa) <static>

Converts a value in Pascal (Pa) to millimeters of mercury (mmHg).

Parameters:
Name Type Description
pa number

The value to convert, in Pascal (Pa).

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

convertPascalToPoundsPerSquareInch(pa) <static>

Converts a value in Pascal (Pa) to pounds per square inch (Psi).

Parameters:
Name Type Description
pa number

The value to convert, in Pascal (Pa).

Returns:

Returns the value converted to pounds per square inch (Psi).

Type
number

convertPoundsPerSquareInchToAtmospheres(psi) <static>

Converts a value in pounds per square inch (Psi) to Atmospheres (atm).

Parameters:
Name Type Description
psi number

The value to convert, in pounds per square inch (Psi).

Returns:

Returns the value converted to Atmospheres (atm).

Type
number

convertPoundsPerSquareInchToBar(psi) <static>

Converts a value in pounds per square inch (Psi) to Bar (bar).

Parameters:
Name Type Description
psi number

The value to convert, in pounds per square inch (Psi).

Returns:

Returns the value converted to Bar (bar).

Type
number

convertPoundsPerSquareInchToInchesMercury(psi) <static>

Converts a value in pounds per square inch (Psi) to inches of mercury (inHg).

Parameters:
Name Type Description
psi number

The value to convert, in pounds per square inch (Psi).

Returns:

Returns the value converted to inches of mercury (inHg).

Type
number

convertPoundsPerSquareInchToKiloPascal(psi) <static>

Converts a value in pounds per square inch (Psi) to kilo-Pascal (kPa).

Parameters:
Name Type Description
psi number

The value to convert, in pounds per square inch (Psi).

Returns:

Returns the value converted to kilo-Pascal (kPa).

Type
number

convertPoundsPerSquareInchToMillimetersMercury(psi) <static>

Converts a value in pounds per square inch (Psi) to millimeters of mercury (mmHg).

Parameters:
Name Type Description
psi number

The value to convert, in pounds per square inch (Psi).

Returns:

Returns the value converted to millimeters of mercury (mmHg).

Type
number

convertPoundsPerSquareInchToPascal(psi) <static>

Converts a value in pounds per square inch (Psi) to Pascal (Pa).

Parameters:
Name Type Description
psi number

The value to convert, in pounds per square inch (Psi).

Returns:

Returns the value converted to Pascal (Pa).

Type
number

getAbbrev(units) <static>

Retrieves the abbreviation of the given pressure units.

Based on the given units, this method returns one of the following string values: 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm' or 'bar'.

Parameters:
Name Type Description
units number

The numeric units identifier (PD.Units.PASCAL | KILOPASCAL | MILLIMETERS_MERCURY | INCHES_MERCURY | POUNDS_PER_SQUARE_INCH | ATMOSPHERES | BAR).

Returns:

Returns the abbreviation of the given pressure units.

Type
string

getName(units) <static>

Retrieves the name of the given pressure units.

Based on the given units, this method returns one of the following string values: 'Pascal', 'kilo-Pascal', 'Millimeters Mercury', 'Inches Mercury', 'Pounds Force Per Square Inch', 'Atmospheres' or 'Bar'.

Parameters:
Name Type Description
units number

The numeric units identifier (PD.Units.PASCAL | KILOPASCAL | MILLIMETERS_MERCURY | INCHES_MERCURY | POUNDS_PER_SQUARE_INCH | ATMOSPHERES | BAR).

Returns:

Returns the name of the given pressure units.

Type
string

getUnitsFromAbbrev(abbrev) <static>

Retrieves the pressure units identifier from the given abbreviation.

Interprets the abbreviations 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm' or 'bar' into the identifiers PD.Units.PASCAL | KILOPASCAL | MILLIMETERS_MERCURY | INCHES_MERCURY | POUNDS_PER_SQUARE_INCH | ATMOSPHERES | BAR.

Parameters:
Name Type Description
abbrev string

The abbreviation of the given pressure units.

Returns:

Returns the The numeric units identifier.

Type
number