• 220 views | 6 messages Discussion: LEAP
    Topic: Changing Path (LEAP API)Subscribe | Previous | Next
  • Andre Siqueira 9/23/2019

    Hi everyone,

    Is it possible to chance the option as shown attached using API? For instance, I can use the code below in order to export the value in 2040:

    Worksheets("Sheet1").Range("A2").Value = L.Branch("Demand\Household").Variable("Energy Demand Final Units").Value(2040, "KWH")

    but just in Absolute Values. Is it possíble to export the value in 2040, but the Cumulative Value?

    Thank you!


    Results.View.PNG
  • Charlie Heaps 9/23/2019
      Best Response

    >>Is it possible to chance the option as shown attached using API? For instance, I can use the code below in order to export the value in 2040:
    >>Worksheets("Sheet1").Range("A2").Value = L.Branch("Demand\Household").Variable("Energy Demand Final Units").Value(2040, "KWH")
    >>but just in Absolute Values. Is it possíble to export the value in 2040, but the Cumulative Value?

    Its not possible to directly refer to a cumulative value in the API. However you could easily achieve this by writing some code to loop through all the yearly values so that you calculate the cumulative value yourself. Something like this... (Sorry not actually tested).

    SET CumulativeValue = 0
    FOR Y = LEAP.BaseYear to LEAP.EndYear
    CumulativeValue = CumulativeValue + L.Branch("Demand\Household").Variable("Energy Demand Final Units").Value(Y, "KWH")
    NEXT
    Worksheets("Sheet1").Range("A2").Value = CumulativeValue

  • Andre Siqueira 9/23/2019
      Best Response

    It worked, Chales. Thank you.

    I'm trying to obtain the NPV value shown attached. I can use the Loop's but as it seems I'll need do more code in order to export it, because I need the Cumulative Values and Comparison.

    The main goal is to obtain the "Cost of Avoiding GHGs" , using the "NPV" and "GHG Savings". Do you have any advice?

    Thank you again!

    Social_Costs.Chart.PNG
  • Andre Siqueira 9/23/2019
      Best Response

    It would be easier if I could just export the values from Summaries. Is it possible to use something similar?

    ( e.g. L.Branch("Demand\Household").Variable("Energy Demand Final Units").Value(2040, "KWH") )

    In addition, is it possible to export all the Summaries table?


    Cost_of_Avoiding.Table.PNG
  • Charlie Heaps 9/24/2019
      Best Response

    I'm afraid that is not (yet) possible via the API. The summaries screen has not yet been integrated with the API, but I do think this is a good idea.

    I will add it to my to do list, but I don't think it will make it into the next major release I'm afraid.

    Charlie

  • Andre Siqueira 10/6/2019
      Best Response

    Hi Charles,

    Do you have any idea of how I could obtain the Results with Discounted Costs?

    I was able to obtain the Cumulative Values, Differences vs Reference but just for Real Costs. I tried to set the Discounted Rate using "L.Discountedrate = " but it didn't work well.