Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Residual loads

Negative residual loads might lead to an unsolvable EMPS problem, or even cause a crash when executing the model. There is no hard limit for when negative residual loads will cause these kinds of trouble, but a few rules of thumb exist: If it is negative for just one price segment in one week for one scenario, that will work just fine. And if it is always negative, it will fail for sure. A short period of time will probaly work, but the longer the period then higher is the risk of failure.

The residual load is calculated for each Market Calibration Areas.

Definition

Residual load is the difference between loads (ENMD group 16) and unregulated energy production (wind, solar, aggregated hydro modules).

∑i=1timesteps(∑n=1numloads(loads(n)))−(∑n=1numwind(wind(n))+∑n=1numsolar(solar(n))+∑n=1numunreg(unreg_agg_inflow(n)))\sum_{i=1}^{timesteps}\Biggl( \sum_{n=1}^{num loads}(\text{loads(n)}) ) - \biggl( \sum_{n=1}^{num wind}(\text{wind(n)}) + \sum_{n=1}^{num solar}(\text{solar(n)}) + \sum_{n=1}^{num unreg}(\text{unreg\_agg\_inflow(n)} \biggl) \Biggl)

If there is more unregulated production than consumtion, there is a negative residual load.

Residual load results

The results are grouped by market calibration area name. If there are no explicit groups defined, a group named default is used and all applicable objects are used to calculate the residual load.

Example results

With 2 market calibration area names, there are two groups, market_area_1 and market_area_2.

Each area contains 2 Txy variables with a total average for all scenarios, and one average per scenario.

Listing with JSON-like results

All results are intentionally 0.0.

JSON-ified results

{
    "market_area_1": {
        "total": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    0.0,
                    0.0,
                    0.0
                ]
            ]
        },
        "scenario": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    0.0,
                    0.0,
                    0.0
                ],
                [
                    0.0,
                    0.0,
                    0.0
                ]
            ]
        }
    },
    "market_area_2": {
        "total": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    0.0,
                    0.0,
                    0.0
                ]
            ]
        },
        "scenario": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    0.0,
                    0.0,
                    0.0
                ],
                [
                    0.0,
                    0.0,
                    0.0
                ]
            ]
        }
    }
}

Example model with a load specified, with only differences to market calibration areas shown.

Download residual_loads.json.

--- market_calibration_areas.json
+++ residual_loads.json
@@ -3,7 +3,7 @@
     "model": {
         "global_settings": {
             "name": "global_settings",
-            "output_path": "testout_market_calibration_areas/",
+            "output_path": "testout_residual_loads/",
             "calc_water_value_flag": {
                 "timestamps": [
                     "2024-01-01T00:00:00Z",
@@ -56,6 +56,37 @@
                 "name": "market_area_2"
             }
         ],
+        "loads": [
+            {
+                "name": "FLAT",
+                "capacity": {
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            100
+                        ]
+                    ]
+                }
+            },
+            {
+                "name": "FLAT_SCENARIO",
+                "capacity": {
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            100
+                        ],
+                        [
+                            500
+                        ]
+                    ]
+                }
+            }
+        ],
         "areas": [
             {
                 "name": "numedal"
@@ -271,6 +302,14 @@
             },
             {
                 "from": "LIT_OTT",
+                "to": "otta"
+            },
+            {
+                "from": "FLAT",
+                "to": "numedal"
+            },
+            {
+                "from": "FLAT_SCENARIO",
                 "to": "otta"
             }
         ]

market_area_1 is assigned a constant load FLAT with 1 scenario.

market_area_2 is assigned a constant load FLAT_SCENARIO, with different values for each scenario. This example model has 2 scenarios (historical_period spans 2 years).

Listing with constant load results
{
    "market_area_1": {
        "total": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    100.0000000000046,
                    100.0000000000046,
                    100.0000000000046
                ]
            ]
        },
        "scenario": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    100.0000000000046,
                    100.0000000000046,
                    100.0000000000046
                ],
                [
                    100.0000000000046,
                    100.0000000000046,
                    100.0000000000046
                ]
            ]
        }
    },
    "market_area_2": {
        "total": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    300.0000000000373,
                    300.0000000000373,
                    300.0000000000373
                ]
            ]
        },
        "scenario": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    100.0000000000046,
                    100.0000000000046,
                    100.0000000000046
                ],
                [
                    500.00000000007,
                    500.00000000007,
                    500.00000000007
                ]
            ]
        }
    }
}

Negative residual loads

Expanding the above model with exaggerated values for wind, solar and aggregated_hydro_modules, the residual becomes negative.

Only showing the differences between residual_loads and negative_residual_loads. Download complete negative_residual_loads.json.

