Skip to content

Conversation

@filippopecci
Copy link
Collaborator

@filippopecci filippopecci commented Oct 15, 2025

Description

This PR provides an initial implementation of capacity reserve margins in Macro. To do so, it introduces a new System field called constraints, which will include all system-wide constraints that can not be associated with a specific node or edge.

The mathematical formulation of the implemented capacity reserve margin constraints is:

$$ \sum_{e \in E_i} \delta^{der}_e \cdot \text{capacity}(e) \geq (1+\beta_i) D^{\text{peak}}_i $$

where :

  • $E_i$ is the user-defined set of edges that contribute to capacity reserve margin constraint $i$
  • $\delta^{der}_e$ is the derate factor of edge $e$
  • Given a user-defined set of nodes $N_i$ corresponding to the region where the capacity reserve margin constraint applies, we have:

$$D^{\text{peak}}_i = \text{max}_{t \in 1,\ldots,T}\Bigg(\sum_{n \in N_i}\text{demand}(n,t)\Bigg)$$

  • $\beta_i$ is the capacity reserve margin factor defined in settings.CapacityReserveMargin (e.g., $\beta_i=0.1$ corresponds to a margin that is 10% above peak demand)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g., docstrings for new functions, updated/new .md files in the docs folder)
  • My changes generate no new warnings
  • I have tested the code to ensure it works as expected
julia> using Pkg
julia> Pkg.test("MacroEnergy")

How to test the code

See attached test system: electricity_three_zone_capacity_reserve_margin.zip

@filippopecci filippopecci requested review from RuaridhMacd and Copilot and removed request for Copilot October 16, 2025 18:59
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.

1 participant