• 153 views | 3 messages Discussion: LEAP
    Topic: Automation to run multiple scenarios just changing one variableSubscribe | Previous | Next
  • Rebecka Engström 1/26/2016

    1 Like 493 Views

    Hi,
    I am looking for help to run multiple scenarios where a certain input variable (such as population growth estimates or adoption of more effiient appliances) is changed one step in each scenario (from a determined min and max).

    Since I plan to do this with a set of variables I hope to find a way to automate this, and to of course save the results between each new run.

    Is there an existing script available for this, or do you have any advice on how to set up such a script?

    Thanks!
    /Rebecka
  • Taylor Binnington 1/27/2016
      Best Response

    492 Views

    Hi Rebecka,

    Based on your post, I'll assume that you have already defined a number of new scenarios in the Scenario Manager, and that you'd like to plug in a different value for a particular variable(s) into each of these scenarios.

    Try something like this (which you may copy and paste into LEAP's built-in script editor, at Advanced: Edit Scripts):

    ============================
    For each sc in LEAP.Scenarios
    LEAP.ActiveView = "Analysis"
    LEAP.BranchVariable("Key\path\to\assumption:Activity Level").Expression = "a LEAP expression"

    LEAP.ForceCalculation
    LEAP.ActiveView = "Results"

    LEAP.ExportResultsCSV("C:\path\to\file.csv")
    Next
    ============================

    You'll need to modify the script to enter whatever expression and file name you deem appropriate, but I hope the structure helps to get you started.

    Taylor


  • Rebecka Engström 2/2/2016
      Best Response

    483 Views

    Thank you very much Taylor,
    I will try this script and come back if I get any further hurdles.
    /Rebecka