Working with Units

A great way to clarify conceptualization, disambiguate terminology, and guard against common formulation errors is to specify units of measure for each model variable and check the model for dimensional consistency. Stella makes this very easy to do, and allows you to quickly find and correct any inconsistencies that might arise.

To specify the units of measure for a variable, you enter them into the Units editor at the bottom of the Properties panel.

You can type into the Units editor and you'll be prompted with the names of units already used in the model, as well as defined unit names. Alternatively, you can select the units from the popup menu that opens when you click on the popup indicator at the right. Stella has a number of built in units and the popup menu organizes these into categories, as well as providing access to any units of measure that you've defined or that have already been used in the model. There are also options to check whether the units for the current variable are consistent and to suggest units for the variable based on the equation, as discussed in assigning units.

The units of measure you specify can be names or equations. Unit equations are simpler than variable equations. They can contain names, multiplication operators (* or -), division operators (/), powers (^), and parentheses to control precedence. The names of units must start with a letter or Unicode character beyond the Latin character range, and contain letters, numbers, spaces, $ or %. You can also use both $ and % as a unit of measure. 1 is treated as the identity unit of measure. Because of their simple format, you can use a space or underbar interchangeably when specifying units.

 

The following are valid units of measure:

$/Hours
US$/Months
Months Per Year
1/Seconds
Meters/Second^2
Meters/Second/Second
Meters/(Second-Second)

The last three of these are equivalent.

 

The following are not valid units of measure:

$US/Day - $ can't be followed by anything
Feet/(Second/Second - mismatched parentheses
Tonnes^Apples - following ^ with something other than a number

Checking Units

Stella checks units by going through the equations for a variable and substituting the variables' units of measure in place of the variable values. For example, if we have the equation:

production = workers * productivity

and we've specified that workers are measured in Person, and productivity is measured in Widget/Month/Person, then substituting these values would give Widget/Month. If the units of measure for production are Widget/Month, then the units will match.

If, on the other hand, workers were measured in People, then what would happen? Reducing the equation would give People/Person*Widget/Month. People and Person should reasonably cancel in this equation, and Stella does this by having People as an alias for Person. This alias is built into Stella, along with a number of others. Similarly, if the units assigned to productivity were Widgets_per_Month_per_Person, you could create an equation setting Widgets_per_Month_per_Person to be equal to Widget/Month/Person.

You can define a unit of measure by specifying an equation and zero or more aliases using the Unit Editor. The equation is not required if there are one or more aliases. Stella has a variety of defined units of measure built in, including Widgets with alias widgets, Seconds with aliases s and second, Per Second with equation 1/Seconds, and so on.

Having the equations and aliases in place lets you attach easy-to-read units to all your model variables, but still have them resolve to a well defined meaning for unit checking.

If there are any problems with units in your model, they're displayed in the error list at the end of the Run toolbar.

Clicking the dropdown will show the list of issues. Choosing an entry in the list will navigate you to the source of the problem and open the equation and units for that variable in the Properties panel.

Flows and Chains

As long as a flow is connected to a stock, you don't need to, and can't, specify its units of measure. These are determined by the units of the upstream or downstream stock and the Units for Time given in the Run Specifications. Similarly, all of the units for stocks along a chain have to be the same, so changing the units in one stock in a chain will change them for all stocks (and flows) in the chain, unless there's a unit-converting flow encountered.

The units of measure for the equation determining the flow still need to match those of the flow. So, even though you can't specify units for a connected flow (or suggest them), you can still check them.

What Do You Want to Do?

Concept Link IconSee Also