From d7e041b686e56b0460ed4dad38e385393117fe6f Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Mon, 7 Aug 2023 16:56:01 -0400 Subject: [PATCH] erased traffic folder: was not used at all changed in data ACH to 1/s --- .../construction/eilat_catalog.py | 5 +- .../construction/nrcan_catalog.py | 5 +- .../construction/nrel_catalog.py | 5 +- .../data_models/construction/archetype.py | 8 +- .../data_models/cost/income.py | 4 +- .../data_models/usages/appliances.py | 2 +- .../data_models/usages/usage.py | 2 +- hub/catalog_factories/usage/nrcan_catalog.py | 4 +- hub/city_model_structure/building.py | 2 +- .../building_demand/internal_zone.py | 22 +-- .../building_demand/surface.py | 4 +- .../building_demand/thermal_zone.py | 14 +- .../building_demand/usage.py | 4 +- hub/city_model_structure/bus_system.py | 57 ------- hub/city_model_structure/city_object.py | 4 + .../generic_distribution_system.py | 4 +- .../energy_systems/hvac_system.py | 50 ------ .../transport/__init__.py | 0 hub/city_model_structure/transport/bus.py | 115 -------------- .../transport/bus_depot.py | 35 ---- .../transport/bus_edge.py | 47 ------ .../transport/bus_network.py | 44 ----- .../transport/bus_node.py | 56 ------- .../transport/bus_stop.py | 56 ------- .../transport/connection.py | 125 --------------- .../transport/crossing.py | 74 --------- hub/city_model_structure/transport/join.py | 27 ---- hub/city_model_structure/transport/lane.py | 144 ----------------- .../transport/origin_destination_edge.py | 48 ------ .../transport/origin_destination_network.py | 44 ----- .../transport/origin_destination_node.py | 85 ---------- hub/city_model_structure/transport/phase.py | 134 ---------------- .../transport/traffic_edge.py | 150 ------------------ .../transport/traffic_light.py | 75 --------- .../transport/traffic_network.py | 45 ------ .../transport/traffic_node.py | 97 ----------- .../transport/walkway_node.py | 37 ----- hub/exports/building_energy/idf.py | 6 +- .../insel/insel_monthly_energy_balance.py | 8 +- hub/helpers/constants.py | 1 + .../peak_calculation/loads_calculation.py | 9 +- .../results/simplified_radiosity_algorithm.py | 3 +- hub/imports/usage/comnet_usage_parameters.py | 3 +- hub/imports/usage/eilat_usage_parameters.py | 3 +- hub/imports/usage/nrcan_usage_parameters.py | 6 +- tests/test_custom_insel_block.py | 3 +- tests/test_db_factory.py | 4 +- tests/test_insel_exports.py | 3 +- tests/test_systems_factory.py | 2 +- 49 files changed, 66 insertions(+), 1619 deletions(-) delete mode 100644 hub/city_model_structure/bus_system.py delete mode 100644 hub/city_model_structure/energy_systems/hvac_system.py delete mode 100644 hub/city_model_structure/transport/__init__.py delete mode 100644 hub/city_model_structure/transport/bus.py delete mode 100644 hub/city_model_structure/transport/bus_depot.py delete mode 100644 hub/city_model_structure/transport/bus_edge.py delete mode 100644 hub/city_model_structure/transport/bus_network.py delete mode 100644 hub/city_model_structure/transport/bus_node.py delete mode 100644 hub/city_model_structure/transport/bus_stop.py delete mode 100644 hub/city_model_structure/transport/connection.py delete mode 100644 hub/city_model_structure/transport/crossing.py delete mode 100644 hub/city_model_structure/transport/join.py delete mode 100644 hub/city_model_structure/transport/lane.py delete mode 100644 hub/city_model_structure/transport/origin_destination_edge.py delete mode 100644 hub/city_model_structure/transport/origin_destination_network.py delete mode 100644 hub/city_model_structure/transport/origin_destination_node.py delete mode 100644 hub/city_model_structure/transport/phase.py delete mode 100644 hub/city_model_structure/transport/traffic_edge.py delete mode 100644 hub/city_model_structure/transport/traffic_light.py delete mode 100644 hub/city_model_structure/transport/traffic_network.py delete mode 100644 hub/city_model_structure/transport/traffic_node.py delete mode 100644 hub/city_model_structure/transport/walkway_node.py diff --git a/hub/catalog_factories/construction/eilat_catalog.py b/hub/catalog_factories/construction/eilat_catalog.py index e33f5960..43f889c2 100644 --- a/hub/catalog_factories/construction/eilat_catalog.py +++ b/hub/catalog_factories/construction/eilat_catalog.py @@ -15,6 +15,7 @@ from hub.catalog_factories.data_models.construction.archetype import Archetype from hub.catalog_factories.data_models.construction.window import Window from hub.catalog_factories.data_models.construction.material import Material from hub.catalog_factories.data_models.construction.layer import Layer +import hub.helpers.constants as cte class EilatCatalog(Catalog): @@ -120,8 +121,8 @@ class EilatCatalog(Catalog): construction_period = archetype['period_of_construction'] average_storey_height = archetype['average_storey_height'] extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_thermal_bridges'] - infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off'] - infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on'] + infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off'] / cte.HOUR_TO_SECONDS + infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on'] / cte.HOUR_TO_SECONDS archetype_constructions = [] for archetype_construction in archetype['constructions']: diff --git a/hub/catalog_factories/construction/nrcan_catalog.py b/hub/catalog_factories/construction/nrcan_catalog.py index cb1c3f76..1e9d9455 100644 --- a/hub/catalog_factories/construction/nrcan_catalog.py +++ b/hub/catalog_factories/construction/nrcan_catalog.py @@ -15,6 +15,7 @@ from hub.catalog_factories.data_models.construction.archetype import Archetype from hub.catalog_factories.data_models.construction.window import Window from hub.catalog_factories.data_models.construction.material import Material from hub.catalog_factories.data_models.construction.layer import Layer +import hub.helpers.constants as cte class NrcanCatalog(Catalog): @@ -121,8 +122,8 @@ class NrcanCatalog(Catalog): average_storey_height = archetype['average_storey_height'] thermal_capacity = float(archetype['thermal_capacity']) * 1000 extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_thermal_bridges'] - infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off'] - infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on'] + infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off'] / cte.HOUR_TO_SECONDS + infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on'] / cte.HOUR_TO_SECONDS archetype_constructions = [] for archetype_construction in archetype['constructions']: diff --git a/hub/catalog_factories/construction/nrel_catalog.py b/hub/catalog_factories/construction/nrel_catalog.py index fcfb5a06..da31fd9f 100644 --- a/hub/catalog_factories/construction/nrel_catalog.py +++ b/hub/catalog_factories/construction/nrel_catalog.py @@ -15,6 +15,7 @@ from hub.catalog_factories.data_models.construction.construction import Construc from hub.catalog_factories.data_models.construction.content import Content from hub.catalog_factories.data_models.construction.archetype import Archetype from hub.catalog_factories.construction.construction_helper import ConstructionHelper +import hub.helpers.constants as cte class NrelCatalog(Catalog): @@ -124,10 +125,10 @@ class NrelCatalog(Catalog): indirect_heated_ratio = float(archetype['indirect_heated_ratio']['#text']) infiltration_rate_for_ventilation_system_off = float( archetype['infiltration_rate_for_ventilation_system_off']['#text'] - ) + ) / cte.HOUR_TO_SECONDS infiltration_rate_for_ventilation_system_on = float( archetype['infiltration_rate_for_ventilation_system_on']['#text'] - ) + ) / cte.HOUR_TO_SECONDS archetype_constructions = [] for archetype_construction in archetype['constructions']['construction']: diff --git a/hub/catalog_factories/data_models/construction/archetype.py b/hub/catalog_factories/data_models/construction/archetype.py index 4e4d1e19..3397c4bf 100644 --- a/hub/catalog_factories/data_models/construction/archetype.py +++ b/hub/catalog_factories/data_models/construction/archetype.py @@ -120,7 +120,7 @@ class Archetype: @property def infiltration_rate_for_ventilation_system_off(self): """ - Get archetype infiltration rate for ventilation system off in ACH + Get archetype infiltration rate for ventilation system off in 1/s :return: float """ return self._infiltration_rate_for_ventilation_system_off @@ -128,7 +128,7 @@ class Archetype: @property def infiltration_rate_for_ventilation_system_on(self): """ - Get archetype infiltration rate for ventilation system on in ACH + Get archetype infiltration rate for ventilation system on in 1/s :return: float """ return self._infiltration_rate_for_ventilation_system_on @@ -147,8 +147,8 @@ class Archetype: 'thermal capacity [J/m3K]': self.thermal_capacity, 'extra loses due to thermal bridges [W/m2K]': self.extra_loses_due_to_thermal_bridges, 'indirect heated ratio': self.indirect_heated_ratio, - 'infiltration rate for ventilation off [ACH]': self.infiltration_rate_for_ventilation_system_off, - 'infiltration rate for ventilation on [ACH]': self.infiltration_rate_for_ventilation_system_on, + 'infiltration rate for ventilation off [1/s]': self.infiltration_rate_for_ventilation_system_off, + 'infiltration rate for ventilation on [1/s]': self.infiltration_rate_for_ventilation_system_on, 'constructions': _constructions } } diff --git a/hub/catalog_factories/data_models/cost/income.py b/hub/catalog_factories/data_models/cost/income.py index a053512a..28c75802 100644 --- a/hub/catalog_factories/data_models/cost/income.py +++ b/hub/catalog_factories/data_models/cost/income.py @@ -27,7 +27,7 @@ class Income: @property def construction_subsidy(self) -> Union[None, float]: """ - Get subsidy for construction in percentage + Get subsidy for construction in percentage % :return: None or float """ return self._construction_subsidy @@ -35,7 +35,7 @@ class Income: @property def hvac_subsidy(self) -> Union[None, float]: """ - Get subsidy for HVAC system in percentage + Get subsidy for HVAC system in percentage % :return: None or float """ return self._hvac_subsidy diff --git a/hub/catalog_factories/data_models/usages/appliances.py b/hub/catalog_factories/data_models/usages/appliances.py index fd16b913..446e548c 100644 --- a/hub/catalog_factories/data_models/usages/appliances.py +++ b/hub/catalog_factories/data_models/usages/appliances.py @@ -24,7 +24,7 @@ class Appliances: @property def density(self) -> Union[None, float]: """ - Get appliances density in Watts per m2 + Get appliances density in W/m2 :return: None or float """ return self._density diff --git a/hub/catalog_factories/data_models/usages/usage.py b/hub/catalog_factories/data_models/usages/usage.py index 41065cae..e48a8a11 100644 --- a/hub/catalog_factories/data_models/usages/usage.py +++ b/hub/catalog_factories/data_models/usages/usage.py @@ -65,7 +65,7 @@ class Usage: @property def mechanical_air_change(self) -> Union[None, float]: """ - Get usage zone mechanical air change in air change per hour (ACH) + Get usage zone mechanical air change in air change per second (1/s) :return: None or float """ return self._mechanical_air_change diff --git a/hub/catalog_factories/usage/nrcan_catalog.py b/hub/catalog_factories/usage/nrcan_catalog.py index 7530081f..a1822f84 100644 --- a/hub/catalog_factories/usage/nrcan_catalog.py +++ b/hub/catalog_factories/usage/nrcan_catalog.py @@ -134,8 +134,8 @@ class NrcanCatalog(Catalog): hvac_availability = self._get_schedules(hvac_schedule_name) domestic_hot_water_load_schedule = self._get_schedules(domestic_hot_water_schedule_name) - # ACH - mechanical_air_change = space_type['ventilation_air_changes'] + # ACH -> 1/s + mechanical_air_change = space_type['ventilation_air_changes'] / cte.HOUR_TO_SECONDS # cfm/ft2 to m3/m2.s ventilation_rate = space_type['ventilation_per_area'] / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS) # cfm/person to m3/m2.s diff --git a/hub/city_model_structure/building.py b/hub/city_model_structure/building.py index 14f62e70..b350e42b 100644 --- a/hub/city_model_structure/building.py +++ b/hub/city_model_structure/building.py @@ -758,7 +758,7 @@ class Building(CityObject): @property def onsite_electrical_production(self): """ - Get total electricity produced onsite in Wh + Get total electricity produced onsite in J return: dict """ diff --git a/hub/city_model_structure/building_demand/internal_zone.py b/hub/city_model_structure/building_demand/internal_zone.py index c8669652..ef2a301c 100644 --- a/hub/city_model_structure/building_demand/internal_zone.py +++ b/hub/city_model_structure/building_demand/internal_zone.py @@ -10,7 +10,6 @@ from typing import Union, List from hub.city_model_structure.building_demand.usage import Usage from hub.city_model_structure.building_demand.thermal_zone import ThermalZone from hub.city_model_structure.attributes.polyhedron import Polyhedron -from hub.city_model_structure.energy_systems.hvac_system import HvacSystem class InternalZone: @@ -25,7 +24,6 @@ class InternalZone: self._area = area self._thermal_zones = None self._usages = None - self._hvac_system = None @property def id(self): @@ -77,7 +75,7 @@ class InternalZone: @property def usages(self) -> [Usage]: """ - Get internal zone usage zones + Get internal zone usages :return: [Usage] """ return self._usages @@ -85,27 +83,11 @@ class InternalZone: @usages.setter def usages(self, value): """ - Set internal zone usage zones + Set internal zone usages :param value: [Usage] """ self._usages = value - @property - def hvac_system(self) -> Union[None, HvacSystem]: - """ - Get HVAC system installed for this thermal zone - :return: None or HvacSystem - """ - return self._hvac_system - - @hvac_system.setter - def hvac_system(self, value): - """ - Set HVAC system installed for this thermal zone - :param value: HvacSystem - """ - self._hvac_system = value - @property def thermal_zones(self) -> Union[None, List[ThermalZone]]: """ diff --git a/hub/city_model_structure/building_demand/surface.py b/hub/city_model_structure/building_demand/surface.py index 1d34b6ba..7fbef20d 100644 --- a/hub/city_model_structure/building_demand/surface.py +++ b/hub/city_model_structure/building_demand/surface.py @@ -178,7 +178,7 @@ class Surface: @property def global_irradiance(self) -> dict: """ - Get global irradiance on surface in Wh/m2 + Get global irradiance on surface in J/m2 :return: dict """ return self._global_irradiance @@ -186,7 +186,7 @@ class Surface: @global_irradiance.setter def global_irradiance(self, value): """ - Set global irradiance on surface in Wh/m2 + Set global irradiance on surface in J/m2 :param value: dict """ self._global_irradiance = value diff --git a/hub/city_model_structure/building_demand/thermal_zone.py b/hub/city_model_structure/building_demand/thermal_zone.py index 8d4886d4..6a883d99 100644 --- a/hub/city_model_structure/building_demand/thermal_zone.py +++ b/hub/city_model_structure/building_demand/thermal_zone.py @@ -161,7 +161,7 @@ class ThermalZone: @property def infiltration_rate_system_on(self): """ - Get thermal zone infiltration rate system on in air changes per hour (ACH) + Get thermal zone infiltration rate system on in air changes per second (1/s) :return: None or float """ return self._infiltration_rate_system_on @@ -169,7 +169,7 @@ class ThermalZone: @infiltration_rate_system_on.setter def infiltration_rate_system_on(self, value): """ - Set thermal zone infiltration rate system on in air changes per hour (ACH) + Set thermal zone infiltration rate system on in air changes per second (1/s) :param value: float """ self._infiltration_rate_system_on = value @@ -177,7 +177,7 @@ class ThermalZone: @property def infiltration_rate_system_off(self): """ - Get thermal zone infiltration rate system off in air changes per hour (ACH) + Get thermal zone infiltration rate system off in air changes per second (1/s) :return: None or float """ return self._infiltration_rate_system_off @@ -185,7 +185,7 @@ class ThermalZone: @infiltration_rate_system_off.setter def infiltration_rate_system_off(self, value): """ - Set thermal zone infiltration rate system on in air changes per hour (ACH) + Set thermal zone infiltration rate system on in air changes per second (1/s) :param value: float """ self._infiltration_rate_system_off = value @@ -285,7 +285,7 @@ class ThermalZone: @property def mechanical_air_change(self) -> Union[None, float]: """ - Get thermal zone mechanical air change in air change per hour (ACH) + Get thermal zone mechanical air change in air change per second (1/s) :return: None or float """ if self.usages is None: @@ -653,7 +653,7 @@ class ThermalZone: @property def total_floor_area(self): """ - Get the total floor area of this thermal zone + Get the total floor area of this thermal zone in m2 :return: float """ return self._total_floor_area @@ -661,7 +661,7 @@ class ThermalZone: @total_floor_area.setter def total_floor_area(self, value): """ - Set the total floor area of this thermal zone + Set the total floor area of this thermal zone in m2 :param value: float """ self._total_floor_area = value diff --git a/hub/city_model_structure/building_demand/usage.py b/hub/city_model_structure/building_demand/usage.py index c3eea9fe..7b255eb1 100644 --- a/hub/city_model_structure/building_demand/usage.py +++ b/hub/city_model_structure/building_demand/usage.py @@ -173,7 +173,7 @@ class Usage: @property def mechanical_air_change(self) -> Union[None, float]: """ - Get usage zone mechanical air change in air change per hour (ACH) + Get usage zone mechanical air change in air change per second (1/s) :return: None or float """ return self._mechanical_air_change @@ -181,7 +181,7 @@ class Usage: @mechanical_air_change.setter def mechanical_air_change(self, value): """ - Set usage zone mechanical air change in air change per hour (ACH) + Set usage zone mechanical air change in air change per second (1/s) :param value: float """ if value is not None: diff --git a/hub/city_model_structure/bus_system.py b/hub/city_model_structure/bus_system.py deleted file mode 100644 index bcb69793..00000000 --- a/hub/city_model_structure/bus_system.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Bus system module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List -from hub.city_model_structure.city_object import CityObject -from hub.city_model_structure.attributes.polygon import Polygon -from hub.city_model_structure.transport.bus_network import BusNetwork -from hub.city_model_structure.transport.bus_node import BusNode -from hub.city_model_structure.transport.bus import Bus - - -class BusSystem(CityObject): - """ - BusSystem(CityObject) class - """ - def __init__(self, name, surfaces): - super().__init__(name, surfaces) - self._bus_routes = None - self._bus_network = None - self._buses = None - self._restricted_polygons = None - - @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/hub/city_model_structure/city_object.py b/hub/city_model_structure/city_object.py index 4782b346..2ef6d2a8 100644 --- a/hub/city_model_structure/city_object.py +++ b/hub/city_model_structure/city_object.py @@ -81,6 +81,10 @@ class CityObject: @volume.setter def volume(self, value): + """ + Set city object volume in cubic meters + :param value: float + """ self._volume = value @property diff --git a/hub/city_model_structure/energy_systems/generic_distribution_system.py b/hub/city_model_structure/energy_systems/generic_distribution_system.py index 1db721d1..046b8ba9 100644 --- a/hub/city_model_structure/energy_systems/generic_distribution_system.py +++ b/hub/city_model_structure/energy_systems/generic_distribution_system.py @@ -69,7 +69,7 @@ class GenericDistributionSystem: def distribution_consumption_variable_flow(self): """ Get distribution_consumption if the pump or fan work at variable mass or volume flow in ratio - over energy produced (Wh/Wh) + over energy produced (J/J) :return: float """ return self._distribution_consumption_variable_flow @@ -78,7 +78,7 @@ class GenericDistributionSystem: def distribution_consumption_variable_flow(self, value): """ Set distribution_consumption if the pump or fan work at variable mass or volume flow in ratio - over energy produced (Wh/Wh) + over energy produced (J/J) :return: float """ self._distribution_consumption_variable_flow = value diff --git a/hub/city_model_structure/energy_systems/hvac_system.py b/hub/city_model_structure/energy_systems/hvac_system.py deleted file mode 100644 index 2f0b5ac3..00000000 --- a/hub/city_model_structure/energy_systems/hvac_system.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -HvacSystem module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" -from typing import Union, List -from hub.city_model_structure.building_demand.thermal_zone import ThermalZone - - -class HvacSystem: - """ - HvacSystem class - """ - def __init__(self): - self._type = None - self._thermal_zones = None - - @property - def type(self) -> Union[None, str]: - """ - Get hvac system type - :return: None or str - """ - return self._type - - @type.setter - def type(self, value): - """ - Set hvac system type - :param value: str - """ - if value is not None: - self._type = str(value) - - @property - def thermal_zones(self) -> Union[None, List[ThermalZone]]: - """ - Get list of zones that this unit serves - :return: None or [ThermalZone] - """ - return self._thermal_zones - - @thermal_zones.setter - def thermal_zones(self, value): - """ - Set list of zones that this unit serves - :param value: [ThermalZone] - """ - self._thermal_zones = value diff --git a/hub/city_model_structure/transport/__init__.py b/hub/city_model_structure/transport/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/hub/city_model_structure/transport/bus.py b/hub/city_model_structure/transport/bus.py deleted file mode 100644 index 6d8efd18..00000000 --- a/hub/city_model_structure/transport/bus.py +++ /dev/null @@ -1,115 +0,0 @@ -""" -Bus module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from hub.city_model_structure.attributes.schedule import Schedule - - -class Bus: - """ - Bus class - """ - - def __init__(self): - self._maintenance_time = None - self._charging_time = None - self._recovery_time = None - self._vehicle_type = None - self._energy_consumption = None - self._trips_schedule = None - self._capacity = None - self._maintenance_cost = None - self._investment_cost = None - self._charging_range = None - self._maximum_travel_range = None - - @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/hub/city_model_structure/transport/bus_depot.py b/hub/city_model_structure/transport/bus_depot.py deleted file mode 100644 index 3ec0c3eb..00000000 --- a/hub/city_model_structure/transport/bus_depot.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Bus depot module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from hub.city_model_structure.transport.bus_node import BusNode - - -class BusDepot(BusNode): - """ - BusDepot class - """ - - def __init__(self, name, coordinates, edges=None): - super().__init__(name, coordinates, edges=edges, node_type='BusDepot') - self._number_of_charging_poles = None - self._number_of_available_buses = None - - @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/hub/city_model_structure/transport/bus_edge.py b/hub/city_model_structure/transport/bus_edge.py deleted file mode 100644 index d6100a26..00000000 --- a/hub/city_model_structure/transport/bus_edge.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Bus edge module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List, TypeVar -from hub.city_model_structure.attributes.edge import Edge - -BusNode = TypeVar('BusNode') - - -class BusEdge(Edge): - """ - BusEdge class - Each edge is unidirectional and starts at the "from" node and ends at the "to" node - """ - - def __init__(self, name, nodes, edge_type='BusEdge'): - super().__init__(name, nodes) - self._edge_type = edge_type - self._average_travel_time = None - - @property - def edge_type(self): - """ - Get the edge type - :return: str - """ - return self._edge_type - - @property - def nodes(self) -> List[BusNode]: - """ - Get delimiting nodes for the edge - :return: [BusNode] - """ - return self._nodes - - @property - def average_travel_time(self): - """ - Add explanation here - :return: add type of variable here - """ - return self._average_travel_time diff --git a/hub/city_model_structure/transport/bus_network.py b/hub/city_model_structure/transport/bus_network.py deleted file mode 100644 index 23781b0c..00000000 --- a/hub/city_model_structure/transport/bus_network.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -Bus network module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List -from hub.city_model_structure.network import Network -from hub.city_model_structure.transport.bus_edge import BusEdge -from hub.city_model_structure.transport.bus_node import BusNode - - -class BusNetwork(Network): - """ - BusNetwork(Network) class - """ - def __init__(self, name, edges=None, nodes=None): - super().__init__(name, edges, nodes) - self._type = "BusNetwork" - - @property - def type(self): - """ - Get network type - :return: str - """ - return self._type - - @property - def edges(self) -> List[BusEdge]: - """ - Get network edges - :return: [BusEdge] - """ - return self._edges - - @property - def nodes(self) -> List[BusNode]: - """ - Get network nodes - :return: [BusNode] - """ - return self._nodes diff --git a/hub/city_model_structure/transport/bus_node.py b/hub/city_model_structure/transport/bus_node.py deleted file mode 100644 index 5c77db1d..00000000 --- a/hub/city_model_structure/transport/bus_node.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Bus node module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List, TypeVar - -from hub.city_model_structure.attributes.node import Node -from hub.city_model_structure.attributes.point import Point - -BusEdge = TypeVar('BusEdge') - - -class BusNode(Node): - """ - BusNode class - """ - - def __init__(self, name, coordinates, node_type='BusNode', edges=None): - super().__init__(name, edges) - self._coordinates = coordinates - self._node_type = node_type - - @property - def node_type(self): - """ - Get node type - :return: str - """ - return self._node_type - - @property - def coordinates(self) -> Point: - """ - Get node coordinates - :return: Point - """ - return self._coordinates - - @coordinates.setter - def coordinates(self, value): - """ - Set node coordinates - :param value: Point - """ - self._coordinates = value - - @property - def edges(self) -> List[BusEdge]: - """ - get edges delimited by the node - :return: [BusEdge] - """ - return self._edges diff --git a/hub/city_model_structure/transport/bus_stop.py b/hub/city_model_structure/transport/bus_stop.py deleted file mode 100644 index 551aab9d..00000000 --- a/hub/city_model_structure/transport/bus_stop.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Bus stop module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import Union -from hub.city_model_structure.transport.bus_node import BusNode -from hub.city_model_structure.transport.fast_charging_infrastructure import FastChargingInfrastructure -from hub.city_model_structure.attributes.schedule import Schedule - - -class BusStop(BusNode): - """ - BusStop class - """ - - def __init__(self, name, coordinates, edges=None): - super().__init__(name, coordinates, edges=edges, node_type='BusStop') - self._time_table = None - self._average_hourly_passengers_demand = None - self._fast_charging_infrastructure = None - self._waiting_time = None - - @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/hub/city_model_structure/transport/connection.py b/hub/city_model_structure/transport/connection.py deleted file mode 100644 index 9cb3c132..00000000 --- a/hub/city_model_structure/transport/connection.py +++ /dev/null @@ -1,125 +0,0 @@ -""" -Connection module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -import ast -from typing import Union - -from hub.city_model_structure.attributes.edge import Edge -from hub.city_model_structure.transport.lane import Lane - - -class Connection: - """ - Connection class - """ - - def __init__(self): - self._from_edge = None - self._to_edge = None - self._from_lane = None - self._to_lane = None - self._pass = None - self._keep_clear = None - - @property - def from_edge(self) -> Edge: - """ - Get "from" edge - :return: Edge - """ - return self._from_edge - - @from_edge.setter - def from_edge(self, value): - """ - Set "from" edge - :param value: Edge - """ - self._from_edge = value - - @property - def to_edge(self) -> Edge: - """ - Get "to" edge - :return: Edge - """ - return self._to_edge - - @to_edge.setter - def to_edge(self, value): - """ - Set "to" edge - :param value: Edge - """ - self._to_edge = value - - @property - def from_lane(self) -> Lane: - """ - Get "from" lane - :return: Lane - """ - return self._to_lane - - @from_lane.setter - def from_lane(self, value): - """ - Set "from" lane - :param value: Lane - """ - self._from_lane = value - - @property - def to_lane(self) -> Lane: - """ - Get "to" lane - :return: Lane - """ - return self._to_lane - - @to_lane.setter - def to_lane(self, value): - """ - Set "to" lane - :param value: Lane - """ - self._to_lane = value - - @property - def pass_not_wait(self) -> Union[None, bool]: - """ - Get if the vehicles which pass this (lane to lane) connection will not wait - :return: None or Boolean - """ - return self._pass - - @pass_not_wait.setter - def pass_not_wait(self, value): - """ - Set if the vehicles which pass this (lane to lane) connection will not wait - :param value: Boolean - """ - if value is not None: - self._pass = ast.literal_eval(value) - - @property - def keep_clear(self) -> Union[None, bool]: - """ - Get if vehicles which pass this (lane to lane) connection should keep the intersection clear - :return: None or Boolean - """ - return self._keep_clear - - @keep_clear.setter - def keep_clear(self, value): - """ - Set if vehicles which pass this (lane to lane) connection should keep the intersection clear - :param value: Boolean - """ - if value is not None: - self._keep_clear = ast.literal_eval(value) diff --git a/hub/city_model_structure/transport/crossing.py b/hub/city_model_structure/transport/crossing.py deleted file mode 100644 index 04c2f516..00000000 --- a/hub/city_model_structure/transport/crossing.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Crossing module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -import ast -from typing import List, Union -from hub.city_model_structure.transport.traffic_node import TrafficNode - - -class Crossing(TrafficNode): - """ - Crossing class - """ - - def __init__(self, name, coordinates, priority, width, shape=None, edges=None): - super().__init__(name, coordinates, edges=edges, node_type='Crossing') - self._priority = priority - self._width = width - self._shape = shape - - @property - def priority(self) -> Union[None, bool]: - """ - Get whether the pedestrians have priority over the vehicles - :return: None or bool - """ - return self._priority - - @priority.setter - def priority(self, value): - """ - Set whether the pedestrians have priority over the vehicles - :param value: bool - """ - if value is not None: - self._priority = ast.literal_eval(value) - - @property - def width(self) -> Union[None, float]: - """ - Get crossing width in meters - :return: None or float - """ - return self._width - - @width.setter - def width(self, value): - """ - Set crossing width in meters - :param value: float - """ - if value is not None: - self._width = float(value) - - @property - def shape(self) -> Union[None, List[List[float]]]: - """ - Get the list of positions - :return: None or [[x, y, (z)]] - """ - return self._shape - - @shape.setter - def shape(self, value): - """ - Set the list of positions - :param value: [[x, y, (z)]] - """ - if value is not None: - self._shape = [[float(i) for i in value]] diff --git a/hub/city_model_structure/transport/join.py b/hub/city_model_structure/transport/join.py deleted file mode 100644 index c9a30861..00000000 --- a/hub/city_model_structure/transport/join.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Join module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -from hub.city_model_structure.transport.traffic_node import TrafficNode - - -class Join(TrafficNode): - """ - Join class - """ - - def __init__(self, name, coordinates, nodes): - self._nodes = nodes - edges = [] - prohibitions = [] - connections = [] - for node in self._nodes: - edges = edges + node.edges - prohibitions = prohibitions + node.prohibitions - connections = connections + node.connections - super().__init__(name, coordinates, edges=edges, prohibitions=prohibitions, connections=connections, - node_type='Join') diff --git a/hub/city_model_structure/transport/lane.py b/hub/city_model_structure/transport/lane.py deleted file mode 100644 index 1ac6e32f..00000000 --- a/hub/city_model_structure/transport/lane.py +++ /dev/null @@ -1,144 +0,0 @@ -""" -Lane module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List, Union - - -class Lane: - """ - Lane class - """ - - def __init__(self): - self._index = None - self._allow = None - self._disallow = None - self._change_left = None - self._change_right = None - self._speed = None - self._width = None - - @property - def index(self) -> Union[None, int]: - """ - Get lane index - The enumeration index of the lane (0 is the rightmost lane, -1 is the leftmost one) - :return: None or int - """ - return self._index - - @index.setter - def index(self, value): - """ - Set lane index - The enumeration index of the lane (0 is the rightmost lane, -1 is the leftmost one) - :param value: int - """ - if value is not None: - self._index = int(value) - - @property - def allow(self) -> Union[None, List[str]]: - """ - Get the list of allowed vehicle classes - :return: None or [str] - """ - return self._allow - - @allow.setter - def allow(self, value): - """ - Set the list of allowed vehicle classes setter - :param value: [str] - """ - if value is not None: - self._allow = [str(i) for i in value] - - @property - def disallow(self) -> Union[None, List[str]]: - """ - Get the list of not allowed vehicle classes - :return: None or [str] - """ - return self._disallow - - @disallow.setter - def disallow(self, value): - """ - Get the list of not allowed vehicle classes setter - :param value: [str] - """ - if value is not None: - self._disallow = [str(i) for i in value] - - @property - def change_left(self) -> Union[None, List[str]]: - """ - Get the list of vehicle classes that may change left from this lane - :return: None or [str] - """ - return self._change_left - - @change_left.setter - def change_left(self, value): - """ - Set the list of vehicle classes that may change left from this lane - :param value: [str] - """ - if value is not None: - self._change_left = [str(i) for i in value] - - @property - def change_right(self) -> Union[None, List[str]]: - """ - Get the list of vehicle classes that may change right from this lane - :return: None or [str] - """ - return self._change_right - - @change_right.setter - def change_right(self, value): - """ - Set the list of vehicle classes that may change right from this lane - :param value: [str] - """ - if value is not None: - self._change_right = [str(i) for i in value] - - @property - def speed(self) -> Union[None, float]: - """ - Get the lane speed in m/s - :return: None or float - """ - return self._speed - - @speed.setter - def speed(self, value): - """ - Set the lane speed in m/s - :param value: float - """ - if value is not None: - self._speed = float(value) - - @property - def width(self) -> Union[None, float]: - """ - Get the lane width in meters - :return: None or float - """ - return self._width - - @width.setter - def width(self, value): - """ - Set the lane width in meters - :param value: float - """ - if value is not None: - self._width = float(value) diff --git a/hub/city_model_structure/transport/origin_destination_edge.py b/hub/city_model_structure/transport/origin_destination_edge.py deleted file mode 100644 index c8b81a2b..00000000 --- a/hub/city_model_structure/transport/origin_destination_edge.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Origin-Destination edge module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List, TypeVar -from hub.city_model_structure.attributes.edge import Edge -from hub.city_model_structure.attributes.schedule import Schedule - -OriginDestinationNode = TypeVar('OriginDestinationNode') - - -class OriginDestinationEdge(Edge): - """ - OriginDestinationEdge class - Each edge is unidirectional and starts at the "from" node and ends at the "to" node - """ - - def __init__(self, name, nodes, edge_type='OriginDestinationEdge'): - super().__init__(name, nodes) - self._edge_type = edge_type - self._movement_schedule = None - - @property - def edge_type(self): - """ - Get the edge type - :return: str - """ - return self._edge_type - - @property - def nodes(self) -> List[OriginDestinationNode]: - """ - Get delimiting nodes for the edge - :return: [OriginDestinationNode] - """ - return self._nodes - - @property - def movement_schedule(self) -> Schedule: - """ - Get the schedule of the movement of people along this edge - :return: Schedule - """ - return self._movement_schedule diff --git a/hub/city_model_structure/transport/origin_destination_network.py b/hub/city_model_structure/transport/origin_destination_network.py deleted file mode 100644 index a5608d11..00000000 --- a/hub/city_model_structure/transport/origin_destination_network.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -Origin-Destination network module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List -from hub.city_model_structure.network import Network -from hub.city_model_structure.transport.origin_destination_edge import OriginDestinationEdge -from hub.city_model_structure.transport.origin_destination_node import OriginDestinationNode - - -class OriginDestinationNetwork(Network): - """ - OriginDestinationNetwork(Network) class - """ - def __init__(self, name, edges=None, nodes=None): - super().__init__(name, edges, nodes) - self._type = "OriginDestinationNetwork" - - @property - def type(self): - """ - Get network type - :return: str - """ - return self._type - - @property - def edges(self) -> List[OriginDestinationEdge]: - """ - Get network edges - :return: [OriginDestinationEdge] - """ - return self._edges - - @property - def nodes(self) -> List[OriginDestinationNode]: - """ - Get network nodes - :return: [OriginDestinationNode] - """ - return self._nodes diff --git a/hub/city_model_structure/transport/origin_destination_node.py b/hub/city_model_structure/transport/origin_destination_node.py deleted file mode 100644 index 8d9e8aa3..00000000 --- a/hub/city_model_structure/transport/origin_destination_node.py +++ /dev/null @@ -1,85 +0,0 @@ -""" -Origin-Destination node module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" -from typing import List, TypeVar - -from hub.city_model_structure.attributes.node import Node -from hub.city_model_structure.attributes.point import Point -from hub.city_model_structure.attributes.polygon import Polygon -from hub.city_model_structure.city_object import CityObject - -OriginDestinationEdge = TypeVar('OriginDestinationEdge') - - -class OriginDestinationNode(Node): - """ - OriginDestinationNode class - """ - - def __init__(self, name, coordinates, node_type='OriginDestinationNode', edges=None, polygon=None): - super().__init__(name, edges) - self._coordinates = coordinates - self._node_type = node_type - self._polygon = polygon - self._land_use_types = None - self._city_objects = None - - @property - def node_type(self): - """ - Get node type - :return: str - """ - return self._node_type - - @property - def coordinates(self) -> Point: - """ - Get node coordinates - :return: Point - """ - return self._coordinates - - @coordinates.setter - def coordinates(self, value): - """ - Set node coordinates - :param value: Point - """ - self._coordinates = value - - @property - def edges(self) -> List[OriginDestinationEdge]: - """ - get edges delimited by the node - :return: [OriginDestinationEdge] - """ - return self._edges - - @property - def polygon(self) -> Polygon: - """ - Get node polygon that defines the zone represented by the node - :return: Polygon - """ - return self._polygon - - @property - def land_use_types(self) -> dict: - """ - Get land use types inside the node polygon. It returns a dictionary with the types of land use together with the - percentage of the land that corresponds to each type - :return: {string : float} - """ - return self._land_use_types - - @property - def city_objects(self) -> List[CityObject]: - """ - Get the list of city objects place inside the zone - :return: List[CityObject] - """ - return self._city_objects diff --git a/hub/city_model_structure/transport/phase.py b/hub/city_model_structure/transport/phase.py deleted file mode 100644 index a6669fa4..00000000 --- a/hub/city_model_structure/transport/phase.py +++ /dev/null @@ -1,134 +0,0 @@ -""" -Phase module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import List, Union - - -class Phase: - """ - Phase class - """ - - def __init__(self): - self._duration = None - self._state = None - self._min_duration = None - self._max_duration = None - self._name = None - self._next = None - - @property - def duration(self) -> Union[None, int]: - """ - Get phase duration in seconds - :return: None or int - """ - return self._duration - - @duration.setter - def duration(self, value): - """ - Set phase duration in seconds - :param value: int - """ - if value is not None: - self._duration = int(value) - - @property - def state(self) -> Union[None, List[str]]: - """ - Get the list of signal states - :return: None or [str] - """ - return self._state - - @state.setter - def state(self, value): - """ - Set the list of signal states - :param value: [str] - """ - if value is not None: - self._state = [str(i) for i in value] - - @property - def min_duration(self) -> Union[None, int]: - """ - Get phase minimum duration in seconds - :return: None or int - """ - if self._min_duration is None: - self._min_duration = self._duration - return self._min_duration - - @min_duration.setter - def min_duration(self, value): - """ - Set phase minimum duration in seconds - :param value: int - """ - if value is not None: - self._min_duration = int(value) - - @property - def max_duration(self) -> Union[None, int]: - """ - Get phase maximum duration in seconds - :return: None or int - """ - if self._max_duration is None: - self._max_duration = self._duration - return self._max_duration - - @max_duration.setter - def max_duration(self, value): - """ - Set phase maximum duration in seconds - :param value: int - """ - if value is not None: - self._max_duration = int(value) - - @property - def name(self) -> Union[None, str]: - """ - Get phase name - :return: None or str - """ - return self._name - - @name.setter - def name(self, value): - """ - Set phase name - :param value: str - """ - if value is not None: - self._name = str(value) - - @property - def next(self) -> Union[None, List[int]]: - """ - Get the next phase in the cycle after the current. - This is useful when adding extra transition phases to a traffic light plan which are not part of every cycle. - Traffic lights of type 'actuated' can make use of a list of indices for selecting among alternative - successor phases. - :return: None or [int] - """ - return self._next - - @next.setter - def next(self, value): - """ - Get the next phase in the cycle after the current. - This is useful when adding extra transition phases to a traffic light plan which are not part of every cycle. - Traffic lights of type 'actuated' can make use of a list of indices for selecting among alternative - successor phases. - :param value: [int] - """ - if value is not None: - self._next = [int(i) for i in value] diff --git a/hub/city_model_structure/transport/traffic_edge.py b/hub/city_model_structure/transport/traffic_edge.py deleted file mode 100644 index 0978b5ec..00000000 --- a/hub/city_model_structure/transport/traffic_edge.py +++ /dev/null @@ -1,150 +0,0 @@ -""" -Traffic edge module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -from typing import List, Union -from hub.city_model_structure.attributes.edge import Edge -from hub.city_model_structure.transport.traffic_node import TrafficNode -from hub.city_model_structure.transport.lane import Lane - - -class TrafficEdge(Edge): - """ - TrafficEdge class - Each edge is unidirectional and starts at the "from" node and ends at the "to" node - """ - - def __init__(self, name, nodes, priority, speed, lanes, length, allows=None, disallows=None, sidewalk_width=None, - edge_type='TrafficEdge'): - super().__init__(name, nodes) - self._edge_type = edge_type - self._lanes = lanes - self._priority = priority - self._speed = speed - self._length = length - self._allows = allows - self._disallows = disallows - self._sidewalk_width = sidewalk_width - - @property - def edge_type(self): - """ - Get the edge type - :return: str - """ - return self._edge_type - - @property - def nodes(self) -> List[TrafficNode]: - """ - Get delimiting nodes for the edge - :return: [TrafficNode] - """ - return self._nodes - - @property - def lanes(self) -> List[Lane]: - """ - Get the lanes on an edge - :return: List[Lane] - """ - return self._lanes - - @lanes.setter - def lanes(self, value): - """ - Set the lanes on an edge - :param value: List[Lane] - """ - self._lanes = value - - @property - def priority(self) -> Union[None, int]: - """ - Get the priority between different road types. - It starts with one; higher numbers represent more important roads. - :return: None or int - """ - return self._priority - - @priority.setter - def priority(self, value): - """ - Set the priority between different road types. - It starts with one; higher numbers represent more important roads. - :param value: int - """ - if value is not None: - self._priority = int(value) - - @property - def speed(self) -> Union[None, float]: - """ - Get he speed limit in m/s - :return: None or float - """ - return self._speed - - @speed.setter - def speed(self, value): - """ - Set the speed limit in m/s - :param value: float - """ - if value is not None: - self._speed = float(value) - - @property - def length(self) -> Union[None, float]: - """ - Get the lane length in meters - :return: None or float - """ - return self._length - - @length.setter - def length(self, value): - """ - Set the lane length in meters - :param value: float - """ - if value is not None: - self._length = float(value) - - @property - def allows(self) -> Union[None, List[str]]: - """ - Get the list of allowed vehicle classes - :return: None or [str] - """ - return self._allows - - @allows.setter - def allows(self, value): - """ - Set the list of allowed vehicle classes - :param value: [str] - """ - if value is not None: - self._allows = [str(i) for i in value] - - @property - def disallows(self) -> Union[None, List[str]]: - """ - Get the list of not allowed vehicle classes - :return: None or [str] - """ - return self._disallows - - @disallows.setter - def disallows(self, value): - """ - Set the list of not allowed vehicle classes - :param value: [str] - """ - if value is not None: - self._disallows = [str(i) for i in value] diff --git a/hub/city_model_structure/transport/traffic_light.py b/hub/city_model_structure/transport/traffic_light.py deleted file mode 100644 index 12fe8a41..00000000 --- a/hub/city_model_structure/transport/traffic_light.py +++ /dev/null @@ -1,75 +0,0 @@ -""" -Traffic light module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -import ast -from typing import List, Union -from hub.city_model_structure.transport.phase import Phase -from hub.city_model_structure.transport.traffic_node import TrafficNode - - -class TrafficLight(TrafficNode): - """ - Traffic light class - """ - def __init__(self, name, coordinates, offset, phases=None, edges=None, right_on_red=False): - super().__init__(name, coordinates, edges=edges, node_type='TrafficLight') - if phases is None: - phases = [] - self._right_on_red = right_on_red - self._offset = offset - self._phases = phases - - @property - def right_on_red(self) -> Union[None, bool]: - """ - Get if is possible to turn right when the traffic light is red - :return: None or Boolean - """ - return self._right_on_red - - @right_on_red.setter - def right_on_red(self, value): - """ - Get if is possible to turn right when the traffic light is red - :param value: Boolean - """ - if value is not None: - self._right_on_red = ast.literal_eval(value) - - @property - def offset(self) -> Union[None, int]: - """ - Get program initial time offset - :return: None or int - """ - return self._offset - - @offset.setter - def offset(self, value): - """ - Set program initial time offset - :param value: int - """ - if value is not None: - self._offset = int(value) - - @property - def phases(self) -> List[Phase]: - """ - Get traffic light logic phases - :return: [Phase] - """ - return self._phases - - @phases.setter - def phases(self, value): - """ - Set traffic light logic phases - :param value: [Phase] - """ - self._phases = value diff --git a/hub/city_model_structure/transport/traffic_network.py b/hub/city_model_structure/transport/traffic_network.py deleted file mode 100644 index cf07da72..00000000 --- a/hub/city_model_structure/transport/traffic_network.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Traffic network module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -from typing import List -from hub.city_model_structure.network import Network -from hub.city_model_structure.transport.traffic_edge import TrafficEdge -from hub.city_model_structure.transport.traffic_node import TrafficNode - - -class TrafficNetwork(Network): - """ - TrafficNetwork(Network) class - """ - def __init__(self, name, edges=None, nodes=None): - super().__init__(name, edges, nodes) - self._type = "TrafficNetwork" - - @property - def type(self): - """ - Get network type - :return: str - """ - return self._type - - @property - def edges(self) -> List[TrafficEdge]: - """ - Get network edges - :return: [TrafficEdge] - """ - return self._edges - - @property - def nodes(self) -> List[TrafficNode]: - """ - Get network nodes - :return: [TrafficNode] - """ - return self._nodes diff --git a/hub/city_model_structure/transport/traffic_node.py b/hub/city_model_structure/transport/traffic_node.py deleted file mode 100644 index 1f53d7fc..00000000 --- a/hub/city_model_structure/transport/traffic_node.py +++ /dev/null @@ -1,97 +0,0 @@ -""" -TrafficNode module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -from typing import List, TypeVar - -from hub.city_model_structure.attributes.edge import Edge -from hub.city_model_structure.attributes.node import Node -from hub.city_model_structure.attributes.point import Point - -Connection = TypeVar('Connection') -TrafficEdge = TypeVar('TrafficEdge') - - -class TrafficNode(Node): - """ - TrafficNode class - """ - - def __init__(self, name, coordinates, node_type='TrafficNode', edges=None, prohibitions=None, connections=None): - super().__init__(name, edges) - if connections is None: - connections = [] - if prohibitions is None: - prohibitions = [] - self._coordinates = coordinates - self._prohibitions = prohibitions - self._connections = connections - self._node_type = node_type - - @property - def node_type(self): - """ - Get node type - :return: str - """ - return self._node_type - - @property - def coordinates(self) -> Point: - """ - Get node coordinates - :return: Point - """ - return self._coordinates - - @coordinates.setter - def coordinates(self, value): - """ - Set node coordinates - :param value: Point - """ - self._coordinates = value - - @property - def edges(self) -> List[TrafficEdge]: - """ - get edges delimited by the node - :return: [TrafficEdge] - """ - return self._edges - - @property - def prohibitions(self) -> [(Edge, Edge)]: - """ - Get node prohibitions - :return: [(Edge, Edge)] - """ - return self._prohibitions - - @prohibitions.setter - def prohibitions(self, value): - """ - Set node prohibitions - :param value: [(Edge, Edge)] - """ - self._prohibitions = value - - @property - def connections(self) -> List[Connection]: - """ - Get node connections - :return: [Connection] - """ - return self._connections - - @connections.setter - def connections(self, value): - """ - Set node connections - :param value: [Connection] - """ - self._connections = value diff --git a/hub/city_model_structure/transport/walkway_node.py b/hub/city_model_structure/transport/walkway_node.py deleted file mode 100644 index 198f673b..00000000 --- a/hub/city_model_structure/transport/walkway_node.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Walkway node module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -Code contributors: Guille guille.gutierrezmorote@concordia.ca -""" - -from typing import List, Union -from hub.city_model_structure.transport.traffic_node import TrafficNode - - -class WalkwayNode(TrafficNode): - """ - WalkwayNode class - """ - - def __init__(self, name, coordinates, edges=None, shape=None): - super().__init__(name, coordinates, edges=edges, node_type='WalkwayNode') - self._shape = shape - - @property - def shape(self) -> Union[None, List[List[float]]]: - """ - Get the list of positions - :return: None or [[x, y, (z)]] - """ - return self._shape - - @shape.setter - def shape(self, value): - """ - Set the list of positions - :param value: [[x, y, (z)]] - """ - if value is not None: - self._shape = [[float(i) for i in value]] diff --git a/hub/exports/building_energy/idf.py b/hub/exports/building_energy/idf.py index df55aa4e..320d184d 100644 --- a/hub/exports/building_energy/idf.py +++ b/hub/exports/building_energy/idf.py @@ -448,22 +448,24 @@ class Idf: def _add_infiltration(self, thermal_zone, zone_name): schedule = f'Infiltration schedules {thermal_zone.usage_name}' + _infiltration = thermal_zone.infiltration_rate_system_off * cte.HOUR_TO_SECONDS self._idf.newidfobject(self._INFILTRATION, Name=f'{zone_name}_infiltration', Zone_or_ZoneList_Name=zone_name, Schedule_Name=schedule, Design_Flow_Rate_Calculation_Method='AirChanges/Hour', - Air_Changes_per_Hour=thermal_zone.infiltration_rate_system_off + Air_Changes_per_Hour=_infiltration ) def _add_ventilation(self, thermal_zone, zone_name): schedule = f'Ventilation schedules {thermal_zone.usage_name}' + _air_change = thermal_zone.mechanical_air_change * cte.HOUR_TO_SECONDS self._idf.newidfobject(self._VENTILATION, Name=f'{zone_name}_ventilation', Zone_or_ZoneList_Name=zone_name, Schedule_Name=schedule, Design_Flow_Rate_Calculation_Method='AirChanges/Hour', - Air_Changes_per_Hour=thermal_zone.mechanical_air_change + Air_Changes_per_Hour=_air_change ) def _add_dhw(self, thermal_zone, zone_name): diff --git a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py index d47dc4bb..fc4997af 100644 --- a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py +++ b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py @@ -167,11 +167,11 @@ class InselMonthlyEnergyBalance: infiltration_day = 0 for value in schedule.values: if value == 0: - infiltration_day += internal_zone.thermal_zones[0].infiltration_rate_system_off / 24 + infiltration_day += internal_zone.thermal_zones[0].infiltration_rate_system_off / 24 * cte.HOUR_TO_SECONDS ventilation_day += 0 else: - ventilation_value = usage.mechanical_air_change * value - infiltration_value = internal_zone.thermal_zones[0].infiltration_rate_system_off * value + ventilation_value = usage.mechanical_air_change * value * cte.HOUR_TO_SECONDS + infiltration_value = internal_zone.thermal_zones[0].infiltration_rate_system_off * value * cte.HOUR_TO_SECONDS if ventilation_value >= infiltration_value: ventilation_day += ventilation_value / 24 infiltration_day += 0 @@ -259,7 +259,7 @@ class InselMonthlyEnergyBalance: if cte.MONTH not in surface.global_irradiance: raise ValueError(f'surface: {surface.name} from building {building.name} has no global irradiance!') - global_irradiance = surface.global_irradiance[cte.MONTH] + global_irradiance = surface.global_irradiance[cte.MONTH] * cte.WATTS_HOUR_TO_JULES for j in range(0, len(global_irradiance)): parameters.append(f'{j + 1} ' f'{global_irradiance[j] / 24 / _NUMBER_DAYS_PER_MONTH[j]}') diff --git a/hub/helpers/constants.py b/hub/helpers/constants.py index 2c84b587..31f89eff 100644 --- a/hub/helpers/constants.py +++ b/hub/helpers/constants.py @@ -22,6 +22,7 @@ HOUR_TO_SECONDS = 3600 METERS_TO_FEET = 3.28084 BTU_H_TO_WATTS = 0.29307107 KILO_WATTS_HOUR_TO_JULES = 3600000 +WATTS_HOUR_TO_JULES = 3600 GALLONS_TO_QUBIC_METERS = 0.0037854117954011185 # time diff --git a/hub/helpers/peak_calculation/loads_calculation.py b/hub/helpers/peak_calculation/loads_calculation.py index 75baaf31..8326d76f 100644 --- a/hub/helpers/peak_calculation/loads_calculation.py +++ b/hub/helpers/peak_calculation/loads_calculation.py @@ -46,12 +46,11 @@ class LoadsCalculation: load_renovation_sensible = 0 for usage in thermal_zone.usages: load_renovation_sensible += cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * usage.mechanical_air_change \ - * thermal_zone.volume / cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS \ - * (internal_temperature - ambient_temperature) + * thermal_zone.volume * (internal_temperature - ambient_temperature) load_infiltration_sensible = ( - cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * thermal_zone.infiltration_rate_system_off * thermal_zone.volume / - cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS * (internal_temperature - ambient_temperature) + cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * thermal_zone.infiltration_rate_system_off * thermal_zone.volume + * (internal_temperature - ambient_temperature) ) load_ventilation = load_renovation_sensible + load_infiltration_sensible @@ -142,7 +141,7 @@ class LoadsCalculation: for thermal_zone in internal_zone.thermal_zones: for thermal_boundary in thermal_zone.thermal_boundaries: for thermal_opening in thermal_boundary.thermal_openings: - radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][hour] + radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][hour] * cte.WATTS_HOUR_TO_JULES cooling_load_radiation += ( thermal_opening.area * (1 - thermal_opening.frame_ratio) * thermal_opening.g_value * radiation ) diff --git a/hub/imports/results/simplified_radiosity_algorithm.py b/hub/imports/results/simplified_radiosity_algorithm.py index 653a13ee..46ba4e84 100644 --- a/hub/imports/results/simplified_radiosity_algorithm.py +++ b/hub/imports/results/simplified_radiosity_algorithm.py @@ -34,7 +34,8 @@ class SimplifiedRadiosityAlgorithm: for key in self._results: _irradiance = {} header_name = key.split(':') - result = self._results[key] + # todo: @Pilar!!!!!!!!!!!!!!!!!!!!!!!! + result = self._results[key] / cte.WATTS_HOUR_TO_JULES city_object_name = header_name[1] building = self._city.city_object(city_object_name) surface_id = header_name[2] diff --git a/hub/imports/usage/comnet_usage_parameters.py b/hub/imports/usage/comnet_usage_parameters.py index 69e1902e..02f9b77e 100644 --- a/hub/imports/usage/comnet_usage_parameters.py +++ b/hub/imports/usage/comnet_usage_parameters.py @@ -71,8 +71,7 @@ class ComnetUsageParameters: # Due to the fact that python is not a typed language, the wrong object type is assigned to # usage.occupancy when writing usage.occupancy = archetype.occupancy. # Same happens for lighting and appliances. Therefore, this walk around has been done. - usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area \ - * cte.HOUR_TO_SECONDS + usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area _occupancy = Occupancy() _occupancy.occupancy_density = archetype.occupancy.occupancy_density _occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain diff --git a/hub/imports/usage/eilat_usage_parameters.py b/hub/imports/usage/eilat_usage_parameters.py index 5690c3f1..17cf69e7 100644 --- a/hub/imports/usage/eilat_usage_parameters.py +++ b/hub/imports/usage/eilat_usage_parameters.py @@ -71,8 +71,7 @@ class EilatUsageParameters: # Due to the fact that python is not a typed language, the wrong object type is assigned to # usage.occupancy when writing usage.occupancy = archetype.occupancy. # Same happens for lighting and appliances. Therefore, this walk around has been done. - usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area \ - * cte.HOUR_TO_SECONDS + usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area _occupancy = Occupancy() _occupancy.occupancy_density = archetype.occupancy.occupancy_density _occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain diff --git a/hub/imports/usage/nrcan_usage_parameters.py b/hub/imports/usage/nrcan_usage_parameters.py index 8106132f..9d718d33 100644 --- a/hub/imports/usage/nrcan_usage_parameters.py +++ b/hub/imports/usage/nrcan_usage_parameters.py @@ -92,11 +92,11 @@ class NrcanUsageParameters: @staticmethod def _assign_values(usage, archetype, volume_per_area, cold_water_temperature): if archetype.mechanical_air_change > 0: - # ACH + # 1/s usage.mechanical_air_change = archetype.mechanical_air_change elif archetype.ventilation_rate > 0: - # m3/m2.s to ACH - usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area * cte.HOUR_TO_SECONDS + # m3/m2.s to 1/s + usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area else: usage.mechanical_air_change = 0 _occupancy = Occupancy() diff --git a/tests/test_custom_insel_block.py b/tests/test_custom_insel_block.py index aeb715ed..6cd5cd09 100644 --- a/tests/test_custom_insel_block.py +++ b/tests/test_custom_insel_block.py @@ -51,7 +51,8 @@ class TestExports(TestCase): _irradiance = {} for key in self._results: header_name = key.split(':') - result = self._results[key] + # todo: @Pilar!!!!!!!!!!!!!!!!!!!!!!!! + result = self._results[key] / cte.WATTS_HOUR_TO_JULES city_object_name = header_name[1] building = self._city.city_object(city_object_name) surface_id = header_name[2] diff --git a/tests/test_db_factory.py b/tests/test_db_factory.py index 6f760bbc..ec72e37d 100644 --- a/tests/test_db_factory.py +++ b/tests/test_db_factory.py @@ -274,8 +274,8 @@ TestDBFactory {'yearly_domestic_hot_water_consumption': yearly_domestic_hot_water_consumption}, {'monthly_distribution_systems_electrical_consumption': monthly_distribution_systems_electrical_consumption}, {'yearly_distribution_systems_electrical_consumption': yearly_distribution_systems_electrical_consumption}, - {'monthly_on_site_electrical_production': monthly_on_site_electrical_production}, - {'yearly_on_site_electrical_production': yearly_on_site_electrical_production} + {'monthly_on_site_electrical_production': monthly_on_site_electrical_production * cte.WATTS_HOUR_TO_JULES}, + {'yearly_on_site_electrical_production': yearly_on_site_electrical_production * cte.WATTS_HOUR_TO_JULES} ]}) db_building_id = _building.id diff --git a/tests/test_insel_exports.py b/tests/test_insel_exports.py index bca43173..03535198 100644 --- a/tests/test_insel_exports.py +++ b/tests/test_insel_exports.py @@ -51,7 +51,8 @@ class TestExports(TestCase): _irradiance = {} for key in self._results: header_name = key.split(':') - result = self._results[key] + # todo: @Pilar!!!!!!!!!!!!!!!!!!!!!!!! + result = self._results[key] / cte.WATTS_HOUR_TO_JULES city_object_name = header_name[1] building = self._city.city_object(city_object_name) surface_id = header_name[2] diff --git a/tests/test_systems_factory.py b/tests/test_systems_factory.py index 46d07149..8d191043 100644 --- a/tests/test_systems_factory.py +++ b/tests/test_systems_factory.py @@ -115,4 +115,4 @@ class TestSystemsFactory(TestCase): self.assertLess(0, building.heating_consumption[cte.YEAR][0]) self.assertLess(0, building.cooling_consumption[cte.YEAR][0]) self.assertLess(0, building.domestic_hot_water_consumption[cte.YEAR][0]) - self.assertLess(0, building.onsite_electrical_production[cte.YEAR][0]) \ No newline at end of file + self.assertLess(0, building.onsite_electrical_production[cte.YEAR][0])