Skip to content

LOLD Implementation#108

Open
akrivi wants to merge 9 commits into
mainfrom
al/LOLD
Open

LOLD Implementation#108
akrivi wants to merge 9 commits into
mainfrom
al/LOLD

Conversation

@akrivi
Copy link
Copy Markdown
Collaborator

@akrivi akrivi commented May 11, 2026

This PR:

  • Implements the Loss of Load Days (LOLD) metric as defined in [1]
  • Adds a new documentation page: "Interpreting Resource Adequacy Metrics"

Mathematical formulation

We define the Loss of Load Days (LOLD) metric as:

$$ \mathrm{LOLD} = \mathbb{E}\left[\sum_{d} I_{d,s}\right] $$

where:

$$ I_{d,s} = \begin{cases} 1 & \text{if } \exists t \in {T}(d) \text{ such that } \sum_r S_{r,t,s} > 0 \\ 0 & \text{otherwise} \end{cases} $$

and

  • $r$ indexes regions in the system
  • $t$ indexes timestamps
  • $d$ indexes calendar days
  • $s$ indexes Monte Carlo samples
  • $S_{r,t,s}$ is the shortfall in region $r$, time $t$, sample $s$
  • ${T}(d)$ is the set of all time periods belonging to day $d$

We note that LOLD is not naturally defined at a single timestamp, since it aggregates over all time periods within a day. As a result, additional computation is needed compared to LOLE, namely:

  1. grouping time periods by calendar day
  2. aggregating within each day

Benchmarks

Complexity wise, the system wide and full-horizon LOLD scales with total simulation size, while the day-specifc queries scale only with the size of the selected day.

We also provide below a comparison of the benchmarks between LOLD and LOLE:
Screenshot 2026-03-23 at 23 07 27

References:
[1] G. Stephen et al., "Clarifying the Interpretation and Use of the LOLE Resource Adequacy Metric," 2022 17th International Conference on Probabilistic Methods Applied to Power Systems (PMAPS), Manchester, United Kingdom, 2022, pp. 1-4, doi: 10.1109/PMAPS53380.2022.9810615.

@akrivi akrivi changed the title Al/lold LOLD Implementation May 11, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 11, 2026

Codecov Report

❌ Patch coverage is 92.07921% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.51%. Comparing base (11d3003) to head (9a795d1).

Files with missing lines Patch % Lines
PRASCore.jl/src/Results/ShortfallSamples.jl 92.30% 3 Missing ⚠️
PRASCore.jl/src/Results/utils.jl 90.32% 3 Missing ⚠️
PRASCore.jl/src/Results/metrics.jl 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
+ Coverage   83.13%   83.51%   +0.37%     
==========================================
  Files          45       45              
  Lines        2325     2426     +101     
==========================================
+ Hits         1933     2026      +93     
- Misses        392      400       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# - **LOLE** is the expected number of event-periods
# - **LOLD** is the expected number of event-days
# - **LOLEv** is the expected number of adequacy events
#
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we adding LOLEv to this PR as well or just LOLD?

# | LOLD | 1 | 10 |
#
# As we can see in the table above, even though LOLE and EUE are identical in this case,
# LOLD reveals that shortfall events are more dispersed in Case B.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a note that LOLD is only callable using Shortfallsamples?


# This creates a timestamped directory containing a `pras_results.json`
# file with:
# - system-level metrics (LOLE, EUE, NEUE)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and LOLD?

end
end

@testset "Multiple shortfall periods in same day count once" begin
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good test!

Copy link
Copy Markdown
Collaborator

@abdelrahman-ayad abdelrahman-ayad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work Akrivi! I left a couple of very minor comments. Can we also include metrics tests in the test/Results/metrics.jl ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants