• 74 views | 1 messages Discussion: LEAP
    Topic: Indicators plus LaggedValue slowing down calculations and codingSubscribe | Previous | Next
  • Johannes Eckstein 3/5/2021

    Dear all,

    I am experiencing problems when using indicators and laggedvalue. Concretely, I am trying to implement the eurostat RES-E method, which requires using values 14 years prior to a year in question. LEAP returns zero when referencing a result variable prior to the base year, so some lines of code are required to catch this.

    It seems that using LaggedValue in the indicators slows down LEAP. When I submit such a line of code, cpu heavy background calculations start and I have to wait until these finish. These background calculations also start when I click on such an indicator in the analysis view. Before using the If( Year >= BaseYear+8; -clauses, these expressions also seemed to keep LEAP from completing calculations for results.

    Including the If( Year >= BaseYear+8; -clauses reduced the calculation time. What else could I do to reduced this?

    EDIT:
    I've now moved the creation of the lagged timeseries to a set of other variables and exchanged the calls to LaggedValue with subsequent calls to prevYearValue (one year lag using prevyearvalue on the original, two year lag using prevyearvalue on the one year lagged, etc). So I now longer called laggedvalue and the number of calculations is possible reduced while the number of variables grows. This reduces background calculation time further but working with the indicators is still rather tedious due to the calculations that start each time I try to edit the relevant indicators.

    Many thanks in advance for considering to support.

    Best regards,
    Johannes

    ---

    This is the main indicator referencing others. It is again referenced by an indicator to calculate RES-E shares, which is again used to calculate other indicators.

    Transformation\Electricity Production\Processes\Hydro:Capacity[MW] *
    If(
    year > BaseYear+14; Indicators\RES E time hydro\avg 14:Indicator[kh] ;
    year > BaseYear+13; Indicators\RES E time hydro\avg 13:Indicator[kh] ;
    year > BaseYear+12; Indicators\RES E time hydro\avg 12:Indicator[kh] ;
    year > BaseYear+11; Indicators\RES E time hydro\avg 11:Indicator[kh] ;
    year > BaseYear+10; Indicators\RES E time hydro\avg 10:Indicator[kh] ;
    year > BaseYear+9; indicators\res e time hydro\avg 9:indicator ;
    year > BaseYear+8; indicators\res e time hydro\avg 8:indicator ;
    Transformation\Electricity Production\Processes\Hydro:Capacity[MW] > 0; Indicators\RES E time hydro\avg 00:Indicator[kh] ;
    0) / Demand:Energy Demand Final Units[GWh| Fuel=Electricity] * 100

    This is one of the indicators referenced above (indicators\res e time hydro\avg 8):

    If( Year >= BaseYear+8;
    If(LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 8) > 0; (Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh; Fuel=Electricity] / Transformation\Electricity Production\Processes\Hydro:Capacity[MW] +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 1) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 1) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 2) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 2) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 3) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 3) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 4) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 4) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 5) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 5) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 6) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 6) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 7) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 7) +
    LaggedValue(Transformation\Electricity Production\Processes\Hydro:Outputs by Output Fuel[GWh| Fuel=Electricity]; 8) / LaggedValue(Transformation\Electricity Production\Processes\Hydro:Capacity[MW]; 8) ) / 9;
    0);
    0)

    I am running this system:

    System Information

    LEAP
    Version: 2020.1.0.20 (64-Bit)
    Dictionary Version: 463
    Program Folder: "C:"
    Areas Folder: "C:"
    Settings Folder: "C:"
    Instance: 1
    MapWinGIS Installed: No
    Registered for Automation: Yes
    TSC64 64-Bit DLL for Scripting: No ()
    GLPK: 4.65 (64-Bit)
    Julia: No
    Registered to: "" until
    User Name:

    Current Area
    Area Name:
    Base Year: 2005
    End Year: 2050
    First Scenario Year: 2019
    Scope: [Demand, Transform, Costs, Emissions, Indicators]
    Scenarios: 54 (...)
    Time Slices: 8 (Winter Day, Winter Night, Spring Day, ...)

    Microsoft Windows
    Version: Windows 10 Enterprise 2016 LTSB, 64 Bit
    Windows Directory: C:\Windows
    Running as: Standard User
    BDE Installed: No
    Excel Installed: Yes
    Word Installed: Yes
    PowerPoint Installed: Yes
    Wine: No
    Screen Resolution: 1280 x 720 pixels
    Date Format: dd/mm/yyyy
    List Separator: ";"
    Decimal Separator: "."
    Thousands Separator: ","
    Internet Explorer: 11.4046
    Fonts: Small fonts (100% Scaling)
    Anti-Virus: Windows Defender (Enabled, Up to date)
    Anti-Virus: McAfee VirusScan Enterprise (Enabled, Up to date)
    Anti-Spyware: Windows Defender (Enabled, Up to date)
    Anti-Spyware: McAfee VirusScan Enterprise Antispyware Module (Enabled, Up to date)
    Firewall: Barracuda Personal Firewall (Enabled)
    Firewall: Barracuda Personal Firewall (Disabled)

    Computer
    PC Name:
    Processor: Intel Core i7-8550U CPU @ 1.80GHz
    Processor Speed: 1992 MHz
    Number of Processors: 8
    Total Memory: 15.86 GB
    Available Memory: 10.16 GB
    Disk Size: 476.23 GB
    Free Disk Space: 329.53 GB
    Connected to Internet: Yes