Defining Units of Measurement

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. 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 (Watts)

  • 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 which 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(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]

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”]).

Parameters
  • amount (_PyomoUnit) –

  • current (_PyomoUnit) –

  • length (_PyomoUnit) –

  • luminous_intensity (_PyomoUnit) –

  • mass (_PyomoUnit) –

  • temperature (_PyomoUnit) –

  • time (_PyomoUnit) –

property ACCELERATION
property AMOUNT
property AREA
property CURRENT
property DENSITY_MASS
property DENSITY_MOLE
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 GAS_CONSTANT
property HEAT_CAPACITY_MASS
property HEAT_CAPACITY_MOLE
property HEAT_TRANSFER_COEFFICIENT
property LENGTH
property LUMINOUS_INTENSITY
property MASS
property MOLECULAR_WEIGHT
property POWER
property PRESSURE
property TEMPERATURE
property THERMAL_CONDUCTIVITY
property TIME
property VELOCITY
property VOLUME
unitset_is_consistent(other)[source]