# CONSTANT

The **CONSTANT** statement is used to declare constant-value 'variable' types that may be used as parameters for reusable parametric MODEL types.

Real constants which do not have a default value are usually needed only in libraries of reusable models, such as components.a4l, where the values depend on the end-user’s selection from alternatives in a database. The standard incantation to define a new real constant type is:

CONSTANT critical_pressure_constant REFINES real_constant DIMENSION M/L/T^2;

It is wasteful to define a CONSTANT type and a compiled object to represent a universal constant. For example, the thermodynamic gas constant, R = 8.314... {J/mole/K}, is frequently needed in modeling chemical systems. The SI value of R does not vary with its application. Neither does the value of . Numeric constants of this sort are better represented as a numeric coefficient and an appropriately defined unit conversion, using the UNITS statement.

Consider the ideal gas law, PV = NRT and the ASCEND unit conversion {GAS_C} which appears in the library ascend4/models/measures.a4l. This equation should be written:

P * V = n * 1.0{GAS_C} * T;

Similarly, area should be written

area = 1{PI} * r^2;

The coefficient `1` of `{GAS_C}` and `{PI}` in these equations takes of the dimensionality of and is multiplied
by the conversion factor implied by the UNITS definition for the part within the braces `{}`. If we check models/measures.a4l, we
find the definition of PI is simply {3.14159...} and the definition of GAS_C is {8.314... J/mole/K} as we ought to expect.

For historical reasons there are a few universal constant definitions in models/atoms.a4l. New modelers should not use them; they are only provided to support outdated models that no one has yet taken the time to update.