From 2c5490d13892bc6c548573a6dacb789ebb9594a3 Mon Sep 17 00:00:00 2001 From: Pilar Date: Mon, 25 Oct 2021 13:33:08 -0400 Subject: [PATCH] added many new classes needed for the transportation group models. The documentation is not done because it is needed the students feed-back --- city_model_structure/attributes/node.py | 6 +- city_model_structure/attributes/record.py | 12 ++ .../attributes/time_series.py | 8 ++ city_model_structure/bus_system.py | 16 +++ city_model_structure/transport/bus.py | 44 +++++++ city_model_structure/transport/bus_depot.py | 8 ++ city_model_structure/transport/bus_edge.py | 4 + city_model_structure/transport/bus_stop.py | 16 +++ .../transport/fast_charging_infrastructure.py | 8 ++ data/customized_imports/ashrae_archetypes.xml | 123 ++++++++++++++++++ .../sanam_customized_usage_parameters.py} | 6 +- imports/customized_imports_factory.py | 29 +++++ imports/usage_factory.py | 7 - 13 files changed, 276 insertions(+), 11 deletions(-) create mode 100644 data/customized_imports/ashrae_archetypes.xml rename imports/{usage/ashrae_usage_parameters.py => customized_imports/sanam_customized_usage_parameters.py} (92%) create mode 100644 imports/customized_imports_factory.py diff --git a/city_model_structure/attributes/node.py b/city_model_structure/attributes/node.py index 50b617c6..39154182 100644 --- a/city_model_structure/attributes/node.py +++ b/city_model_structure/attributes/node.py @@ -45,11 +45,15 @@ class Node: @property def edges(self) -> List[Edge]: """ - get edges delimited by the node + Get edges delimited by the node :return: [Edge] """ return self._edges @property def time_series(self) -> TimeSeries: + """ + Add explanation here + :return: add type of variable here + """ return self._time_series diff --git a/city_model_structure/attributes/record.py b/city_model_structure/attributes/record.py index 294bb8b9..e7261ddb 100644 --- a/city_model_structure/attributes/record.py +++ b/city_model_structure/attributes/record.py @@ -17,12 +17,24 @@ class Record: @property def time(self): + """ + Add explanation here + :return: add type of variable here + """ return self._time @property def value(self): + """ + Add explanation here + :return: add type of variable here + """ return self._value @property def flag(self): + """ + Add explanation here + :return: add type of variable here + """ return self._flag diff --git a/city_model_structure/attributes/time_series.py b/city_model_structure/attributes/time_series.py index 83301bb5..20c4d5dd 100644 --- a/city_model_structure/attributes/time_series.py +++ b/city_model_structure/attributes/time_series.py @@ -19,8 +19,16 @@ class TimeSeries: @property def time_series_type(self): + """ + Add explanation here + :return: add type of variable here + """ return self._time_series_type @property def records(self) -> List[Record]: + """ + Add explanation here + :return: List[Record] + """ return self._records diff --git a/city_model_structure/bus_system.py b/city_model_structure/bus_system.py index 171903e6..c254a55e 100644 --- a/city_model_structure/bus_system.py +++ b/city_model_structure/bus_system.py @@ -25,16 +25,32 @@ class BusSystem(CityObject): @property def bus_routes(self) -> List[BusNode]: + """ + Add explanation here + :return: [BusNode] + """ return self._bus_routes @property def bus_network(self) -> BusNetwork: + """ + Add explanation here + :return: BusNetwork + """ return self._bus_network @property def buses(self) -> List[Bus]: + """ + Add explanation here + :return: [Bus] + """ return self._buses @property def restricted_polygons(self) -> List[Polygon]: + """ + Add explanation here + :return: [Polygon] + """ return self._restricted_polygons diff --git a/city_model_structure/transport/bus.py b/city_model_structure/transport/bus.py index 708d0a6d..ea7acb47 100644 --- a/city_model_structure/transport/bus.py +++ b/city_model_structure/transport/bus.py @@ -27,44 +27,88 @@ class Bus: @property def maintenance_time(self): + """ + Add explanation here + :return: add type of variable here + """ return self._maintenance_time @property def charging_time(self): + """ + Add explanation here + :return: add type of variable here + """ return self._charging_time @property def recovery_time(self): + """ + Add explanation here + :return: add type of variable here + """ return self.maintenance_time + self.charging_time @property def vehicle_type(self): + """ + Add explanation here + :return: add type of variable here + """ return self._vehicle_type @property def energy_consumption(self): + """ + Add explanation here + :return: add type of variable here + """ return self._energy_consumption @property def trips_schedule(self) -> Schedule: + """ + Add explanation here + :return: add type of variable here + """ return self._trips_schedule @property def capacity(self): + """ + Add explanation here + :return: add type of variable here + """ return self._capacity @property def maintenance_cost(self): + """ + Add explanation here + :return: add type of variable here + """ return self._maintenance_cost @property def investment_cost(self): + """ + Add explanation here + :return: add type of variable here + """ return self._investment_cost @property def charging_range(self): + """ + Add explanation here + :return: add type of variable here + """ return self._charging_range @property def maximum_travel_range(self): + """ + Add explanation here + :return: add type of variable here + """ return self._maximum_travel_range diff --git a/city_model_structure/transport/bus_depot.py b/city_model_structure/transport/bus_depot.py index 3bda6c66..0b617275 100644 --- a/city_model_structure/transport/bus_depot.py +++ b/city_model_structure/transport/bus_depot.py @@ -19,8 +19,16 @@ class BusDepot(BusNode): @property def number_of_charging_poles(self): + """ + Add explanation here + :return: add type of variable here + """ return self._number_of_charging_poles @property def number_of_available_buses(self): + """ + Add explanation here + :return: add type of variable here + """ return self._number_of_available_buses diff --git a/city_model_structure/transport/bus_edge.py b/city_model_structure/transport/bus_edge.py index 9d9f967a..d886b4a3 100644 --- a/city_model_structure/transport/bus_edge.py +++ b/city_model_structure/transport/bus_edge.py @@ -38,4 +38,8 @@ class BusEdge(Edge): @property def average_travel_time(self): + """ + Add explanation here + :return: add type of variable here + """ return self._average_travel_time diff --git a/city_model_structure/transport/bus_stop.py b/city_model_structure/transport/bus_stop.py index 7aed89eb..b4fccd62 100644 --- a/city_model_structure/transport/bus_stop.py +++ b/city_model_structure/transport/bus_stop.py @@ -24,16 +24,32 @@ class BusStop(BusNode): @property def time_table(self): + """ + Add explanation here + :return: add type of variable here + """ return self._time_table @property def average_hourly_passengers_demand(self) -> Schedule: + """ + Add explanation here + :return: Schedule + """ return self._average_hourly_passengers_demand @property def fast_charging_infrastructure(self) -> Union[None, FastChargingInfrastructure]: + """ + Add explanation here + :return: FastChargingInfrastructure + """ return self._fast_charging_infrastructure @property def waiting_time(self): + """ + Add explanation here + :return: add type of variable here + """ return self._waiting_time diff --git a/city_model_structure/transport/fast_charging_infrastructure.py b/city_model_structure/transport/fast_charging_infrastructure.py index 16b4b6e5..a3369a91 100644 --- a/city_model_structure/transport/fast_charging_infrastructure.py +++ b/city_model_structure/transport/fast_charging_infrastructure.py @@ -16,8 +16,16 @@ class FastChargingInfrastructure: @property def electrical_demand(self): + """ + Add explanation here + :return: add type of variable here + """ return self._electrical_demand @property def losses_in_grid(self): + """ + Add explanation here + :return: add type of variable here + """ return self._losses_in_grid diff --git a/data/customized_imports/ashrae_archetypes.xml b/data/customized_imports/ashrae_archetypes.xml new file mode 100644 index 00000000..17569df2 --- /dev/null +++ b/data/customized_imports/ashrae_archetypes.xml @@ -0,0 +1,123 @@ + + + Ashrae values + Library created by Sanam from ANSI/ASHRAE Standard 62-2001 + + assembly + + 0.15 + + + + 5 + + + + + health + + 0.1 + + + + 20 + + + + + hotel + + 0.11 + + + + 5 + + + + + manufacturing + + 0.07 + + + + 10 + + + + + office + + 0.05 + + + + 5 + + + + + restaurant + + 0.7 + + + + 7.5 + + + + + retail + + 0.2 + + + + 7.5 + + + + + school + + 0.25 + + + + 10 + + + + + lab + + 0.25 + + + + 10 + + + + + residential + + + 5 + + + + + gymnasium + + 0.3 + + + + 7.5 + + + + diff --git a/imports/usage/ashrae_usage_parameters.py b/imports/customized_imports/sanam_customized_usage_parameters.py similarity index 92% rename from imports/usage/ashrae_usage_parameters.py rename to imports/customized_imports/sanam_customized_usage_parameters.py index 1bfb98bd..58dbdef0 100644 --- a/imports/usage/ashrae_usage_parameters.py +++ b/imports/customized_imports/sanam_customized_usage_parameters.py @@ -1,5 +1,5 @@ """ -AshraeUsageParameters model the usage properties +SanamCustomizedUsageParameters add two parameters to usage properties from ASHRAE SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ @@ -9,9 +9,9 @@ from imports.geometry.helpers.geometry_helper import GeometryHelper as gh from city_model_structure.building_demand.usage_zone import UsageZone -class AshraeUsageParameters: +class SanamCustomizedUsageParameters: """ - AshraeUsageParameters class + SanamCustomizedUsageParameters class """ def __init__(self, city, base_path): super().__init__(base_path, 'ashrae_archetypes.xml') diff --git a/imports/customized_imports_factory.py b/imports/customized_imports_factory.py new file mode 100644 index 00000000..520cf853 --- /dev/null +++ b/imports/customized_imports_factory.py @@ -0,0 +1,29 @@ +""" +CustomizedImportsFactory is used to import any information using user customized formats +This factory can only be called after calling the construction factory. +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +""" +from pathlib import Path + + +class CustomizedImportsFactory: + """ + CustomizedImportsFactory class + """ + def __init__(self, city, importer_class, base_path): + if base_path is None: + base_path = Path(Path(__file__).parent.parent / 'data/customized_imports') + self._city = city + self._importer_class = importer_class + self._base_path = base_path + for building in city.buildings: + if len(building.thermal_zones) == 0: + raise Exception('It seems that the customized imports factory is being called before the construction factory. ' + 'Please ensure that the construction factory is called first.') + + def enrich(self): + """ + Enrich the city given to the class using the given importer class + :return: None + """ diff --git a/imports/usage_factory.py b/imports/usage_factory.py index 763a6dba..a886c197 100644 --- a/imports/usage_factory.py +++ b/imports/usage_factory.py @@ -8,7 +8,6 @@ Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca from pathlib import Path from imports.usage.hft_usage_parameters import HftUsageParameters from imports.usage.ca_usage_parameters import CaUsageParameters -from imports.usage.ashrae_usage_parameters import AshraeUsageParameters # todo: handle missing lambda and rise error. @@ -39,12 +38,6 @@ class UsageFactory: """ return CaUsageParameters(self._city, self._base_path).enrich_buildings() - def _ashrae(self): - """ - Enrich the city by using ASHRAE information - """ - AshraeUsageParameters(self._city, self._base_path).enrich_buildings() - def enrich(self): """ Enrich the city given to the class using the usage factory given handler