Select Git revision
VirtualRealityPawn.cpp
Forked from
LuFG VR VIS / VR-Group / Unreal-Development / Plugins / RWTH VR Toolkit
Source project has a limited visibility.
-
Sebastian Pape authoredSebastian Pape authored
runme.py 4.17 KiB
"""
MIT License
Copyright (c) 2023 RWTH Aachen University
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
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 Tooling.input_profile_processor.input_profile_processor import (
process_input_profiles,
)
import json
import pandas as pd
t_start = pd.Timestamp("2019-05-10 00:00:00")
dynamic = TrivialDynamic([60 for i in range(24 * 60 - 1)])
input_profile_dict = {
"bus_1_demand": {"type": "elec_demand", "file": "bus_1_demand.csv"},
"bus_2_demand": {"type": "elec_demand", "file": "bus_2_demand.csv"},
"bus_1_recuperation": {"type": "elec_demand", "file": "bus_1_recuperation.csv"},
"bus_2_recuperation": {"type": "elec_demand", "file": "bus_2_recuperation.csv"},
"bus_1_connected": {"type": "elec_demand", "file": "bus_1_connected.csv"},
"bus_2_connected": {"type": "elec_demand", "file": "bus_2_connected.csv"},
}
input_profiles = process_input_profiles(input_profile_dict, t_start, dynamic)
prosumer_paths = {"LaTreille": "IMC.json"}
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
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:
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"][
"min_capacity"
] = bus_1_moter_inverter_capacity
prosumer_dict["LaTreille"]["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:
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"][
"min_capacity"
] = bus_2_moter_inverter_capacity
prosumer_dict["LaTreille"]["components"]["bus_2_motor_inverter"][
"max_capacity"
] = bus_2_moter_inverter_capacity
prosumer_main = ProsumerMain(prosumer_dict, dynamic)
prosumer_sizing_strategy = ["annuity", "peak_power_costs"]
prosumer_main.optimize_sizing("sized", prosumer_sizing_strategy)
prosumer_main.save_results()