Unit Casting
In some cases, you may need to turn a dimensioned value into a dimensionless value in order to use it in an expression. This is necessary, for example, if you need to use an empirical equation (which by definition may be dimensionally inconsistent), or if you need to raise a value to a power, where the power itself has dimensions An output attribute for an element that defines the dimensionality (in terms of Length, Time and other fundamental dimensions) of the output., such as X**Time.
GoldSim allows you to do this by “casting” a dimensioned value or expression to a dimensionless value. For example, the expression
A |ft|
would evaluate A (which, in this case, must have dimensions of length), convert it to a value in feet, and cast it (output it) as a dimensionless value. That is, | | removes dimensions from a preceding dimensioned value and produces a dimensionless value.
The following are all valid expressions using unit casting:
A |m3| + 5 | OK if and only if A has dimensions of volume |
(A*B) |ft| | OK if and only if (A*B) has dimensions of length |
Ctime |yr| | OK if and only if Ctime has dimensions of time |
A simple example file illustrating casting units (Units.gsm) can be found in the General Examples folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).
- Automatically Appending Units
- Creating New Units for Items (Such as Widgets)
- Creating New Units
- Dealing with Currency Units
- Dealing with Temperature Units
- Display Units for Dates
- Managing User-Defined Units
- The GoldSim Units Manager
- Understanding Units for Month and Year
- Unit Casting
- Using Dimensions and Units
- Using the Percentage Unit Symbol
- Using Units in Element Input Fields
- Viewing and Creating Units