Units

It is common practice to define units of measurement for elements of system dynamics models. 

AnyLogic enables defining units for all elements of stock and flow diagrams and moreover for all types of variables (stocks, flows, dynamic variables, variables, parameters) and functions (functions, table functions, schedules, actioncharts). 

Defining units is optional, commonly this may help you to check whether the formulas are defined correctly in your model and moreover this may help other users to understand the logic of the model. However, if you are sure that the structure of your stock and flow diagram and formulas are defined correctly, you may omit defining units of measurements for model elements. 

In the table below we give some examples of units for fundamental elements of stock and flow diagram - stocks and flows. Stocks are usually quantities of something, while flows are measured in the same units per time.

Stock Possible units of stock             Inflows Outflows Possible units of flow
bank balance     
   
euros    deposits
interest 
withdrawals  euros per month
housing stock              dollars housing investment   housing depreciation  dollars per year
CO2 in atmosphere           tons tons emitted    tons sequestered    tons per day
population              persons births
immigration
deaths
emigration   
persons per year
fuel tank                 gallons refueling fuel consumption gallons per month

Specifying units of measurements

 To set units of measurement for a model element

  1. Select the element by clicking it in the graphical editor or in the Projects view.
  2. In the Advanced section of the Properties view, select the System dynamics units check box.
  3. Specify the unit of measurement in the field aside. Start typing and you will see the assistant window listing names of all units used in this model. Scroll to the unit you need or type the first letters of the unit name until it becomes visible in the list. Click the unit name to insert it in the field. 
You can refer to model time unit here using reserved word time


Some elements may be dimensionless - usually they define factors. To declare element as dimensionless, just select the checkbox but leave the field blank.

Checking model units

When you have finished defining units for all elements of your model, you can check their consistency.

 To check units in the model

  1. Select any element of the model and choose Tools > Check System Dynamics Units from the main menu.
  2. You will see dialog box informing you about the check results. In case there are any problems found, you can find detailed information in the Problems view.