• 78 views | 2 messages Discussion: LEAP
    Topic: Read result value via APISubscribe | Previous | Next
  • Mostafa Fard 7/3/2019

    Hello,
    I have a problem to read the result value of a variable via API in LEAP. My problem is that the value that I can see in Result View is different from the value that I get via API (if I am not wrong).
    This is the scenario:
    In the Freedonia project, I try to read the Energy Demand Final Units result value of Demand/Household branch for 2010 via the following API
    LEAP.Branch("Demand\Household").Variables.Item("Energy Demand Final Units").Value(2010)
    It gives me 67776257.809385 value as the result.

    When I see the Result View in LEAP IDE itself, I see the following table:


    So, as you can see, the value that I get via API is 67776257.809385, but the value that I can see in Result View is 18.82673828. I am confused that I am using the API in a wrong way? or this is a bug in API? or ...?

    {As a notice, the mentioned API works correctly for Data variables in a branch}

    Could you please let me know how can I read the result values via API if my implementation is not correct.
    Thanks,


  • Emily Ghosh 7/3/2019
      Best Response

    1 Like

    Hi Mostafa,

    The default units for energy demand in the API are in GJ. If you change the units in Results View from Million GWH to GJ, you will see that the results from the API are correct.

    You can also re-write the API expression to if you want the units in GWH.
    LEAP.Branch("Demand\Household").Variable("Energy Demand Final Units").Value(2010, "GWH")

    Hope this helps,
    Emily