Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
6e2a0d5
include exclusion area
CarlosEpia Aug 7, 2023
670ff5e
add plot_carrier to the etrago methods
CarlosEpia Aug 7, 2023
4dac3b1
include engine and session to loaded etrago obj
CarlosEpia Aug 9, 2023
761b503
include function find_buses_area for clustering
CarlosEpia Aug 9, 2023
c4c09c5
merge dev
CarlosEpia Sep 20, 2023
ea86aa0
Simplify adjust_no_electric_network by not creating new buses
CarlosEpia Sep 21, 2023
030f8ec
receive also shapefiles to not clustered area
CarlosEpia Sep 21, 2023
0d78999
Document exclusion_area
CarlosEpia Sep 21, 2023
adccc1f
apply Black
CarlosEpia Sep 21, 2023
75cbf94
use isort
CarlosEpia Sep 21, 2023
8ad8894
merge dev
CarlosEpia Oct 23, 2023
bf2ca6c
Black and delete comments
CarlosEpia Oct 26, 2023
c2436da
Allow importing extnesion scenario, e.g. for lines from NEP
ClaraBuettner Oct 31, 2023
92d6480
Update documentation for scenario_extension
ClaraBuettner Oct 31, 2023
ec5b7f2
merge dev
CarlosEpia Nov 1, 2023
da2ee15
using flake8
CarlosEpia Nov 1, 2023
eee7911
adapt select_elec_network
CarlosEpia Nov 1, 2023
b817a10
include weighting for area
CarlosEpia Nov 1, 2023
80303b7
perform clustering area of interest
CarlosEpia Nov 1, 2023
9703ed0
gas adaptation to cluster interest area
CarlosEpia Nov 1, 2023
b543366
using isort
CarlosEpia Nov 1, 2023
c267178
fix incorrect name
CarlosEpia Nov 1, 2023
33fa5e9
include area of interest in kmeans clustering
CarlosEpia Nov 2, 2023
4acd371
include cluster_exclusion_area in args
CarlosEpia Nov 8, 2023
06e3476
create function include_busmap_area
CarlosEpia Nov 14, 2023
e6beaa6
Merge branch 'features/extendable_lines_from_nep' into hybit
CarlosEpia Nov 28, 2023
ef4db3e
Merge branch 'dev' into hybit
CarlosEpia Mar 14, 2024
6d99955
hot fix DLR
CarlosEpia Mar 22, 2024
033df50
avoid error when no generators
CarlosEpia Mar 22, 2024
3142f15
include busmap_area in general busmap
CarlosEpia Mar 22, 2024
fbaee5a
Revert "delete provisional fixes for status2019 - part2"
CarlosEpia Mar 26, 2024
3a49e19
use network instead of etrago
CarlosEpia Mar 31, 2024
3e8d4fe
move select_elec_network to utilities
CarlosEpia Apr 1, 2024
8bbfff9
keep just lines connecting remaining buses
CarlosEpia Apr 1, 2024
a8d8736
Merge branch 'fixes/#735-gas-clustering-not-working-with-status2019' …
CarlosEpia Apr 1, 2024
d05e051
Using black
CarlosEpia Apr 1, 2024
8704ea1
fix gas clustering when interest_area
CarlosEpia Apr 1, 2024
b327cf0
Make possible to cluster just the interest area
CarlosEpia Apr 4, 2024
0bab5d4
update args and parameters description
CarlosEpia Apr 4, 2024
6dfb1d5
unify interest_area in args
CarlosEpia Apr 21, 2024
8591d81
update args
CarlosEpia Apr 22, 2024
2ff73a1
update args description
CarlosEpia Apr 22, 2024
0cb1fa6
rename cluster_interest_area
CarlosEpia Apr 22, 2024
e8f0fce
include interest area in args json
CarlosEpia Apr 23, 2024
7fa846e
make ehv clustering off again by default
CarlosEpia Apr 23, 2024
34cb40c
Merge branch 'dev' into hybit
CarlosEpia Apr 23, 2024
4b464ff
flake8 fixes
CarlosEpia Apr 23, 2024
05baf9e
Add option to plot interest area
birgits May 5, 2024
47eef90
Drop isolated buses when lines are decomissioned
ClaraBuettner Jun 8, 2024
9edf004
Apply black
ClaraBuettner Jun 8, 2024
45c6be8
Apply black
ClaraBuettner Jun 8, 2024
976759a
create method adjust_before_optimization
CarlosEpia Jun 11, 2024
260a059
Merge branch 'dev' into hybit
CarlosEpia Aug 8, 2024
480f2ec
Merge branch 'dev' into features/extendable_lines_from_nep
ClaraBuettner Aug 16, 2024
e11cf54
Remove extra argument for scn_decomissioing
ClaraBuettner Aug 16, 2024
c8b1a72
Fix flake8 issues
ClaraBuettner Aug 16, 2024
0dff150
Merge branch 'hybit' into features/extendable_lines_from_nep
ClaraBuettner Aug 16, 2024
05c04e9
Apply black
ClaraBuettner Aug 16, 2024
0d9ac96
Fix flake8 issue
ClaraBuettner Aug 16, 2024
52a1022
Apply isort
ClaraBuettner Aug 16, 2024
7da09d5
Merge pull request #746 from openego/features/extendable_lines_from_nep
ClaraBuettner Aug 16, 2024
f932d49
Add import of shapely
ClaraBuettner Aug 16, 2024
1f4f317
Check if type of geom is a geometry entry
ClaraBuettner Aug 16, 2024
fef9990
Add cluster strategy for scn_name
ClaraBuettner Aug 16, 2024
e23dcd7
Drop duplicate HV buses for eHv clustering busmap
ClaraBuettner Aug 19, 2024
0f4e7ab
Add option for negative load shedding at e-Mobility buses
ClaraBuettner Aug 20, 2024
4265a32
Fix bug when there are different scenario names
birgits Aug 20, 2024
cec6836
assign value to n_clusters when apply_on is market_model
CarlosEpia Aug 21, 2024
b4af09f
Delete outdated fix
ClaraBuettner Aug 22, 2024
86e2d8f
Set negative load shedding for ev buses to True by default
ClaraBuettner Aug 23, 2024
57744fc
Merge pull request #759 from openego/fixes/negative-load-shedding-ev
birgits Aug 23, 2024
e23e136
Revert "Set negative load shedding for ev buses to True by default"
CarlosEpia Nov 13, 2024
ec51267
Revert "Add option for negative load shedding at e-Mobility buses"
CarlosEpia Nov 13, 2024
e0bee93
Merge branch 'dev' into hybit
CarlosEpia Nov 14, 2024
067768a
Black
CarlosEpia Nov 14, 2024
b3d7b41
Merge branch 'dev' into hybit
CarlosEpia Nov 14, 2024
03e1b59
merge dev
CarlosEpia Apr 10, 2025
d13b941
Adapt solver-options and run etrago for interest_area = Ingolstadt
NormanZielke Apr 29, 2025
1ad0836
Add sensivity - Test for Electrolyser
NormanZielke May 4, 2025
3adfb65
Start to adapt interest generators p_nom_extendable = True
NormanZielke Jun 3, 2025
d8e41dd
Clone solar_rooftop generator in Ingolstadt and set p_nom_extendable …
NormanZielke Jun 4, 2025
3d65384
Clone fossil links and P2H-components in Ingolstadt and set p_nom_ext…
NormanZielke Jun 15, 2025
9b49bb3
Add waste-bus with generator with according links: waste_CHP, waste_C…
NormanZielke Jun 15, 2025
a3d9e38
Add waste_CHP-contstraint with fixed dispatchratio for electricity an…
NormanZielke Jun 21, 2025
df74c15
Adapt installed capacities for in interest area in add_extendable_lin…
NormanZielke Jun 21, 2025
4d206dd
Adapt _fixed_waste_chp_ratio_linopy constraint in constraints.py
NormanZielke Jun 21, 2025
64e4d23
Adapt installed capacities for solar and batteries in Ingolstadt
NormanZielke Jun 21, 2025
5bb261b
Adapt marginal_cost for waste_genererator with current CO2 price 76.5…
NormanZielke Jun 21, 2025
f7ef69b
Adapt inv-parameter in for solar and links in Ingolstadt
NormanZielke Jun 21, 2025
41b4390
Add sensitivity_runner.py for sensitivity analysis
NormanZielke Jun 21, 2025
7d8999c
Adapt capacity_costs for components for base_scenario
NormanZielke Jun 22, 2025
6c3bd5d
Add CH4-sensitivity method
NormanZielke Jun 22, 2025
cd73182
Adapt location of added waste_CHP
NormanZielke Jun 23, 2025
3280876
Adapt capital_cost for H2_techs with pypas-DB
NormanZielke Jun 24, 2025
e285b50
Add extendable options for interest area
NormanZielke Jun 26, 2025
e3dd415
Adapt add_chp_constraints_linopy() for other CHP-techs
NormanZielke Jun 26, 2025
bdd8c43
Add add_extendable_solar_generators_to_interest_area
NormanZielke Jun 27, 2025
8fabc14
Set central_resistive_heater p_nom = 0 and don't add new one.
NormanZielke Jun 27, 2025
1e91866
Set p_nom_max = 1,83 for gas_boil in interest area.
NormanZielke Jun 27, 2025
029b251
set p_nom = p_nom min for installed PV tech in ingolstadt
NormanZielke Jun 28, 2025
5c5b66b
Add run_co2_price_sensitivity()
NormanZielke Jun 28, 2025
d90d496
Add constraint for resistive_heater in interest area for back-up
NormanZielke Jun 29, 2025
f9910c4
Adapt parameters for regional EnergySystem
NormanZielke Jul 5, 2025
d54e58d
Add extendable biomass_boiler to rural_heat_bus in interest_area
NormanZielke Jul 7, 2025
1974d9c
Add function to adjust global capital_cost for optimized components
NormanZielke Jul 8, 2025
b0c7409
Remove add_chp_constraints_linopy to original version
NormanZielke Jul 14, 2025
2878e0c
Add replace_gas_links_with_extendable()
NormanZielke Jul 14, 2025
9f6c942
Adapt effiency of interest biogas CHP
NormanZielke Jul 14, 2025
36871d0
Add new contraints for CHP - dispatch in a fixed ratio
NormanZielke Jul 16, 2025
3645df4
Fix Settings for Base_scenario
NormanZielke Jul 17, 2025
d804c8a
Add new sensitivity-function for rural_heat_pump in sensitivity_runne…
NormanZielke Jul 20, 2025
9b76023
Fix Bugs
NormanZielke Jul 20, 2025
03b5bbb
Add new sensitivity-function for central_heat_store in sensitivity_ru…
NormanZielke Jul 23, 2025
9f4e7bf
Adapt capital_cost of interest CHP-plants
NormanZielke Jul 24, 2025
0c89732
Adapt capital_cost of interest CHP-plants
NormanZielke Jul 28, 2025
b2e3c7d
Set max Solarpotential for interest area
NormanZielke Aug 4, 2025
f350d48
Add method run_modified_base_model_with_biomass_and_solar in sensitiv…
NormanZielke Aug 5, 2025
2bb5930
Add method run_battery_cost_sensitivity in sensitivity_runner.py to c…
NormanZielke Sep 15, 2025
0fa3dd6
Removes functions "add_gas_CHP_fixed" and "add_gas_CHP_extendable" wh…
NormanZielke Sep 30, 2025
1dfba2d
Updates docstrings for new functions in utilities.py and sensitivitie…
NormanZielke Sep 30, 2025
1d954ce
Removes constraint "_add_resistive_heater_vollaststunden_constraint_l…
NormanZielke Oct 7, 2025
ee7823a
Updates docstring of adjust_capital_costs - function in utilities.py
NormanZielke Oct 14, 2025
1c931d4
Merge remote-tracking branch 'origin/features/#800-clustering-with-fo…
NormanZielke Oct 14, 2025
a997e19
Rebases plot.py market_optimization.py and io.py to origin/features/…
NormanZielke Oct 14, 2025
ef7692d
Rebases plot.py market_optimization.py and io.py to origin/features/…
NormanZielke Oct 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 64 additions & 11 deletions etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@
from etrago import Etrago

