Working with different units
The default units system in XLThermo is the International System of Units (SI). However, you may want to use metric units (roughly the same as SI units, but with some differences) or imperial units (common in the United States and some other countries). Please refer to the documentation for an overview of the units for the different quantities available in XLThermo.
In this tutorial, you will learn how to input and output units when doing flash calculations in XLThermo.
Changing the input and output units of flash calculations
In the Basic Usage tutorial, you can compute a multitude of thermodynamic properties for a given state. However, the default units for the input and output of these calculations are SI units. In the flash calculation functions, there are two optional parameters, called in-units
and out-units
, that allow you to control the units of the input and output.
The
in-units
andout-units
parameters are text strings representing the unit system to use. these can be "SI" (the default), "METRIC", or "IMPERIAL".To compute the enthalpy for water at 1 bar and 25 °C, enter the following into a worksheet cell in Excel:
=XLT.REF.FLASH.PT("WATER", 1, 25, "H", "METRIC")The output will be the enthalpy of water at the specified conditions. In this case 104.9 kJ/kg.
If you want to control both the input and output units, you need to specify both the
in-units
andout-units
parameters. To compute the enthalpy for water at 1 bar and 25 °C and get the result in imperial units (Btu/lb), enter the following into a worksheet cell in Excel:=XLT.REF.FLASH.PT("WATER", 1, 25, "H", "METRIC"; "IMPERIAL")The output will be the enthalpy of water at the specified conditions. In this case 45.1 Btu/lb.
Unit conversion outside flash calculations
While selecting input and output units for flash calculations, it may also be necessary to arbitrarily convert values computed in one unit system to another. This can be done using the XLT.CONVERT
utility function.
The function signature for the XLT.CONVERT
function is as follows:
Property
is text string representing the property to be converted, e.g. "ENTHALPY" or simply "H". A full list of the available properties can be found here.Value
is a number representing the value to be converted.in-units
andout-units
are text strings representing the unit system to use. These can be "SI", "METRIC", or "IMPERIAL".To convert the enthalpy of water at 1 bar and 25 °C from imperial units to metric units, enter the following into a worksheet cell in Excel:
=XLT.CONVERT("H", 45.1, "IMPERIAL", "METRIC")The output will be the enthalpy of water at the specified conditions. In this case 104.9 kJ/kg.
Determine property units
Occasionally, it may also be useful to determine the units of a property at a given unit system programmatically, i.e. without looking up the units manually. This can be done using the XLT.UNITS
utility function.
The function signature for the XLT.UNITS
function is as follows:
Property
is text string representing the property to be converted, e.g. "ENTHALPY" or simply "H". A full list of the available properties can be found here.Units
is a text strings representing the unit system to use. This can be "SI", "METRIC", or "IMPERIAL".To determine the unit for enthalpy in imperial units, enter the following into a worksheet cell in Excel
=XLT.Units("H", "IMPERIAL")In this case the output will be "Btu/lb".
What you've learned
In this tutorial, you have learned how to work with different units in XLThermo:
How to change the input and output units of flash calculations.
How to convert units outside flash calculations.
How to determine property units.