Skip to content

Minimum generation share

This constraint enforces a minimum dispatch share for a specific carrier (e.g., renewable, nuclear, solar) across multiple investment periods. It's useful when you need to ensure that certain technologies contribute a minimum proportion of total generation, often to meet policy mandates or renewable energy targets.

Common use cases:

  • Enforcing renewable portfolio standards or clean energy mandates
  • Modelling policy-driven generation mix requirements (e.g., minimum 30% renewable generation)
  • Exploring the system costs of meeting minimum technology deployment targets

Note that in the code block below, n refers to the network object.

python
# Configure your dispatch share parameters
carrier_name = "renewable"  # Change to your desired carrier (e.g., "nuclear", "solar", "wind")
start_share = 0.0  # Starting share (0%)
end_share = 0.30  # Target share (30%)
start_year = 2025
end_year = 2050

# Access the dispatch variables
p = n.model["Generator-p"]
is_target_carrier = n.generators.carrier == carrier_name

for period in n.investment_periods:
    # Skip if outside your desired range
    if period < start_year or period > end_year:
        continue
    
    # Linear interpolation for minimum carrier share
    frac = start_share + (end_share - start_share) * ((period - start_year) / (end_year - start_year))

    # Get snapshots for this investment period
    period_snapshots = n.snapshots[n.snapshots.get_level_values('period') == period]
    
    if len(period_snapshots) == 0:
        continue

    # Get target carrier generators
    target_generators = n.generators[is_target_carrier].index
    
    # Total generation for this period
    total_gen = p.sel(snapshot=period_snapshots).sum()
    
    # Target carrier generation for this period
    if len(target_generators) > 0:
        target_gen = p.sel(snapshot=period_snapshots, Generator=target_generators).sum()
    else:
        target_gen = 0

    # Add the constraint
    n.model.add_constraints(
        target_gen >= frac * total_gen,
        name=f"{carrier_name}_min_share_{period}"
    )

    # print statement for your logs
    print(f"Added {carrier_name} min share for {period}: {frac*100:.2f}%")

© Copyright 2025 Bayesian Energy