• 339 views | 7 messages Discussion: LEAP
    Topic: LEAP-APISubscribe | Previous | Next
  • Yupeng Wang 6/12/2022

    Dear professor:
    The API learning provided by your organization cannot be connected. I want to learn api, how to start learning.Can you provide the latest api learning materials?
    Invalid api learning link:
    2、http://www.energycommunity.org/WebHelpPro/API/API.htm
  • Charlie Heaps 6/12/2022
      Best Response

    Suggest you start on this page:

    Please note that energycommunity.org is no longer working. The LEAP web site is now located at: https://leap.sei.org.
  • Yupeng Wang 6/13/2022
      Best Response

    I want to modify the efficiency value of coal-fired power generation in 2020-2035 through API, and I wrote the following code. I want to directly enter the efficiency value of the 2020-2035 time series, but the run shows an error. Only one value can be entered, but I need to enter a series of values, how can I achieve this? thanks!
    L.Branch("Transformation\electricity\Processes\coal electricity").Variable("Process Efficiency").Expression = Sheets("1").Range("M9:AB9").Value error
    L.Branch("Transformation\electricity\Processes\coal electricity").Variable("Process Efficiency").Expression = Sheets("1").Range("AB9").Value correct
  • Jason Veysey 6/13/2022
      Best Response

    Variable.Expression must be set to a valid LEAP expression - i.e., something LEAP would be able to interpret if you typed it into the Analysis View in LEAP. If you want an expression based on multiple Excel cells' values, I'd suggest writing additional VBA code that iterates over the values and concatenates them into a single, valid LEAP expression (e.g., an Interp expression). Then assign that expression to Variable.Expression.
  • Yupeng Wang 6/13/2022
      Best Response

    Thanks for your reply, can you provide a demo, thanks!
  • Ethne Laude 6/23/2022
      Best Response

    I'm trying to set the expression to a Growth/Interp function, but whenever it is run, there is an error message that there is a type mismatch.

    For Each b In LEAP.Branch("Demand\Households\Urban\Lighting").Children
    b.Variable("Activity Level").Expression = Growth(3)
  • Charlie Heaps 7/5/2022
      Best Response

    The growth expression is text (a string), so in VB you must wrap it in double quotes like this... = "Growth(3)"