From eb1047e027ddc6c28d22d0cda5f1cd9c93e8b63e Mon Sep 17 00:00:00 2001
From: "christoph.von.oy" <christoph.von.oy@rwth-aachen.de>
Date: Mon, 30 Jan 2023 15:28:39 +0100
Subject: [PATCH] Unified interfaces

Unified interfaces between the main classes and thier entitiy classes
Unified interfaces between runme and the main classes
Made Main manage all prosumers instead of one at a time
Removed process_each_prosumer() from runme
---
 Model_Library |  2 +-
 runme.py      | 38 ++++++++++++++------------------------
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/Model_Library b/Model_Library
index d914920165..3519ec06ea 160000
--- a/Model_Library
+++ b/Model_Library
@@ -1 +1 @@
-Subproject commit d914920165330f710c732de4417c29db7bd067b8
+Subproject commit 3519ec06eade34bf29da5f46877a3c7057e56edc
diff --git a/runme.py b/runme.py
index 57013171a8..d09da16fd3 100644
--- a/runme.py
+++ b/runme.py
@@ -9,20 +9,6 @@ class SimulationScope(Enum):
     PROSUMER = 1
     COMMUNITY = 2
 
-def process_each_prosumer(prosumer_name, prosumer_specification, input_profiles, t_horizon, t_step, prosumer_strategy):
-    start_time = time.time()
-    prosumer = main.Main(prosumer_name, prosumer_specification, input_profiles, t_horizon, t_step)
-    after_setup_time = time.time()
-    print("process_each_prosumer:\tProsumer Construction [s]: \t" + str(after_setup_time - start_time))
-
-    prosumer.run_optimization(prosumer_strategy)
-    after_optimization_time = time.time()
-    print("process_each_prosumer:\tProsumer Optimization [s]: \t" + str(after_optimization_time - after_setup_time))
-
-    prosumer.show_results()
-
-    return prosumer.prosumer
-
 start_time = time.time()
 simulation_scope = SimulationScope.COMMUNITY
 t_start = pd.Timestamp("2019-05-10 00:00:00") # start time of simulation
@@ -50,16 +36,16 @@ input_profiles = Tooling.input_profile_processor.input_profile_processor.process
 after_input_processing_time = time.time()
 print("runme:\t\t\tProfile Processing [s]: \t" + str(after_input_processing_time - start_time))
 
-# 'topology_path': path to directory that contains the matrices that define the prosumer topology
 # 'config_path': path to global configurations like prices, injection prices, emission costs, etc.
-prosumer_dict = {'SCN2_CAT1_PV11_3000_6000':{'topology_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11',
-                                             'config_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11/config.csv',
+# 'topology_path': path to directory that contains the matrices that define the prosumer topology
+prosumer_dict = {'SCN2_CAT1_PV11_3000_6000':{'config_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11/config.csv',
+                                             'topology_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11',
                                              'profiles': {'pv_roof': ('irradiance_1', 'temperature_1'),
                                                           'elec_cns': 'demand_electric_1',
                                                           'therm_cns': 'demand_heat_1',
                                                           'dhw_dmd': 'demand_hot_water_1'}},
-                 'SCN0_CAT1_3000_6000': {'topology_path': 'input_files/models/prosumer_models/SCN0_CAT1',
-                                         'config_path': 'input_files/models/prosumer_models/SCN0_CAT1/config.csv',
+                 'SCN0_CAT1_3000_6000': {'config_path': 'input_files/models/prosumer_models/SCN0_CAT1/config.csv',
+                                         'topology_path': 'input_files/models/prosumer_models/SCN0_CAT1',
                                          'profiles': {'elec_cns': 'demand_electric_2',
                                                       'therm_cns': 'demand_heat_2',
                                                       'dhw_dmd': 'demand_hot_water_2'}},}
@@ -68,9 +54,13 @@ prosumer_strategy = 'annuity'
 before_optimization_time = time.time()
 print("runme:\t\t\tProsumer Setup [s]: \t\t" + str(before_optimization_time - after_input_processing_time))
 
-prosumers = dict()
-for prosumer_name in prosumer_dict:
-    prosumers[prosumer_name] = process_each_prosumer(prosumer_name, prosumer_dict[prosumer_name], input_profiles, t_horizon, t_step, prosumer_strategy)
+prosumer_main = main.Main(prosumer_dict, input_profiles, t_horizon, t_step)
+
+prosumer_main.run_optimization(prosumer_strategy)
+
+prosumer_main.show_results()
+
+prosumers = prosumer_main.prosumers
 after_optimization_time = time.time()
 print("runme:\t\t\tProsumer Optimization [s]: \t" + str(after_optimization_time - before_optimization_time))
 
@@ -78,8 +68,8 @@ if simulation_scope == SimulationScope.PROSUMER:
     exit()
 
 start_community_time = time.time()
-community_assets_dict = {'ca_bat': {'topology_path': 'input_files/models/district_models/example_CA',
-                                    'config_path': 'input_files/models/district_models/example_CA/config.csv',
+community_assets_dict = {'ca_bat': {'config_path': 'input_files/models/district_models/example_CA/config.csv',
+                                    'topology_path': 'input_files/models/district_models/example_CA',
                                     'profiles': {'elec_cns_ca_bat': 'demand_electric_3'}}}
 
 community_assets_strategy = 'sizing_max_operational_profit'
-- 
GitLab