|
| 1 | +# Renewable Generator, Battery and Site Limits |
| 2 | + |
| 3 | +`energypylinear` has the ability to optimize a battery located with renewable electricity generation. |
| 4 | + |
| 5 | +This guide shows how to model a site with a renewable generator and battery that can export electricity to the grid. |
| 6 | + |
| 7 | +## Basic Setup |
| 8 | + |
| 9 | +First, let's set up a site with two assets - a solar generator and battery, with a site export limit of 25 MW: |
| 10 | + |
| 11 | +<!--phmdoctest-share-names--> |
| 12 | +```python |
| 13 | +import energypylinear as epl |
| 14 | + |
| 15 | +# Create assets: |
| 16 | +# - 10 MW / 20 MWh battery with 90% round-trip efficiency |
| 17 | +# - Solar generator with a predefined generation profile (10-30 MW across 5 intervals) |
| 18 | +# - Generator can be curtailed down to 50% of available generation |
| 19 | +# - Custom name "solar" for the generator |
| 20 | +assets = [ |
| 21 | + epl.Battery(power_mw=10, capacity_mwh=20, efficiency_pct=0.9), |
| 22 | + epl.RenewableGenerator( |
| 23 | + electric_generation_mwh=[10, 20, 30, 20, 10], |
| 24 | + electric_generation_lower_bound_pct=0.5, |
| 25 | + name="solar", |
| 26 | + ), |
| 27 | +] |
| 28 | + |
| 29 | +# Configure site: |
| 30 | +# - Carbon intensity values for each interval (negative values represent low carbon periods) |
| 31 | +# - Maximum export limit of 25 MW to the grid |
| 32 | +site = epl.Site( |
| 33 | + assets=assets, |
| 34 | + electricity_carbon_intensities=[0.5, -0.5, 0.5, 0.5, -0.5], |
| 35 | + export_limit_mw=25, |
| 36 | +) |
| 37 | + |
| 38 | +# Optimize for carbon minimization rather than profit maximization |
| 39 | +simulation = site.optimize(objective="carbon") |
| 40 | +``` |
| 41 | + |
| 42 | +## Examining the Results |
| 43 | + |
| 44 | +Let's examine the results of our optimization to see how the battery and solar plant work together under carbon optimization. |
| 45 | + |
| 46 | +<!--phmdoctest-share-names--> |
| 47 | +```python |
| 48 | +print( |
| 49 | + simulation.results[ |
| 50 | + [ |
| 51 | + "site-electricity_carbon_intensities", |
| 52 | + "site-export_limit_mw", |
| 53 | + "site-export_power_mwh", |
| 54 | + "solar-electric_generation_used_mwh", |
| 55 | + "battery-electric_charge_mwh", |
| 56 | + "battery-electric_discharge_mwh", |
| 57 | + "battery-electric_final_charge_mwh", |
| 58 | + ] |
| 59 | + ] |
| 60 | +) |
| 61 | +``` |
| 62 | + |
| 63 | +This gives us the following output: |
| 64 | + |
| 65 | +``` |
| 66 | + site-electricity_carbon_intensities site-export_limit_mw site-export_power_mwh solar-electric_generation_used_mwh battery-electric_charge_mwh battery-electric_discharge_mwh battery-electric_final_charge_mwh |
| 67 | +0 0.5 25 10.00 10.0 0.00 0.00 0.00 |
| 68 | +1 -0.5 25 25.00 20.0 5.00 0.00 4.50 |
| 69 | +2 0.5 25 25.00 30.0 0.00 5.00 0.00 |
| 70 | +3 0.5 25 15.00 20.0 0.00 5.00 0.00 |
| 71 | +4 -0.5 25 10.00 10.0 0.00 0.00 0.00 |
| 72 | +``` |
| 73 | + |
| 74 | +## Results Interpretation |
| 75 | + |
| 76 | +When optimized for carbon, we can observe the following behavior: |
| 77 | + |
| 78 | +1. During periods with negative carbon intensity (intervals 1 and 4): |
| 79 | + - In interval 1: The battery charges 5 MWh while solar generates 20 MWh, maximizing export to the grid up to the 25 MW limit |
| 80 | + - In interval 4: Solar generation is only 10 MWh, which is fully exported |
| 81 | + |
| 82 | +2. During periods with positive carbon intensity (intervals 0, 2, and 3): |
| 83 | + - The battery discharges in intervals 2 and 3 to maximize export during high carbon periods |
| 84 | + - The battery and solar work together to respect the 25 MW export limit |
| 85 | + |
| 86 | +This strategy minimizes overall carbon emissions by: |
| 87 | +- Maximizing export during negative carbon periods (displacing high-carbon grid generation) |
| 88 | +- Using the battery to shift energy between periods strategically |
0 commit comments