Expressions Overview

WEAP borrows an approach made popular in spreadsheets: the ability for users to enter data and construct models using mathematical expressions. Expressions are standard mathematical formulae used to specify the values of variables in WEAP's Data View. In the Current Accounts an expression defines the initial value for a given variable at a branch, while in scenarios, the expression defines how that variable changes over time (from one year after the Current Accounts to the end of the study period).

Expressions can range from simple numeric values to complex mathematical formulae. Each formula can optionally use WEAP's many built-in functions, as well as referencing the values of other branches, both data and result variables. Expressions can even create dynamic links to the values stored in an external Microsoft Excel spreadsheet.

WEAP provides a number of ways of editing expressions. The most common are:

Color Coding of Expressions

When editing scenario data in WEAP's Data View, expressions are color coded to show which expressions have been entered explicitly, and which are inherited from another scenario.  Red text indicates a value entered explicitly, whereas black text indicates an inherited value.  To reset an expression back to its inherited default, highlight the expression and press the Delete key.  For more information, see Scenario Inheritance.

If no data has been entered yet for an expression, either for the current scenario or any of its parent scenarios or Current Accounts, a default value will be shown in light gray.  For most variables the default value is 0, although there are a few exceptions, such as Demand Site Consumption, which defaults to 100%.

Referencing Variables in Expressions

West City:Annual Activity Level

WEAP will change this to read

West City:Annual Activity Level[Million Person]

Thus the general syntax of branch/variable references is:

Branch:Variable[Scale Unit]

Notice that some variables will have no scaling factor and thus the square bracket will simply contain the unit name.  You can subsequently edit the scale and units specified within the square brackets and WEAP will convert the values returned to the scale and units you specify.  Note however, that you must specify a unit of the same class as the one specified for the referenced variable,   For example, if the referenced variable is measured in a mass unit (e.g. "Tonne"), you may specify another mass unit (e.g. "kg")  but using a volume unit such as liters, or any a unit of any other class will generate an error message.  You can specify units either using their long names (e.g. Kilogram) or using their abbreviations (kg).  Refer to the General: Units screen for a full list of available units.  The allowable scaling factors values are:  % (10E-2), Hundred (10E2), Thousand (10E3), Million (10E6), Billion (10E9) and Trillion (10E12). Note that you can reset an expression to use the default scaling factors (those used in the referenced variable) by simply deleting the contents of the square brackets.

Tip: Using the Expression Builder tool is the easiest way to create expressions that reference other branches and variables.

See also: Functions, Data View, Examples of Expressions, Expression Builder