args = {
"nuts_3_map" : "germany-de-nuts-3-regions.geojson",
# Setup and Configuration:
"db": "egon-data", # database session
"db": "egon-data-wam02", # database session # "egon-data-wam02"
"gridversion": None, # None for model_draft or Version number
"method": { # Choose method and settings for optimization
"type": "lopf", # type of optimization, 'lopf' or 'sclopf'
"n_iter": 4, # abort criterion of iterative optimization, 'n_iter' or 'threshold'
"formulation": "linopy",
"market_optimization":
{
"active": True,
"active": False,
"market_zones": "status_quo", # only used if type='market_grid'
"rolling_horizon": {# Define parameter of market optimization
"planning_horizon": 168, # number of snapshots in each optimization
Expand All @@ -72,19 +73,19 @@
"q_allocation": "p_nom", # allocate reactive power via 'p_nom' or 'p'
},
"start_snapshot": 1,
"end_snapshot": 168,
"end_snapshot": 8760,
"solver": "gurobi", # glpk, cplex or gurobi
"solver_options": {
"BarConvTol": 1.0e-5,
"FeasibilityTol": 1.0e-5,
"BarConvTol": 1.0e-9,
"FeasibilityTol": 1.0e-9,
"method": 2,
"crossover": 0,
"crossover": 1,
"logFile": "solver_etrago.log",
"threads": 4,
"BarHomogeneous": 1,
},
"model_formulation": "kirchhoff", # angles or kirchhoff
"scn_name": "eGon100RE", # scenario: eGon2035, eGon100RE or status2019
"scn_name": "eGon2035", # scenario: eGon2035, eGon100RE or status2019
# Scenario variations:
"scn_extension": None, # None or array of extension scenarios
"scn_decommissioning": None, # None or decommissioning scenario
Expand All @@ -111,16 +112,19 @@
},
},
"generator_noise": 789456, # apply generator noise, False or seed number
"extra_functionality": {}, # Choose function name or {}
"extra_functionality": {
"add_chp_ratio_constraint": {}
}, # Choose function name or {}
# Spatial Complexity:
"delete_dispensable_ac_buses": True, # bool. Find and delete expendable buses
"network_clustering_ehv": {
"active": False, # choose if clustering of HV buses to EHV buses is activated
"busmap": False, # False or path to stored busmap
"CPU_cores": 4, # number of cores used during clustering, "max" for all cores available.
},
"network_clustering": {
"method": {
"focus_region": None, # None, shape-file or list with string for Kreise
"focus_region": ["Ingolstadt"], # None, shape-file or list with string for Kreise
"algorithm": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra
"remove_stubs": False, # remove stubs before kmeans clustering
"use_reduced_coordinates": False, # if True, do not average cluster coordinates in kmeans
Expand All @@ -133,7 +137,7 @@
},
"electricity_grid": {
"active": True, # choose if clustering is activated
"cluster_within_focus": False, # False for no clustering within focus region
"cluster_within_focus": 1, # False for no clustering within focus region
"n_clusters": 30, # total number of resulting AC nodes
"cluster_foreign": False, # take foreign AC buses into account, True or False
"k_elec_busmap": False, # False or path/to/busmap.csv
Expand Down Expand Up @@ -164,7 +168,7 @@
"n_clusters": 5, # number of periods - only relevant for 'typical_periods'
"n_segments": 5, # number of segments - only relevant for segmentation
},
"skip_snapshots": 5, # False or number of snapshots to skip
"skip_snapshots": 3, # False or number of snapshots to skip
"temporal_disaggregation": {
"active": False, # choose if temporally full complex dispatch optimization should be conducted
"no_slices": 8, # number of subproblems optimization is divided into
Expand Down Expand Up @@ -662,6 +666,8 @@ def run_etrago(args, json_path):
"""
etrago = Etrago(args, json_path=json_path)

print(datetime.datetime.now())

# import network from database
etrago.build_network_from_db()

Expand All @@ -681,6 +687,53 @@ def run_etrago(args, json_path):
# skip snapshots
etrago.skip_snapshots()

# set interest components to extendable and add additional components

etrago.print_capital_costs()

etrago.adjust_capital_costs()

etrago.print_capital_costs()

etrago.add_extendable_solar_generators_to_interest_area()

etrago.reset_gas_CHP_capacities()

etrago.replace_gas_links_with_extendable()

etrago.add_biogas_CHP_extendable()

etrago.add_biomass_CHP_extendable()

etrago.add_extendable_heat_pumps_to_interest_area()

etrago.add_waste_CHP_ingolstadt()

#etrago.add_biomass_boiler_extendable()

etrago.set_battery_parameter_interest_area()
#etrago.set_battery_and_heat_store_parameters_interest_area()

etrago.set_cyclic_constraints()

buses_ing = etrago.find_interest_buses()

gens_ing = etrago.network.generators[etrago.network.generators.bus.isin(buses_ing.index)]
gcolumns = ["bus", "carrier", "p_nom", "marginal_cost", "capital_cost", "p_nom_extendable"]

links_ing = etrago.find_links_connected_to_interest_buses()
lcolumns = ["bus0", "bus1", "carrier", "p_nom", "p_nom_extendable", "capital_cost", "marginal_cost"]

with pd.option_context("display.max_columns", None):
print(buses_ing)
print(links_ing[lcolumns])
print(gens_ing[gcolumns])

etrago.network.export_to_netcdf("base_network_Scenario_1f.nc")

#import pdb
#pdb.set_trace()

# start linear optimal powerflow calculations
etrago.optimize()

Expand Down
1 change: 1 addition & 0 deletions etrago/germany-de-nuts-3-regions.geojson

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions etrago/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@
set_random_noise,
set_trafo_costs,
update_busmap,
find_interest_buses,
find_links_connected_to_interest_buses,
add_extendable_solar_generators_to_interest_area,
add_extendable_heat_pumps_to_interest_area,
set_battery_parameter_interest_area,
set_battery_and_heat_store_parameters_interest_area,
add_waste_CHP_ingolstadt,
reset_gas_CHP_capacities,
add_biogas_CHP_extendable,
add_biomass_CHP_extendable,
add_biomass_boiler_extendable,
adjust_capital_costs,
print_capital_costs,
replace_gas_links_with_extendable,
set_cyclic_constraints
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -381,6 +396,36 @@ def __init__(

levelize_abroad_inland_parameters = levelize_abroad_inland_parameters

find_interest_buses = find_interest_buses

find_links_connected_to_interest_buses = find_links_connected_to_interest_buses

add_extendable_solar_generators_to_interest_area = add_extendable_solar_generators_to_interest_area

add_extendable_heat_pumps_to_interest_area = add_extendable_heat_pumps_to_interest_area

set_battery_parameter_interest_area = set_battery_parameter_interest_area

set_battery_and_heat_store_parameters_interest_area = set_battery_and_heat_store_parameters_interest_area

add_waste_CHP_ingolstadt = add_waste_CHP_ingolstadt

reset_gas_CHP_capacities = reset_gas_CHP_capacities

add_biogas_CHP_extendable = add_biogas_CHP_extendable

add_biomass_CHP_extendable = add_biomass_CHP_extendable

add_biomass_boiler_extendable = add_biomass_boiler_extendable

adjust_capital_costs = adjust_capital_costs

print_capital_costs = print_capital_costs

replace_gas_links_with_extendable = replace_gas_links_with_extendable

set_cyclic_constraints = set_cyclic_constraints

def dc_lines(self):
return self.filter_links_by_carrier("DC", like=False)

Expand Down
Loading
Loading