Class: SpecificVolume

PD.Units. SpecificVolume

Provides tools to convert between specific volume units.

Use static methods for arbitrary conversions and instance methods when converting to and/or from a specific unit multiple times. The available specific volume unit types are: PD.Units.CUBIC_METERS_PER_KILOGRAM and PD.Units.CUBIC_FEET_PER_POUND.


new SpecificVolume( [units])

Creates a new specific volume converter.

Parameters:
Name Type Argument Description
units number <optional>

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

Members


:number

units

The numeric identifier defining the type of stored units.

The value of this property should equate to PD.Units.CUBIC_METERS_PER_KILOGRAM and PD.Units.CUBIC_FEET_PER_POUND. Any other value is assumed to be cubic meters per kilogram.

Type
  • number

Methods


fromCubicFeetPerPound(ft3_lb)

Converts from cubic feet per pound to the current units.

Parameters:
Name Type Description
ft3_lb number

The value to convert in cubic feet per pound (ft3/lb).

Returns:

Returns the value converted to the current units.

Type
number

fromCubicMetersPerKilogram(m3_kg)

Converts from cubic meters per kilogram to the current units.

Parameters:
Name Type Description
m3_kg number

The value to convert in cubic meters per kilogram (m3/kg).

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: 'm3/kg' or 'ft3/lb'.

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: 'Cubic Meters per Kilogram' or 'Cubic Feet per Pound'.

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 specific volume unit and updates conversions.

Parameters:
Name Type Description
units number

The new units identifier (PD.Units.CUBIC_METERS_PER_KILOGRAM | CUBIC_FEET_PER_POUND).

Returns:

Returns this SpecificVolume object to support method chaining.

Type
object

toCubicFeetPerPound(value)

Converts the given value to cubic feet per pound.

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to cubic feet per pound (ft3/lb).

Type
number

toCubicMetersPerKilogram(value)

Converts the given value to cubic meters per kilogram.

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to cubic meters per kilogram (m3/kg).

Type
number

convertCubicFeetPerPoundToCubicMetersPerKilogram(ft3_lb) <static>

Converts a value in cubic feet per pound (ft3/lb) to cubic meters per kilogram (m3/kg).

Parameters:
Name Type Description
ft3_lb number

The value to convert, in cubic feet per pound (ft3/lb).

Returns:

Returns the value converted to cubic meters per kilogram (m3/kg)

Type
number

convertCubicMetersPerKilogramToCubicFeetPerPound(m3_kg) <static>

Converts a value in cubic meters per kilogram (m3/kg) to cubic feet per pound (ft3/lb).

Parameters:
Name Type Description
m3_kg number

The value to convert, in cubic meters per kilogram (m3/kg)

Returns:

Returns the value converted to cubic feet per pound (ft3/lb).

Type
number

getAbbrev(units) <static>

Retrieves the abbreviation of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'm3/kg' or 'ft3/lb'.

Parameters:
Name Type Description
units number

The numeric units identifier (PD.Units.CUBIC_METERS_PER_KILOGRAM | CUBIC_FEET_PER_POUND).

Returns:

Returns the abbreviation of the given specific volume units.

Type
string

getName(units) <static>

Retrieves the name of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'Cubic Meters per Kilogram' or 'Cubic Feet per Pound'.

Parameters:
Name Type Description
units number

The numeric units identifier (PD.Units.CUBIC_METERS_PER_KILOGRAM | CUBIC_FEET_PER_POUND).

Returns:

Returns the name of the given specific volume units.

Type
string

getUnitsFromAbbrev(abbrev) <static>

Retrieves the specific volume units identifier from the given abbreviation.

Interprets the abbreviations 'm3/kg' or 'ft3/lb' into the identifiers PD.Units.CUBIC_METERS_PER_KILOGRAM | CUBIC_FEET_PER_POUND.

Parameters:
Name Type Description
abbrev string

The abbreviation of the given specific volume units.

Returns:

Returns the The numeric units identifier.

Type
number