From 28f30360885f6988b50d11071022df410fa10ae1 Mon Sep 17 00:00:00 2001
From: "christoph.von.oy" <christoph.von.oy@rwth-aachen.de>
Date: Tue, 16 Apr 2024 11:18:08 +0200
Subject: [PATCH] Removed xx_main files

---
 Model_Library                      |  2 +-
 Tooling                            |  2 +-
 examples/BusChargingDepot/runme.py | 54 +++++++++-----------
 examples/BusChargingHPC/runme.py   | 66 ++++++++++++-------------
 examples/BusChargingIMC/runme.py   | 70 ++++++++++++--------------
 examples/aggregation/runme.py      | 26 ++++------
 examples/complex_prosumer/runme.py | 42 ++++++----------
 examples/district/runme.py         | 79 +++++++++---------------------
 examples/simple_prosumer/runme.py  | 30 ++++--------
 9 files changed, 144 insertions(+), 227 deletions(-)

diff --git a/Model_Library b/Model_Library
index 5432852aff..e81644a46e 160000
--- a/Model_Library
+++ b/Model_Library
@@ -1 +1 @@
-Subproject commit 5432852affd9514efc9f7a7da2fe20172246ec76
+Subproject commit e81644a46e73d1a7148f9c4ab8c95b44b25545fb
diff --git a/Tooling b/Tooling
index a0b6708198..bd54324c0c 160000
--- a/Tooling
+++ b/Tooling
@@ -1 +1 @@
-Subproject commit a0b6708198ed62b897e64be62737b63053a940e7
+Subproject commit bd54324c0c2234a9633dab2ea5fdb7592bcc2feb
diff --git a/examples/BusChargingDepot/runme.py b/examples/BusChargingDepot/runme.py
index 82fafbb481..392006b942 100644
--- a/examples/BusChargingDepot/runme.py
+++ b/examples/BusChargingDepot/runme.py
@@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.Prosumer.main import ProsumerMain
 from Model_Library.dynamics import TrivialDynamic
