Skip to content

Commit

Permalink
try outs
Browse files Browse the repository at this point in the history
  • Loading branch information
ulfmueller committed Sep 14, 2023
1 parent e502572 commit 218de52
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
20 changes: 10 additions & 10 deletions etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@

args = {
# Setup and Configuration:
"db": "local", # database session
"db": "local2035", # database session
"gridversion": None, # None for model_draft or Version number
"method": { # Choose method and settings for optimization
"type": "market_grid", # type of optimization, currently only 'lopf'
"n_iter": 4, # abort criterion of iterative optimization, 'n_iter' or 'threshold'
"n_iter": 2, # abort criterion of iterative optimization, 'n_iter' or 'threshold'
"pyomo": True, # set if pyomo is used for model building
},
"pf_post_lopf": {
Expand All @@ -63,7 +63,7 @@
"q_allocation": "p_nom", # allocate reactive power via 'p_nom' or 'p'
},
"start_snapshot": 1,
"end_snapshot": 2,
"end_snapshot": 24,
"solver": "gurobi", # glpk, cplex or gurobi
"solver_options": {
"BarConvTol": 1.0e-5,
Expand All @@ -74,13 +74,13 @@
"threads": 4,
},
"model_formulation": "kirchhoff", # angles or kirchhoff
"scn_name": "status2019", # 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
# Export options:
"lpfile": False, # save pyomo's lp file: False or /path/to/lpfile.lp
"csv_export": "results", # save results as csv: False or /path/tofolder
"csv_export": "/home/ulf/Documents/PoWErD/AP2etrago_results/consecutive_100b_3t_2035", # save results as csv: False or /path/tofolder
# Settings:
"extendable": {
"extendable_components": [
Expand All @@ -100,14 +100,14 @@
"grid_max_abs_foreign": None, # absolute capacity per voltage level
},
},
"generator_noise": 123456, # apply generator noise, False or seed number
"generator_noise": 1234567, # apply generator noise, False or seed number
"extra_functionality": {}, # Choose function name or {}
# Spatial Complexity:
"network_clustering_ehv": False, # clustering of HV buses to EHV buses
"network_clustering": {
"active": True, # choose if clustering is activated
"method": "kmeans", # choose clustering method: kmeans or kmedoids-dijkstra
"n_clusters_AC": 100, # total number of resulting AC nodes (DE+foreign)
"n_clusters_AC": 50, # total number of resulting AC nodes (DE+foreign)
"cluster_foreign_AC": False, # take foreign AC buses into account, True or False
"method_gas": "kmeans", # choose clustering method: kmeans or kmedoids-dijkstra
"n_clusters_gas": 14, # total number of resulting CH4 nodes (DE+foreign)
Expand All @@ -122,8 +122,8 @@
"remove_stubs": False, # remove stubs bevore kmeans clustering
"use_reduced_coordinates": False, # If True, do not average cluster coordinates
"random_state": 42, # random state for replicability of clustering results
"n_init": 2, # affects clustering algorithm, only change when neccesary
"max_iter": 10, # affects clustering algorithm, only change when neccesary
"n_init": 4, # affects clustering algorithm, only change when neccesary
"max_iter": 20, # affects clustering algorithm, only change when neccesary
"tol": 1e-6, # affects clustering algorithm, only change when neccesary
"CPU_cores": 2, # number of cores used during clustering, "max" for all cores available.
},
Expand All @@ -148,7 +148,7 @@
"n_clusters": 5, # number of periods - only relevant for 'typical_periods'
"n_segments": 5, # number of segments - only relevant for segmentation
},
"skip_snapshots": False, # 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
5 changes: 4 additions & 1 deletion etrago/execute/grid_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def grid_optimization(self):

logger.info("Start building grid optimization model")
add_redispatch_generators(self)
self.network.generators.drop(self.network.generators[self.network.generators.index.str.contains('ramp')].index, inplace=True)
self.network.links.drop(self.network.links[self.network.links.index.str.contains('ramp')].index, inplace=True)

logger.info("Start solving grid optimization model")
self.network.lopf(
Expand All @@ -51,6 +53,7 @@ def grid_optimization(self):
extra_functionality=extra_functionality(),
formulation=self.args["model_formulation"],
)
self.export_to_csv(self.args["csv_export"])


def add_redispatch_generators(self):
Expand Down Expand Up @@ -253,7 +256,7 @@ def add_redispatch_generators(self):
).values

# just for the current status2019 scenario a quick fix for buses which do not have a connection
self.network.buses.drop(self.network.buses[self.network.buses.index.isin(['47085', '47086', '37865', '37870'])].index, inplace=True)
#self.network.buses.drop(self.network.buses[self.network.buses.index.isin(['47085', '47086', '37865', '37870'])].index, inplace=True)

def extra_functionality():
return None
2 changes: 1 addition & 1 deletion etrago/execute/market_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def build_market_model(self):
#net.buses.loc[net.buses.carrier == 'AC', 'carrier'] = "DC"

# delete following unconnected CH4 buses. why are they there?
net.buses.drop(net.buses[net.buses.index.isin(['37865', '37870'])].index, inplace=True)
#net.buses.drop(net.buses[net.buses.index.isin(['37865', '37870'])].index, inplace=True)

self.market_model = net

Expand Down

0 comments on commit 218de52

Please sign in to comment.