From 218de52d89d718e976cea173e922869d5091a5d0 Mon Sep 17 00:00:00 2001 From: ulfmueller Date: Thu, 14 Sep 2023 11:19:49 +0200 Subject: [PATCH] try outs --- etrago/appl.py | 20 ++++++++++---------- etrago/execute/grid_optimization.py | 5 ++++- etrago/execute/market_optimization.py | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/etrago/appl.py b/etrago/appl.py index 66045ecc..e5dfbec6 100644 --- a/etrago/appl.py +++ b/etrago/appl.py @@ -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": { @@ -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, @@ -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": [ @@ -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) @@ -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. }, @@ -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 diff --git a/etrago/execute/grid_optimization.py b/etrago/execute/grid_optimization.py index db66a104..dbd332de 100644 --- a/etrago/execute/grid_optimization.py +++ b/etrago/execute/grid_optimization.py @@ -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( @@ -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): @@ -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 diff --git a/etrago/execute/market_optimization.py b/etrago/execute/market_optimization.py index 5f30cb21..250123e6 100644 --- a/etrago/execute/market_optimization.py +++ b/etrago/execute/market_optimization.py @@ -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