diff --git a/Model_Library b/Model_Library index c66637237aaac95a0ada31ca9822894af6944748..0edf03c25862fc9ce6ed02994ea803ea38057e83 160000 --- a/Model_Library +++ b/Model_Library @@ -1 +1 @@ -Subproject commit c66637237aaac95a0ada31ca9822894af6944748 +Subproject commit 0edf03c25862fc9ce6ed02994ea803ea38057e83 diff --git a/examples/BusChargingDepot/runme.py b/examples/BusChargingDepot/runme.py index 813eb0f7aeab1b6a80020301f44d45144a675994..d9cb8ffb8c44c7890a9ffdc3e9e365db77373d2e 100644 --- a/examples/BusChargingDepot/runme.py +++ b/examples/BusChargingDepot/runme.py @@ -22,14 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import Profile, TrivialArchitecture, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.dynamics import DynamicTree from Model_Library.topology import Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(24 * 60 - 1, 60, dtype=int)) -input_profiles = Profile.from_csv("data.csv", dynamic) +architecture = Architecture(DynamicTree(np.full(24 * 60 - 1, 60, dtype=int)).root()) + +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("")) with open("depot.json") as f: prosumer_json = json.load(f) @@ -55,6 +57,6 @@ prosumer_json["additional_model_logic"]["charger_2_enable"]["enable"] = input_pr prosumer = Prosumer("LaTrielle", prosumer_json) -prosumer.optimize("sized", TrivialArchitecture(dynamic), ["annuity", "peak_power_cost"]) +prosumer.optimize("sized", architecture, {}, ["annuity", "peak_power_cost"], {}) prosumer.save_results("output_files") diff --git a/examples/BusChargingHPC/runme.py b/examples/BusChargingHPC/runme.py index 1bd36ceb6ea9fbce9c3b383839939b04317df5b2..b9e2ceee25ffbae12b9267505e8037cc3b92fb66 100644 --- a/examples/BusChargingHPC/runme.py +++ b/examples/BusChargingHPC/runme.py @@ -22,14 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import Profile, TrivialArchitecture, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.dynamics import DynamicTree from Model_Library.topology import Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(24 * 60 - 1, 60, dtype=int)) -input_profiles = Profile.from_csv("data.csv", dynamic) +architecture = Architecture(DynamicTree(np.full(24 * 60 - 1, 60, dtype=int)).root()) + +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("")) with open("HPC.json") as f: prosumer_json = json.load(f) @@ -73,6 +75,6 @@ prosumer_json["additional_model_logic"]["HPC_3_bus_2_enable"][ prosumer = Prosumer("LaTreille", prosumer_json) -prosumer.optimize("sized", TrivialArchitecture(dynamic), ["annuity", "peak_power_cost"]) +prosumer.optimize("sized", architecture, {}, ["annuity", "peak_power_cost"], {}) prosumer.save_results("output_files") diff --git a/examples/BusChargingIMC/runme.py b/examples/BusChargingIMC/runme.py index 12b3557e159f61bffa13ac30d310dea5c4bb9904..8685dcc5419f620e3d0f3a40e1fc209a59cb0776 100644 --- a/examples/BusChargingIMC/runme.py +++ b/examples/BusChargingIMC/runme.py @@ -22,14 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import Profile, TrivialArchitecture, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.dynamics import DynamicTree from Model_Library.topology import Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(24 * 60 - 1, 60, dtype=int)) -input_profiles = Profile.from_csv("data.csv", dynamic) +architecture = Architecture(DynamicTree(np.full(24 * 60 - 1, 60, dtype=int)).root()) + +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("")) with open("IMC.json") as f: prosumer_json = json.load(f) @@ -77,6 +79,6 @@ prosumer_json["components"]["bus_2_motor_inverter"][ prosumer = Prosumer("LaTreille", prosumer_json) -prosumer.optimize("sized", TrivialArchitecture(dynamic), ["annuity", "peak_power_cost"]) +prosumer.optimize("sized", architecture, {}, ["annuity", "peak_power_cost"], {}) prosumer.save_results("output_files") diff --git a/examples/aggregation/runme.py b/examples/aggregation/runme.py index 035f9d85572198cd865f668ebb025cb63d58893f..2b0094b887a641ac9f2bfb5ab96b308b3cc0f687 100644 --- a/examples/aggregation/runme.py +++ b/examples/aggregation/runme.py @@ -22,29 +22,44 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import PeriodAggregation, Profile, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.component.core import ComponentPart +from Model_Library.dynamics import DynamicTree from Model_Library.topology import Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(240, 3600, dtype=int)) -architecture = PeriodAggregation( - dynamic, [[12, 1, 11], [7, 8, 9]], [0, 0, 1, 1, 0, 1, 0, 1, 1, 0] +architecture = Architecture(DynamicTree(np.full(240, 3600, dtype=int)).root()) +architecture.root.add_period_aggregation( + [[12 * 3600, 1 * 3600, 11 * 3600], [7 * 3600, 8 * 3600, 9 * 3600]], + [0, 0, 1, 1, 0, 1, 0, 1, 1, 0], ) -profiles = Profile.from_csv("data.csv", architecture.value_dynamic) + +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("a_0(,)")) with open("prosumer.json") as f: prosumer_json = json.load(f) -prosumer_json["components"]["pv"]["irradiance"] = profiles["irradiance"] -prosumer_json["components"]["pv"]["temperature"] = profiles["temperature"] -prosumer_json["components"]["consumption"]["consumption"] = profiles[ +prosumer_json["components"]["pv"]["irradiance"] = input_profiles["irradiance"] +prosumer_json["components"]["pv"]["temperature"] = input_profiles["temperature"] +prosumer_json["components"]["consumption"]["consumption"] = input_profiles[ "electricity_demand" ] prosumer = Prosumer("my_prosumer", prosumer_json) -prosumer.optimize("sized", architecture, ["annuity"]) +prosumer.optimize( + "sized", + architecture, + { + ("pv", ComponentPart.NONE_STATE): "a_0(,)", + ("inverter_pv", ComponentPart.NONE_STATE): "a_0(,)", + ("grid", ComponentPart.NONE_STATE): "a_0(,)", + ("consumptiopn", ComponentPart.NONE_STATE): "a_0(,)", + }, + ["annuity"], + {}, +) prosumer.save_results("output_files") diff --git a/examples/complex_prosumer/runme.py b/examples/complex_prosumer/runme.py index 28d48699e645c99a3b65b5c5a019aa3d759c7d92..e2df0355a17aba7b449638375fd6fefe1089b419 100644 --- a/examples/complex_prosumer/runme.py +++ b/examples/complex_prosumer/runme.py @@ -22,14 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import Profile, TrivialArchitecture, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.dynamics import DynamicTree from Model_Library.topology import Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(24, 3600, dtype=int)) -input_profiles = Profile.from_csv("data.csv", dynamic) +architecture = Architecture(DynamicTree(np.full(24, 3600, dtype=int)).root()) + +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("")) with open("prosumer.json") as f: prosumer_json = json.load(f) @@ -49,8 +51,6 @@ prosumer_json["components"]["hot_water_consumption"]["consumption"] = input_prof prosumer = Prosumer("my_prosumer", prosumer_json) -prosumer.optimize("sized", TrivialArchitecture(dynamic), ["annuity"]) - -prosumer.save_results("output_files") +prosumer.optimize("sized", architecture, {}, ["annuity"], {}) prosumer.save_results("output_files") diff --git a/examples/district/runme.py b/examples/district/runme.py index 96fed8b047e3212cc0fccc778774546896262dac..568b76a39be97b23d042bd3c5293cc9524bc9378 100644 --- a/examples/district/runme.py +++ b/examples/district/runme.py @@ -22,15 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import Profile, TrivialArchitecture, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.dynamics import DynamicTree from Model_Library.topology import District, DistrictAsset, Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(24, 3600, dtype=int)) +architecture = Architecture(DynamicTree(np.full(24, 3600, dtype=int)).root()) -input_profiles = Profile.from_csv("data.csv", dynamic) +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("")) prosumer_paths = { "my_prosumer_1": "prosumer_1.json", @@ -51,7 +52,7 @@ for prosumer_name, prosumer_path in prosumer_paths.items(): prosumers[prosumer_name] = Prosumer(prosumer_name, prosumer_json) for prosumer_name, prosumer in prosumers.items(): - prosumer.optimize("sized", TrivialArchitecture(dynamic), ["annuity"]) + prosumer.optimize("sized", architecture, {}, ["annuity"], {}) prosumer.save_results("output_files") @@ -72,6 +73,12 @@ district = District( "my_district", district_json, prosumers, {"my_asset": district_asset} ) -district.optimize("sized", TrivialArchitecture(dynamic), ["annuity"]) +district.optimize( + "sized", + architecture, + {}, + ["annuity"], + {"my_asset": ("sized", architecture, {}, ["annuity"], {})}, +) district.save_results("output_files") diff --git a/examples/simple_prosumer/runme.py b/examples/simple_prosumer/runme.py index 8b325fe6a5f6e19dc0f2f2016ef9d80ad0c49d0e..ed187920a0278650e9fcf459c9df32bbd4bb4700 100644 --- a/examples/simple_prosumer/runme.py +++ b/examples/simple_prosumer/runme.py @@ -22,14 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from Model_Library.dynamics import Profile, TrivialArchitecture, TrivialDynamic +from Model_Library.architecture import Architecture, Profile +from Model_Library.dynamics import DynamicTree from Model_Library.topology import Prosumer import json import numpy as np -dynamic = TrivialDynamic(np.full(24, 3600, dtype=int)) -input_profiles = Profile.from_csv("data.csv", dynamic) +architecture = Architecture(DynamicTree(np.full(24, 3600, dtype=int)).root()) + +input_profiles = Profile.from_csv("data.csv", architecture.get_dynamic("")) with open("prosumer.json") as f: prosumer_json = json.load(f) @@ -42,6 +44,6 @@ prosumer_json["components"]["consumption"]["consumption"] = input_profiles[ prosumer = Prosumer("my_prosumer", prosumer_json) -prosumer.optimize("sized", TrivialArchitecture(dynamic), ["annuity"]) +prosumer.optimize("sized", architecture, {}, ["annuity"], {}) prosumer.save_results("output_files")