+from Model_Library.Prosumer.model import Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -45,36 +45,30 @@ input_profile_dict = {
 
 input_profiles = process_input_profiles(input_profile_dict, t_start, dynamic)
 
-prosumer_paths = {"LaTreille": "depot.json"}
+with open("depot.json") as f:
+    prosumer_json = json.load(f)
 
-prosumer_dict = dict()
-for prosumer_name, prosumer_path in prosumer_paths.items():
-    with open(prosumer_path) as f:
-        prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
+prosumer_json["components"]["bus_1_consumption"]["consumption"] = input_profiles[
+    "bus_1_demand"
+]
+prosumer_json["components"]["bus_2_consumption"]["consumption"] = input_profiles[
+    "bus_2_demand"
+]
+prosumer_json["components"]["bus_1_generation"]["generation"] = input_profiles[
+    "bus_1_recuperation"
+]
+prosumer_json["components"]["bus_2_generation"]["generation"] = input_profiles[
+    "bus_2_recuperation"
+]
+prosumer_json["additional_model_logic"]["charger_1_enable"]["enable"] = input_profiles[
+    "bus_1_connected"
+].values
+prosumer_json["additional_model_logic"]["charger_2_enable"]["enable"] = input_profiles[
+    "bus_2_connected"
+].values
 
-prosumer_dict["LaTreille"]["components"]["bus_1_consumption"][
-    "consumption"
-] = input_profiles["bus_1_demand"]
-prosumer_dict["LaTreille"]["components"]["bus_2_consumption"][
-    "consumption"
-] = input_profiles["bus_2_demand"]
-prosumer_dict["LaTreille"]["components"]["bus_1_generation"][
-    "generation"
-] = input_profiles["bus_1_recuperation"]
-prosumer_dict["LaTreille"]["components"]["bus_2_generation"][
-    "generation"
-] = input_profiles["bus_2_recuperation"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["charger_1_enable"][
-    "enable"
-] = input_profiles["bus_1_connected"].values
-prosumer_dict["LaTreille"]["additional_model_logic"]["charger_2_enable"][
-    "enable"
-] = input_profiles["bus_2_connected"].values
+prosumer = Prosumer("LaTrielle", prosumer_json, dynamic)
 
-prosumer_main = ProsumerMain(prosumer_dict, dynamic)
+prosumer.optimize_sizing("sized", ["annuity", "peak_power_costs"])
 
-prosumer_sizing_strategy = ["annuity", "peak_power_costs"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
-
-prosumer_main.save_results()
+prosumer.save_results("output_files")
diff --git a/examples/BusChargingHPC/runme.py b/examples/BusChargingHPC/runme.py
index 1636365ce2..9fa4feb7da 100644
--- a/examples/BusChargingHPC/runme.py
+++ b/examples/BusChargingHPC/runme.py
@@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.Prosumer.main import ProsumerMain
 from Model_Library.dynamics import TrivialDynamic
+from Model_Library.Prosumer.model import Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -45,54 +45,48 @@ input_profile_dict = {
 
 input_profiles = process_input_profiles(input_profile_dict, t_start, dynamic)
 
-prosumer_paths = {"LaTreille": "HPC.json"}
+with open("HPC.json") as f:
+    prosumer_json = json.load(f)
 
-prosumer_dict = dict()
-for prosumer_name, prosumer_path in prosumer_paths.items():
-    with open(prosumer_path) as f:
-        prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
-
-prosumer_dict["LaTreille"]["components"]["bus_1_consumption"][
-    "consumption"
-] = input_profiles["bus_1_demand"]
-prosumer_dict["LaTreille"]["components"]["bus_2_consumption"][
-    "consumption"
-] = input_profiles["bus_2_demand"]
-prosumer_dict["LaTreille"]["components"]["bus_1_generation"][
-    "generation"
-] = input_profiles["bus_1_recuperation"]
-prosumer_dict["LaTreille"]["components"]["bus_2_generation"][
-    "generation"
-] = input_profiles["bus_2_recuperation"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["charger_1_enable"][
-    "enable"
-] = input_profiles["bus_1_connected"].values.loc[:, "Connected to depot"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["charger_2_enable"][
-    "enable"
-] = input_profiles["bus_2_connected"].values.loc[:, "Connected to depot"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["HPC_1_bus_1_enable"][
+prosumer_json["components"]["bus_1_consumption"]["consumption"] = input_profiles[
+    "bus_1_demand"
+]
+prosumer_json["components"]["bus_2_consumption"]["consumption"] = input_profiles[
+    "bus_2_demand"
+]
+prosumer_json["components"]["bus_1_generation"]["generation"] = input_profiles[
+    "bus_1_recuperation"
+]
+prosumer_json["components"]["bus_2_generation"]["generation"] = input_profiles[
+    "bus_2_recuperation"
+]
+prosumer_json["additional_model_logic"]["charger_1_enable"]["enable"] = input_profiles[
+    "bus_1_connected"
+].values.loc[:, "Connected to depot"]
+prosumer_json["additional_model_logic"]["charger_2_enable"]["enable"] = input_profiles[
+    "bus_2_connected"
+].values.loc[:, "Connected to depot"]
+prosumer_json["additional_model_logic"]["HPC_1_bus_1_enable"][
     "enable"
 ] = input_profiles["bus_1_connected"].values.loc[:, "Connected to HPC 1"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["HPC_1_bus_2_enable"][
+prosumer_json["additional_model_logic"]["HPC_1_bus_2_enable"][
     "enable"
 ] = input_profiles["bus_1_connected"].values.loc[:, "Connected to HPC 2"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["HPC_2_bus_1_enable"][
+prosumer_json["additional_model_logic"]["HPC_2_bus_1_enable"][
     "enable"
 ] = input_profiles["bus_1_connected"].values.loc[:, "Connected to HPC 3"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["HPC_2_bus_2_enable"][
+prosumer_json["additional_model_logic"]["HPC_2_bus_2_enable"][
     "enable"
 ] = input_profiles["bus_2_connected"].values.loc[:, "Connected to HPC 1"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["HPC_3_bus_1_enable"][
+prosumer_json["additional_model_logic"]["HPC_3_bus_1_enable"][
     "enable"
 ] = input_profiles["bus_2_connected"].values.loc[:, "Connected to HPC 2"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["HPC_3_bus_2_enable"][
+prosumer_json["additional_model_logic"]["HPC_3_bus_2_enable"][
     "enable"
 ] = input_profiles["bus_2_connected"].values.loc[:, "Connected to HPC 3"]
 
-prosumer_main = ProsumerMain(prosumer_dict, dynamic)
+prosumer = Prosumer("LaTreille", prosumer_json, dynamic)
 
-prosumer_sizing_strategy = ["annuity", "peak_power_costs"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
+prosumer.optimize_sizing("sized", ["annuity", "peak_power_costs"])
 
-prosumer_main.save_results()
+prosumer.save_results("output_files")
diff --git a/examples/BusChargingIMC/runme.py b/examples/BusChargingIMC/runme.py
index c42d25390a..501a02b7d3 100644
--- a/examples/BusChargingIMC/runme.py
+++ b/examples/BusChargingIMC/runme.py
@@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.Prosumer.main import ProsumerMain
 from Model_Library.dynamics import TrivialDynamic
+from Model_Library.Prosumer.model import Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -45,62 +45,52 @@ input_profile_dict = {
 
 input_profiles = process_input_profiles(input_profile_dict, t_start, dynamic)
 
-prosumer_paths = {"LaTreille": "IMC.json"}
+with open("IMC.json") as f:
+    prosumer_json = json.load(f)
 
-prosumer_dict = dict()
-for prosumer_name, prosumer_path in prosumer_paths.items():
-    with open(prosumer_path) as f:
-        prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
-
-prosumer_dict["LaTreille"]["components"]["bus_1_consumption"][
-    "consumption"
-] = input_profiles["bus_1_demand"]
-prosumer_dict["LaTreille"]["components"]["bus_2_consumption"][
-    "consumption"
-] = input_profiles["bus_2_demand"]
-prosumer_dict["LaTreille"]["components"]["bus_1_generation"][
-    "generation"
-] = input_profiles["bus_1_recuperation"]
-prosumer_dict["LaTreille"]["components"]["bus_2_generation"][
-    "generation"
-] = input_profiles["bus_2_recuperation"]
-prosumer_dict["LaTreille"]["additional_model_logic"]["bus_1_connected"][
-    "enable"
-] = input_profiles["bus_1_connected"].values
-prosumer_dict["LaTreille"]["additional_model_logic"]["bus_2_connected"][
-    "enable"
-] = input_profiles["bus_2_connected"].values
+prosumer_json["components"]["bus_1_consumption"]["consumption"] = input_profiles[
+    "bus_1_demand"
+]
+prosumer_json["components"]["bus_2_consumption"]["consumption"] = input_profiles[
+    "bus_2_demand"
+]
+prosumer_json["components"]["bus_1_generation"]["generation"] = input_profiles[
+    "bus_1_recuperation"
+]
+prosumer_json["components"]["bus_2_generation"]["generation"] = input_profiles[
+    "bus_2_recuperation"
+]
+prosumer_json["additional_model_logic"]["bus_1_connected"]["enable"] = input_profiles[
+    "bus_1_connected"
+].values
+prosumer_json["additional_model_logic"]["bus_2_connected"]["enable"] = input_profiles[
+    "bus_2_connected"
+].values
 max_driving_consumpion = max(
     max(input_profiles["bus_1_demand"].values),
     max(input_profiles["bus_1_demand"].values),
 )
-with open(
-    prosumer_dict["LaTreille"]["components"]["bus_1_motor_inverter"]["model"]
-) as f:
+with open(prosumer_json["components"]["bus_1_motor_inverter"]["model"]) as f:
     inverter_1_efficiency = json.load(f)["efficiency"]
 bus_1_moter_inverter_capacity = max_driving_consumpion / inverter_1_efficiency
-prosumer_dict["LaTreille"]["components"]["bus_1_motor_inverter"][
+prosumer_json["components"]["bus_1_motor_inverter"][
     "min_capacity"
 ] = bus_1_moter_inverter_capacity
-prosumer_dict["LaTreille"]["components"]["bus_1_motor_inverter"][
+prosumer_json["components"]["bus_1_motor_inverter"][
     "max_capacity"
 ] = bus_1_moter_inverter_capacity
-with open(
-    prosumer_dict["LaTreille"]["components"]["bus_2_motor_inverter"]["model"]
-) as f:
+with open(prosumer_json["components"]["bus_2_motor_inverter"]["model"]) as f:
     inverter_2_efficiency = json.load(f)["efficiency"]
 bus_2_moter_inverter_capacity = max_driving_consumpion / inverter_2_efficiency
-prosumer_dict["LaTreille"]["components"]["bus_2_motor_inverter"][
+prosumer_json["components"]["bus_2_motor_inverter"][
     "min_capacity"
 ] = bus_2_moter_inverter_capacity
-prosumer_dict["LaTreille"]["components"]["bus_2_motor_inverter"][
+prosumer_json["components"]["bus_2_motor_inverter"][
     "max_capacity"
 ] = bus_2_moter_inverter_capacity
 
-prosumer_main = ProsumerMain(prosumer_dict, dynamic)
+prosumer = Prosumer("LaTreille", prosumer_json, dynamic)
 
-prosumer_sizing_strategy = ["annuity", "peak_power_costs"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
+prosumer.optimize_sizing("sized", ["annuity", "peak_power_costs"])
 
-prosumer_main.save_results()
+prosumer.save_results("output_files")
diff --git a/examples/aggregation/runme.py b/examples/aggregation/runme.py
index 020c7aec70..e17c7d2d9f 100644
--- a/examples/aggregation/runme.py
+++ b/examples/aggregation/runme.py
@@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.Prosumer.main import ProsumerMain
 from Model_Library.dynamics import AggregatedDynamic, Profile, TrivialDynamic
+from Model_Library.Prosumer.model import Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -101,23 +101,15 @@ aggregated_electric_demand = Profile(
     {0: electric_demand_1, 1: electric_demand_2}, aggregated_dynamic
 )
 
-prosumer_paths = {"my_prosumer": "prosumer.json"}
+with open("prosumer.json") as f:
+    prosumer_json = json.load(f)
 
-prosumer_dict = dict()
-for prosumer_name, prosumer_path in prosumer_paths.items():
-    with open(prosumer_path) as f:
-        prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
+prosumer_json["components"]["pv"]["irradiance"] = aggregated_irradiance
+prosumer_json["components"]["pv"]["temperature"] = aggregated_temperature
+prosumer_json["components"]["consumption"]["consumption"] = aggregated_electric_demand
 
-prosumer_dict["my_prosumer"]["components"]["pv"]["irradiance"] = aggregated_irradiance
-prosumer_dict["my_prosumer"]["components"]["pv"]["temperature"] = aggregated_temperature
-prosumer_dict["my_prosumer"]["components"]["consumption"][
-    "consumption"
-] = aggregated_electric_demand
+prosumer = Prosumer("my_prosumer", prosumer_json, aggregated_dynamic)
 
-prosumer_main = ProsumerMain(prosumer_dict, aggregated_dynamic)
+prosumer.optimize_sizing("sized", ["annuity"])
 
-prosumer_sizing_strategy = ["annuity"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
-
-prosumer_main.save_results()
+prosumer.save_results("output_files")
diff --git a/examples/complex_prosumer/runme.py b/examples/complex_prosumer/runme.py
index a28df32af5..0a9bcaa316 100644
--- a/examples/complex_prosumer/runme.py
+++ b/examples/complex_prosumer/runme.py
@@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.Prosumer.main import ProsumerMain
 from Model_Library.dynamics import TrivialDynamic
+from Model_Library.Prosumer.model import Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -50,36 +50,24 @@ input_profile_dict = {
 
 input_profiles = process_input_profiles(input_profile_dict, t_start, dynamic)
 
-prosumer_paths = {"my_prosumer": "prosumer.json"}
+with open("prosumer.json") as f:
+    prosumer_json = json.load(f)
 
-prosumer_dict = dict()
-for prosumer_name, prosumer_path in prosumer_paths.items():
-    with open(prosumer_path) as f:
-        prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
-
-prosumer_dict["my_prosumer"]["components"]["pv"]["irradiance"] = input_profiles[
-    "irradiance"
+prosumer_json["components"]["pv"]["irradiance"] = input_profiles["irradiance"]
+prosumer_json["components"]["pv"]["temperature"] = input_profiles["temperature"]
+prosumer_json["components"]["electric_consumption"]["consumption"] = input_profiles[
+    "electric_demand"
 ]
-prosumer_dict["my_prosumer"]["components"]["pv"]["temperature"] = input_profiles[
-    "temperature"
+prosumer_json["components"]["heat_pump"]["temperature"] = input_profiles["temperature"]
+prosumer_json["components"]["heat_consumption"]["consumption"] = input_profiles[
+    "heat_demand"
 ]
-prosumer_dict["my_prosumer"]["components"]["electric_consumption"][
-    "consumption"
-] = input_profiles["electric_demand"]
-prosumer_dict["my_prosumer"]["components"]["heat_pump"]["temperature"] = input_profiles[
-    "temperature"
+prosumer_json["components"]["hot_water_consumption"]["consumption"] = input_profiles[
+    "hot_water_demand"
 ]
-prosumer_dict["my_prosumer"]["components"]["heat_consumption"][
-    "consumption"
-] = input_profiles["heat_demand"]
-prosumer_dict["my_prosumer"]["components"]["hot_water_consumption"][
-    "consumption"
-] = input_profiles["hot_water_demand"]
 
-prosumer_main = ProsumerMain(prosumer_dict, dynamic)
+prosumer = Prosumer("my_prosumer", prosumer_json, dynamic)
 
-prosumer_sizing_strategy = ["annuity"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
+prosumer.optimize_sizing("sized", ["annuity"])
 
-prosumer_main.save_results()
+prosumer.save_results("output_files")
diff --git a/examples/district/runme.py b/examples/district/runme.py
index 9b9fd477a1..deadd8a527 100644
--- a/examples/district/runme.py
+++ b/examples/district/runme.py
@@ -22,9 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.District.main import DistrictMain
-from Model_Library.Prosumer.main import DistrictAssetMain, ProsumerMain
+from Model_Library.District.model import District
 from Model_Library.dynamics import TrivialDynamic
+from Model_Library.Prosumer.model import DistrictAsset, Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -49,72 +49,41 @@ prosumer_paths = {
     "my_prosumer_2": "prosumer_2.json",
 }
 
-prosumer_dict = dict()
+prosumers = dict()
 for prosumer_name, prosumer_path in prosumer_paths.items():
     with open(prosumer_path) as f:
         prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
 
-prosumer_dict["my_prosumer_1"]["components"]["pv"]["irradiance"] = input_profiles[
-    "irradiance"
-]
-prosumer_dict["my_prosumer_1"]["components"]["pv"]["temperature"] = input_profiles[
-    "temperature"
-]
-prosumer_dict["my_prosumer_1"]["components"]["consumption"][
-    "consumption"
-] = input_profiles["electric_demand"]
-prosumer_dict["my_prosumer_2"]["components"]["pv"]["irradiance"] = input_profiles[
-    "irradiance"
-]
-prosumer_dict["my_prosumer_2"]["components"]["pv"]["temperature"] = input_profiles[
-    "temperature"
-]
-prosumer_dict["my_prosumer_2"]["components"]["consumption"][
-    "consumption"
-] = input_profiles["electric_demand"]
-
-prosumer_main = ProsumerMain(prosumer_dict, dynamic)
-
-prosumer_sizing_strategy = ["annuity"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
+    prosumer_json["components"]["pv"]["irradiance"] = input_profiles["irradiance"]
+    prosumer_json["components"]["pv"]["temperature"] = input_profiles["temperature"]
+    prosumer_json["components"]["consumption"]["consumption"] = input_profiles[
+        "electric_demand"
+    ]
 
-prosumer_main.save_results()
+    prosumers[prosumer_name] = Prosumer(prosumer_name, prosumer_json, dynamic)
 
-prosumers = prosumer_main.prosumers
+for prosumer_name, prosumer in prosumers.items():
+    prosumer.optimize_sizing("sized", ["annuity"])
 
-district_asset_paths = {"my_asset": "asset.json"}
+    prosumer.save_results("output_files")
 
-district_asset_dict = dict()
-for district_asset_name, district_asset_path in district_asset_paths.items():
-    with open(district_asset_path) as f:
-        district_asset_json = json.load(f)
-    district_asset_dict[district_asset_name] = district_asset_json
+with open("asset.json") as f:
+    district_asset_json = json.load(f)
 
-district_assets = DistrictAssetMain(district_asset_dict, dynamic).district_assets
+district_asset = DistrictAsset("my_asset", district_asset_json, dynamic)
 
-district_assets = main_prosumer.DistrictAssetMain(
-    district_asset_dict, dynamic
-).district_assets
+with open("district.json") as f:
+    district_json = json.load(f)
 
-district_paths = {"my_district": "district.json"}
-
-district_dict = dict()
-for district_name, district_path in district_paths.items():
-    with open(district_path) as f:
-        district_json = json.load(f)
-    district_dict[district_name] = district_json
-
-district_dict["my_district"]["components"]["grid"]["price"] = input_profiles[
-    "electricity_price"
-]
-district_dict["my_district"]["components"]["grid"]["injection_price"] = input_profiles[
+district_json["components"]["grid"]["price"] = input_profiles["electricity_price"]
+district_json["components"]["grid"]["injection_price"] = input_profiles[
     "electricity_price"
 ]
 
-district_main = DistrictMain(district_dict, prosumers, district_assets, dynamic)
+district = District(
+    "my_district", district_json, prosumers, {"my_asset": district_asset}, dynamic
+)
 
-district_sizing_strategy = ["annuity"]
-district_main.optimize_sizing("sized", district_sizing_strategy)
+district.optimize_sizing("sized", ["annuity"])
 
-district_main.save_results()
+district.save_results("output_files")
diff --git a/examples/simple_prosumer/runme.py b/examples/simple_prosumer/runme.py
index 71f57439f2..556a1f70d5 100644
--- a/examples/simple_prosumer/runme.py
+++ b/examples/simple_prosumer/runme.py
@@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 """
 
-from Model_Library.Prosumer.main import ProsumerMain
 from Model_Library.dynamics import TrivialDynamic
+from Model_Library.Prosumer.model import Prosumer
 from Tooling.input_profile_processor.input_profile_processor import (
     process_input_profiles,
 )
@@ -42,27 +42,17 @@ input_profile_dict = {
 
 input_profiles = process_input_profiles(input_profile_dict, t_start, dynamic)
 
-prosumer_paths = {"my_prosumer": "prosumer.json"}
+with open("prosumer.json") as f:
+    prosumer_json = json.load(f)
 
-prosumer_dict = dict()
-for prosumer_name, prosumer_path in prosumer_paths.items():
-    with open(prosumer_path) as f:
-        prosumer_json = json.load(f)
-    prosumer_dict[prosumer_name] = prosumer_json
-
-prosumer_dict["my_prosumer"]["components"]["pv"]["irradiance"] = input_profiles[
-    "irradiance"
-]
-prosumer_dict["my_prosumer"]["components"]["pv"]["temperature"] = input_profiles[
-    "temperature"
+prosumer_json["components"]["pv"]["irradiance"] = input_profiles["irradiance"]
+prosumer_json["components"]["pv"]["temperature"] = input_profiles["temperature"]
+prosumer_json["components"]["consumption"]["consumption"] = input_profiles[
+    "electric_demand"
 ]
-prosumer_dict["my_prosumer"]["components"]["consumption"][
-    "consumption"
-] = input_profiles["electric_demand"]
 
-prosumer_main = ProsumerMain(prosumer_dict, dynamic)
+prosumer = Prosumer("my_prosumer", prosumer_json, dynamic)
 
-prosumer_sizing_strategy = ["annuity"]
-prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
+prosumer.optimize_sizing("sized", ["annuity"])
 
-prosumer_main.save_results()
+prosumer.save_results("output_files")
-- 
GitLab