Class: Enthalpy

PD.Units. Enthalpy

Provides tools to convert between enthalpy units.

Use static methods for arbitrary conversions and instance methods when converting to and/or from a specific unit multiple times. The available enthalpy unit types are: PD.Units.JOULES_PER_KILOGRAM, PD.Units.KILO_JOULES_PER_KILOGRAM and PD.Units.BTU_PER_POUND.


new Enthalpy( [units])

Creates a new enthalpy converter.

Parameters:
Name Type Argument Description
units number <optional>

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

Members


:number

units

The numeric identifier defining the type of stored units.

The value of this property should equate to PD.Units.JOULES_PER_KILOGRAM, PD.Units.KILO_JOULES_PER_KILOGRAM and PD.Units.BTU_PER_POUND. Any other value is assumed to be Joules per kilogram.

Type
  • number

Methods


fromBtuPerPound(btu_lb)

Converts from Btu per pound to the current units.

Parameters:
Name Type Description
btu_lb number

The value to convert in Btu per pound (Btu/lb).

Returns:

Returns the value converted to the current units.

Type
number

fromJoulesPerKilogram(J_kg)

Converts from Joules per kilogram to the current units.

Parameters:
Name Type Description
J_kg number

The value to convert in Joules per kilogram (J/kg).

Returns:

Returns the value converted to the current units.

Type
number

fromKiloJoulesPerKilogram(kJ_kg)

Converts from kilo-Joules per kilogram to the current units.

Parameters:
Name Type Description
kJ_kg number

The value to convert in kilo-Joules per kilogram (kJ/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: 'J/kg', 'kJ/kg' or 'Btu/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: 'Joules per Kilogram', 'kilo-Joules per Kilogram' or 'Btu 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 enthalpy unit and updates conversions.

Parameters:
Name Type Description
units number

The new units identifier (PD.Units.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND).

Returns:

Returns this Enthalpy object to support method chaining.

Type
object

toBtuPerPound(value)

Converts the given value to Btu per pound (Btu/lb).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to Btu per pound (Btu/lb).

Type
number

toJoulesPerKilogram(value)

Converts the given value to Joules per kilogram (J/kg).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to Joules per kilogram (J/kg).

Type
number

toKiloJoulesPerKilogram(value)

Converts the given value to kilo-Joules per kilogram (kJ/kg).

Parameters:
Name Type Description
value number

The value to convert, must be in stored units.

Returns:

Returns the value converted to kilo-Joules per kilogram (kJ/kg).

Type
number

convertBtuPerPoundToJoulesPerKilogram(btu_lb) <static>

Converts a value in British thermal units per pound (Btu/lb) to Joules per kilogram (J/kg).

Parameters:
Name Type Description
btu_lb number

The value to convert, in British thermal units per pound (Btu/lb).

Returns:

Returns the value converted to Joules per kilogram (J/kg).

Type
number

convertBtuPerPoundToKiloJoulesPerKilogram(btu_lb) <static>

Converts a value in British thermal units per pound (Btu/lb) to kilo-Joules per kilogram (kJ/kg).

Parameters:
Name Type Description
btu_lb number

The value to convert, in British thermal units per pound (Btu/lb).

Returns:

Returns the value converted to kilo-Joules per kilogram (kJ/kg).

Type
number

convertJoulesPerKilogramToBtuPerPound(j_kg) <static>

Converts a value in Joules per kilogram (J/kg) to British thermal units per pound (Btu/lb).

Parameters:
Name Type Description
j_kg number

The value to convert, in Joules per kilogram (J/kg).

Returns:

Returns the value converted to British thermal units per pound (Btu/lb).

Type
number

convertJoulesPerKilogramToKiloJoulesPerKilogram(J_kg) <static>

Converts a value in Joules per kilogram (J/kg) to kilo-Joules per kilogram (kJ/kg).

Parameters:
Name Type Description
J_kg number

The value to convert, in Joules per kilogram (J/kg).

Returns:

Returns the value converted to kilo-Joules per kilogram (kJ/kg).

Type
number

convertKiloJoulesPerKilogramToBtuPerPound(kj_kg) <static>

Converts a value in kilo-Joules per kilogram (kJ/kg) to British thermal units per pound (Btu/lb).

Parameters:
Name Type Description
kj_kg number

The value to convert, in kilo-Joules per kilogram (kJ/kg).

Returns:

Returns the value converted to British thermal units per pound (Btu/lb).

Type
number

convertKiloJoulesPerKilogramToJoulesPerKilogram(kJ_kg) <static>

Converts a value in kilo-Joules per kilogram (kJ/kg) to Joules per kilogram (J/kg).

Parameters:
Name Type Description
kJ_kg number

The value to convert, in kilo-Joules per kilogram (kJ/kg).

Returns:

Returns the value converted to Joules per kilogram (J/kg).

Type
number

getAbbrev(units) <static>

Retrieves the abbreviation of the given enthalpy units.

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

Parameters:
Name Type Description
units number

The numeric units identifier (PD.Units.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND).

Returns:

Returns the abbreviation of the given enthalpy units.

Type
string

getName(units) <static>

Retrieves the name of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'Joules per Kilogram', 'kilo-Joules per Kilogram' or 'Btu per Pound'.

Parameters:
Name Type Description
units number

The numeric units identifier (PD.Units.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND).

Returns:

Returns the name of the given enthalpy units.

Type
string

getUnitsFromAbbrev(abbrev) <static>

Retrieves the enthalpy units identifier from the given abbreviation.

Interprets the abbreviations 'J/kg', 'kJ/kg' or 'Btu/lb' into the identifiers PD.Units.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND.

Parameters:
Name Type Description
abbrev string

The abbreviation of the given enthalpy units.

Returns:

Returns the The numeric units identifier.

Type
number