Unit Sets#

All property packages within IDAES are expected to define a metadata class as part of the package’s ParameterBlock, which among other things contains a definition of the base units of measurement used by that property package. The definition of units of measurement is held wihin a UnitSet object that defines a number of common quantities of interest in process applications.

An example of defining the default units for a property package is shown below.

from pyomo.environ import units

@classmethod
def define_metadata(cls, obj):
    obj.add_default_units({'time': units.s,
                           'length': units.m,
                           'mass': units.kg,
                           'amount': units.mol,
                           'temperature': units.K})

Each property package can define a default units for 7 base quantities listed below along with the default units assumed if not provided by the property package developer.

  • time (seconds)

  • length (meters)

  • mass (kilograms)

  • amount of substance (mole)

  • temperature (Kelvin)

  • current (Ampere)

  • luminous intensity (candela)

Units must be defined using Pyomo’s Units container (from pyomo.environ import units).

Units of measurement are stored in a UnitSet object that uses these base units to derive the units of all other quantities that will be used in the property model and any unit operation that uses that property package. In order to avoid the need for unit conversion in all expressions, the IDAES Framework assumes that all quantities within the property package are based on the chosen set of base units. Parameters and correlations may be based on different sets of unit as necessary (e.g., from literature sources using different base units), however the final quantity must be converted to the set of base units defined in the metadata.

Retrieving Units of Measurement#

Modelers may retrieve the units of measurement for any defined quantity by looking these up in the UnitSet associated with the property package. The UnitSet may be accessed using the following code:

unit_set = property_package.get_metadata().default_units

Modelers can then retrieve the units for a given quantity by looking up the quantity on the UnitSet as shown below (using time as an example):

time_units = unit_set.TIME

Note

For backwards-compatibility, units can also be retrieved using dict-like notation, i.e., units_set[“time”]. However, this feature may be deprecated in the future, thus modelers are encouraged to use the attribute-based approach to access units.

A full list of defined quantities is shown below.

UnitSet Class#

class idaes.core.base.property_meta.UnitSet[source]#

Object defining the set of recognised quantities in IDAES and their base units.

Units of measurement are defined by setting units for the seven base SI quantities (amount, current, length, luminous intensity, mass, temperature and time), from which units for all other quantities are derived. The units of the seven base quantities must be provided when instantiating the UnitSet, otherwise base SI units are assumed.

Units can be accesses by via either a property on the UnitSet (e.g., UnitSet.TIME) or via an index on the UnitSet (e.g., UnitSet[“time”]).

property ACCELERATION#
property AMOUNT#
property AREA#
property CURRENT#
property DENSITY_MASS#
property DENSITY_MOLE#
property DIFFUSIVITY#
property DYNAMIC_VISCOSITY#
property ENERGY#
property ENERGY_MASS#
property ENERGY_MOLE#
property ENTROPY#
property ENTROPY_MASS#
property ENTROPY_MOLE#
property FLOW_MASS#
property FLOW_MOLE#
property FLOW_VOL#
property FLUX_ENERGY#
property FLUX_MASS#
property FLUX_MOLE#
property FORCE#
property GAS_CONSTANT#
property HEAT_CAPACITY_MASS#
property HEAT_CAPACITY_MOLE#
property HEAT_TRANSFER_COEFFICIENT#
property KINEMATIC_VISCOSITY#
property LENGTH#
property LUMINOUS_INTENSITY#
property MASS#
property MOLALITY#
property MOLAR_VOLUME#
property MOLECULAR_WEIGHT#
property POWER#
property PRESSURE#
property SURFACE_TENSION#
property TEMPERATURE#
property THERMAL_CONDUCTIVITY#
property TIME#
property VELOCITY#
property VOLTAGE#
property VOLUME#
property VOLUME_MASS#
property VOLUME_MOLE#
set_units(amount=<pyomo.core.base.units_container._PyomoUnit object>, current=<pyomo.core.base.units_container._PyomoUnit object>, length=<pyomo.core.base.units_container._PyomoUnit object>, luminous_intensity=<pyomo.core.base.units_container._PyomoUnit object>, mass=<pyomo.core.base.units_container._PyomoUnit object>, temperature=<pyomo.core.base.units_container._PyomoUnit object>, time=<pyomo.core.base.units_container._PyomoUnit object>)[source]#

Set desired units of measurement for the seven base quantities.

Parameters:
  • amount (_PyomoUnit) – units for amount (default = moles)

  • current (_PyomoUnit) – units for current (default = Amperes)

  • length (_PyomoUnit) – units for length (default = meters)

  • luminous_intensity (_PyomoUnit) – units for luminous intensity (default = candela)

  • mass (_PyomoUnit) – units for mass (default = kilograms)

  • temperature (_PyomoUnit) – units for temperature (default = Kelvins)

  • time (_PyomoUnit) – units for time (default = seconds)

Returns:

None

unitset_is_consistent(other)[source]#

Checks that defined units of measurement for base quantities are consistent with those in other UnitSet.

Parameters:

other (UnitSet) – UnitSet to check for consistency with

Returns:

Bool indicating whether units are consistent