Examples of Expressions

See also:  Expressions, Understanding Expression Inheritance, Expression Elaboration, The Expression Builder

Type

Description

Example Syntax and Graph

Simple Number

Calculates a constant value in all scenarioA self-consistent story line of how a future energy system might evolve over time in a particular socio-economic setting and under a particular set of policy conditions. years

3.1415

Simple Formula

Calculates a constant value in all scenario years

0.1 * 5970

Growth 

Growth calculates exponential growth over time from a base yearThe first historical year of a LEAP analysis. value. Only valid in scenario expressions - not in Current Account expressions.

Growth(3.2%)

Interp

Interp calculates straight-line change between specified pairs of data years and values. An optional final parameter lets you specify an exponential growth rate after the last data year. The function can include any number of year/value pairs, which need to be entered in ascending chronological order. Notice that the value parameters in this function can themselves be specified as mathematical functions.

Interp(2000, 40, 2010, 65, 2020, 80)

 

Interp from Excel Data As Interp, but instead of the user specifying the data explicitly in the formula, this approach gets data from a range (myrange) in a separate Excel spreadsheet (mysheet.xlsx). The range should be a 2*X or X*2-sized range containing years and values arranged in ascending chronological order (where X is the number of years/values).  Your LEAP model will automatically be updated if the data in the spreadsheet changes. Interp(mysheet.xlsx, myrange)
Interp from the LEAP Cloud Data Server (LCDS) As Interp, but in this case data is retrieved from a data set stored online in the LEAP Cloud Data Server.  The second parameter defines the data set being accessed.  In this example, medium variant population projections from the UN Population Prospects data set for Argentina are retrieved. The LCDS contains the data from many different open source databases. The last parameter "ARG" denotes a country.  This parameter can be omitted if the country is already set in the Settings: Scope screen for national scale data sets or in the Regions screen for muti-national data sets.  Interp(LCDS, UNPopulation, Medium, ARG)

Step

Step is similar to the Interpolation function except that it calculates discrete changes between specified pairs of data years and values.

Step(2000, 300, 2005, 500, 2020, 700)

 

Remainder

Remainder calculates the remaining value in one branchAn item on the tree. Different types of branches are represented by different icons on the tree by subtracting values of all other neighboring branches from the function parameter. This function is useful for "share" branches: for example where you want to specify some branches as changing percentage share, and have one branch account for the remaining share.

Remainder(100)

Branch and VariableData that can change over time. References

Any LEAP variable can be calculated as a reference to the values of another variable (with some restrictions).

Passenger: Activity Level  * 1.1

GrowthAs

GrowthAs calculates a value in any given year based on its previous year's value and the rate of growth in another named branch, raised to the power of an elasticity.  In this example the growth in one variable is projected to growth 10% faster than the growth in another key assumption variable named "income".

GrowthAs(Key\Income,1.1)