• 171 views | 5 messages Discussion: LEAP
    Topic: Use of look-up tables in LEAPSubscribe | Previous | Next
  • Poushali Maji 6/2/2017

    Hi there,

    I'm new to LEAP and I'm looking to assign a value to a variable depending on another variable's value in a look-up table. Specifically, assign a value to useful energy per capita in the Reference scenario, depending on a look-up table that has 12 categories of Income values with corresponding Useful energy per capita. The function LOOKUP allows 2 such categories/values to be used - is there a way I can use the table of 12 rows and 2 columns(Income and useful energy per capita) that I have?

    Thanks in advance,

    Poushali

  • Taylor Binnington 6/5/2017
      Best Response

    Hi Poushali,

    I'm afraid there isn't a native lookup functio in LEAP that supports that many different cases. If you really wish, you may use LEAP's call() function, which would require that you write a short VBS script (likely consisting of a series of if/else statments) to lookup a particular value in an array of numbers. However, I would warn you that this isn't the most transparent solution.

    Is there a reason that simply entering the numerical data into each branch, or entering it into a Key Assumption and then referencing that Key Assumption, is inadequate?

    Taylor

  • Poushali Maji 6/25/2017
      Best Response

    Thanks for your reply Taylor.
    I want to be able to look up the energy use corresponding to an income range, as income rises with time. For Current Accounts I've inserted energy use values for each income group manually, but for the Reference scenario, I want energy use for each income group, depending on the rise in income, as specified by the look-up table which shows income vs. energy use.
    (Not sure if this makes my question clear I'm afraid)

  • Taylor Binnington 6/26/2017
      Best Response

    Hi Poushali,

    Right - your question was clear. However, I omitted a suggestion in my first response that might be the simplest solution for you. LEAP's conditional "If()" statement can recieve multiple arguements, which you could use to design an energy use ladder in your model. have a look at this help page.

    So for example, if your income data was stored in a variable called Key\Income, you could enter an expression like this into a Final Energy Intensity variable:

    If(Key\Income[Thousand Dollars]<4, 1, Key\Income[Thousand Dollars]<5, 2, Key\Income[Thousand Dollars]<6, 3, 5)

    Best,
    Taylor

  • Poushali Maji 6/26/2017
      Best Response

    That works perfectly, thank you!