Courses: Introduction to GoldSim:
Unit 5 - Understanding and Working with Elements
Lesson 4 - Understanding Dimensions and Units
One of the most powerful features of GoldSim is that it is dimensionally-aware. You take advantage of this capability by assigning display units (and hence dimensions) to the elements (and hence to the inputs and outputs) of your model. GoldSim has an extensive internal database of units and conversion factors. You can enter data and display results in any units. You can even create your own units.
When you enter inputs and create links between elements GoldSim ensures dimensional consistency and carries out all unit conversions internally. For example, you could add feet and meters in an Expression, and GoldSim would internally carry out the conversion. (If you tried to add feet and seconds, however, GoldSim would issue a warning message and prevent you from doing so.)
In order to explore this capability in this Lesson, open (or create) a Data element in GoldSim right now. Make sure it is defined as a Value (rather than a Condition).
You assign dimensions by entering the Display Units for an element. The Display Units determine both the dimensions of the output(s) for the element, and the units in which the output(s) will be displayed (in tool-tips and result tables and charts). For example, by entering meters (abbreviated as m) for the Display Units in a Data element, you have specified two things: 1) the output has dimensions of Length; and 2) when the output is displayed (e.g., in a tool tip), it should be displayed as meters.
Note: As we saw in the previous Unit, several elements (such as the Pool) actually require you to specify two sets of (consistent) Display Units.
When specifying the Display Units, you must enter a valid unit (or unit string) made up of unit abbreviations. For most units, the abbreviations are obvious (e.g., SI units use the standard SI abbreviations).
Note: Because SI unit abbreviations are case-sensitive, the unit abbreviations used in GoldSim are case-sensitive. “Ml” (megaliters) is a very different unit than “ml” (milliliters)!
Once you start using GoldSim, you will quickly learn the common unit abbreviations. However, as a beginner, you can use the context menu in the Display Units field (or any input field) to find and insert abbreviations. For example, if you right-click within the Display Units field for an element, a context menu will be displayed. If you select Units from this menu, a list of all of the unit categories (e.g., Length, Mass, Force) will be displayed. Selecting one of these provides a list of all the units in that category:
Clicking on one of these inserts that abbreviation into the Display Units field.
Note that some units have multiple abbreviations that can be used. For example, feet can be abbreviated as either ft or '.
Note also that for a particular category, you will not necessarily find all the unit combinations that can be used for that particular set of dimensions. With a few exceptions, you will only find the fundamental units for that category. For example, if you examine the units in the Area category, you would only see these:
This is a listing of the units that fundamentally have a dimension of Length^2. However, you can construct other Area units from fundamental units of Length. For example, if you wanted the Display Units to be square meters, you would just enter m2 (or m^2).
This is referred to as a unit string, since you can string together multiple units and operators to build other units. For example, you could construct a unit of volumetric flow (in terms of cubic meters per second) by combining the abbreviation for m and the abbreviation for sec like this: m3/sec.
When entering unit strings, the following rules should be followed:
- Units can only be separated by a "-" or a "/". No other operators or blank spaces are allowed. For example, meters per second would be entered as "m/sec". Grams per meter per second would be entered as "g/m-sec" or as "g/m/sec"; “g/m sec” would be invalid.
- For clarity, you can use parentheses in unit strings. For example, "kg/(m-sec)" is a valid string.
- Only the first "/" in the string (or the first "/" within a set of parentheses) is recognized, and the rest are ignored. Everything after the slash is assumed to be in the denominator. For example, "1/m/m" and "1/m-m" would both be interpreted as inverse square meters.
- Units are raised to a power by either following the unit with a number or with "^". For example, square meters could be entered as "m2" or "m^2". Inverse seconds could be entered as "sec-1", "sec^-1" or "1/sec". When units are raised to a power, the power must be an integer.
Let’s walk through a simple example together. We are going to define two Data elements that represent a velocity (using different units), and then add them together (and display the result using third unit).
First, let’s create a Data element named Velocity1 and define it like this (display units of m/sec):
Note: When entering numbers in GoldSim, you cannot use punctuation (e.g., commas) after every third digit. For example, the correct way to enter the number one hundred million is as “100000000”, or more easily as “1E8”. “100,000,000” would be incorrect and could not be interpreted by GoldSim (GoldSim would display an error message).
Next, create a Data element named Velocity2 and define it like this (display units of ft/sec):
Note in this second case that the Display Units are different than the units used in the Data Definition field. Although you won’t typically do this, sometimes it is useful. The point is that you can enter the value using any units you choose (as long as it has the same dimensions as the Display Units). (Don’t confuse dimensions with units: “length/time” is a dimension; “ft/sec” is a unit.) The Display Units define the dimensions and subsequently determine how any value that is entered is displayed. For example if you place your cursor in the Data Definition filed for Velocity2 you will see that the value, although it was defined using units of m/min, is displayed in units of ft/sec:
This is quite powerful because it allows you to enter data in the units in which it was provided, and then let GoldSim convert it to whatever units you prefer to view it in.
Finally, create an Expression (you will find it under the “Functions” category in the Insert Element dialog) named Velocity3, and define it like this (display units of km/hr):
The model should now look something like this:
Several things should be noted here:
- When you typed the expression “Velocity1 + Velocity2” into the Expression element, GoldSim automatically drew arrows (referred to an influences) from Velocity1 and Velocity2 to Velocity3, graphically indicating that Velocity3 is a function of these other two elements. We will discuss influences in a bit more detail at the end of this Unit.
- Hold the cursor over the Expression. It will display the result in a tool-tip:
- Now change display units of Velocity3 (make it dimensionless by leaving the Display Units field blank). If you then place your cursor in the Equation field, you will see this error:
GoldSim notes that the dimensions of the expression entered is length/time, but the Display Units indicate that it should be dimensionless.
- Change the display units of Velocity3 back to km/hr and the error should go away.
Note: Save this little example problem (name it Velocities.gsm) to the “MyModels” subfolder in the “GoldSim Course” folder, as we will revisit it briefly in the next Lesson.
If you are interested, you can view the entire database of units in GoldSim by selecting Model|Units… from the main menu. The GoldSim Units Manager dialog will be displayed:
Although you typically would not be required to do so, you can use the GoldSim Units Manager to define your own custom units.
We’ve covered most of what you need to know about dimensions and units in GoldSim, but there are some important advanced topics that we did not discuss (e.g., dealing with temperature units, using “unit casting” to represent dimensionally inconsistent empirical equations). You can read about these topics (and more) in GoldSim Help.