Negative residual loads model file differences
--- residual_loads.json
+++ negative_residual_loads.json
@@ -3,7 +3,7 @@
     "model": {
         "global_settings": {
             "name": "global_settings",
-            "output_path": "testout_residual_loads/",
+            "output_path": "testout_negative_residual_loads/",
             "calc_water_value_flag": {
                 "timestamps": [
                     "2024-01-01T00:00:00Z",
@@ -87,6 +87,136 @@
                 }
             }
         ],
+        "wind": [
+            {
+                "name": "RJU_WIND",
+                "capacity": {
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            150.4
+                        ],
+                        [
+                            245.0
+                        ]
+                    ]
+                }
+            }
+        ],
+        "solar": [
+            {
+                "#comment": "Gruppe 18 1D",
+                "name": "UST_SOLAR",
+                "capacity": {
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            150.4
+                        ],
+                        [
+                            1000
+                        ]
+                    ]
+                }
+            }
+        ],
+        "aggregated_hydro_modules": [
+            {
+                "name": "ltldalen_enmag_aggregated",
+                "reservoir_energy": 63001.0,
+                "station_power": 20184.523,
+                "regulated_power_inflow": {
+                    "#comment": "R30 - GWh/uke i datafil, input in MW",
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z",
+                        "2025-01-01T00:00:00Z",
+                        "2026-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            0.89285714286,
+                            1.48809523810,
+                            2.97619047619
+                        ],
+                        [
+                            1.48809523810,
+                            1.48809523810,
+                            1.48809523810
+                        ]
+                    ]
+                },
+                "unregulated_power_inflow": {
+                    "#comment": "U30 - GWh/uke i datafil, input in MW",
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z",
+                        "2025-01-01T00:00:00Z",
+                        "2026-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            0.06547619048,
+                            6.54761904762,
+                            0.06547619048
+                        ],
+                        [
+                            0.07142857143,
+                            0.07142857143,
+                            0.07142857143
+                        ]
+                    ]
+                },
+                "upper_reservoir_limits": {
+                    "#comment": "Manually adjusted upper reserveroir limits, GWh",
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z",
+                        "2025-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            59000,
+                            58000
+                        ]
+                    ]
+                },
+                "lower_reservoir_limits": {
+                    "#comment": "Manually adjusted lower reserveroir limits, GWh",
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            1000
+                        ]
+                    ]
+                },
+                "upper_production_limits": {
+                    "#comment": "Manually adjusted upper production limits, MW",
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            20000
+                        ]
+                    ]
+                },
+                "lower_production_limits": {
+                    "#comment": "Manually adjusted lower production limits, MW",
+                    "timestamps": [
+                        "2024-01-01T00:00:00Z"
+                    ],
+                    "scenarios": [
+                        [
+                            50
+                        ]
+                    ]
+                }
+            }
+        ],
         "areas": [
             {
                 "name": "numedal"
@@ -311,6 +441,18 @@
             {
                 "from": "FLAT_SCENARIO",
                 "to": "otta"
+            },
+            {
+                "from": "ltldalen_enmag_aggregated",
+                "to": "litldalen"
+            },
+            {
+                "from": "RJU_WIND",
+                "to": "rjukan"
+            },
+            {
+                "from": "UST_SOLAR",
+                "to": "ustaoset"
             }
         ]
     }
Negative residual loads example results
{
    "market_area_1": {
        "total": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    -672.9000000000501,
                    -672.9000000000501,
                    -672.9000000000501
                ]
            ]
        },
        "scenario": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    -200.80000000003793,
                    -200.80000000003793,
                    -200.80000000003793
                ],
                [
                    -1145.0000000000623,
                    -1145.0000000000623,
                    -1145.0000000000623
                ]
            ]
        }
    },
    "market_area_2": {
        "total": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    288.49999999996965,
                    -253.0082417583355,
                    284.012362637335
                ]
            ]
        },
        "scenario": {
            "timestamps": [
                "2024-01-01T00:00:00Z",
                "2024-12-30T00:00:00Z",
                "2025-12-29T00:00:00Z"
            ],
            "scenarios": [
                [
                    88.99999999998887,
                    -994.0164835166214,
                    80.0247252747196
                ],
                [
                    487.99999999995043,
                    487.99999999995043,
                    487.99999999995043
                ]
            ]
        }
    }
}

When running the model through this script, validation will fail.

import os
from datetime import timedelta

from pyltmapi import LtmSession

# Sampling rate
one_hour = timedelta(hours=1)

# Averaging period
one_efi_year = timedelta(weeks=52)

with LtmSession("residual_session") as session:
    session.load(filename="residual_loads.json")
    residuals = session.model.calculate_residual_load(one_hour, one_efi_year)
    print(residuals)

with LtmSession("negative_residual_session") as session:
    session.load(filename="negative_residual_loads.json")
    residuals = session.model.calculate_residual_load(one_hour, one_efi_year)
    print(residuals)
    session.write_model()   # Will fail due to negative residual loads

Output:

(negative_residual_session) Model discrepancies found: 4
(negative_residual_session) [market_calibration_area_check] Negative residual load for area 'market_area_1' at 2024-01-01T00:00:00Z for scenario 0. Residual load -672.90
(negative_residual_session) [market_calibration_area_check] Negative residual load for area 'market_area_1' at 2024-12-30T00:00:00Z for scenario 0. Residual load -672.90
(negative_residual_session) [market_calibration_area_check] Negative residual load for area 'market_area_1' at 2025-12-29T00:00:00Z for scenario 0. Residual load -672.90
(negative_residual_session) [market_calibration_area_check] Negative residual load for area 'market_area_2' at 2024-12-30T00:00:00Z for scenario 0. Residual load -253.01
(negative_residual_session) Model validation failed