One of the most frequently asked questions in the process industry is whether a given stream is measured by volume or weight. With AIMMS, this can be easily determined by examining the unit of measurement (UoM) assigned to the stream. In AIMMS, UoMs are managed as data and stored in what are known as unit parameters.
For example, consider three streams: a, b, and c. The units for these streams can be specified in AIMMS as follows:
data { a : [kg], b : [ton], c : [m3] }
To determine if a stream is a weight, you need to check if its UoM is commensurate with the base unit of weight. Assuming we have a function fnc_isCommensurate(up_a, up_b), you can use the following expression:
fnc_isCommensurate(up_strUnit(i_stream), up_baseUnitWeight)
This will indicate for each stream whether it is measured by weight.
Using the AIMMS intrinsic function AtomicUnit, the fnc_isCommensurate function can be implemented as:
fnc_isCommensurate := AtomicUnit(up_a) = AtomicUnit(up_b);