diff --git a/city_model_structure/building.py b/city_model_structure/building.py index 68fc6ca8..58386b0e 100644 --- a/city_model_structure/building.py +++ b/city_model_structure/building.py @@ -10,10 +10,10 @@ import sys from typing import List import numpy as np import math -from city_model_structure.attributes.surface import Surface -from city_model_structure.attributes.thermal_zone import ThermalZone -from city_model_structure.attributes.usage_zone import UsageZone -from city_model_structure.attributes.storey import Storey +from city_model_structure.building_demand.surface import Surface +from city_model_structure.building_demand.thermal_zone import ThermalZone +from city_model_structure.building_demand.usage_zone import UsageZone +from city_model_structure.building_demand.storey import Storey from city_model_structure.attributes.polygon import Polygon from city_model_structure.attributes.point import Point from city_model_structure.city_object import CityObject diff --git a/city_model_structure/attributes/internal_gains.py b/city_model_structure/building_demand/internal_gains.py similarity index 100% rename from city_model_structure/attributes/internal_gains.py rename to city_model_structure/building_demand/internal_gains.py diff --git a/city_model_structure/attributes/layer.py b/city_model_structure/building_demand/layer.py similarity index 94% rename from city_model_structure/attributes/layer.py rename to city_model_structure/building_demand/layer.py index 2f07ac5b..69860270 100644 --- a/city_model_structure/attributes/layer.py +++ b/city_model_structure/building_demand/layer.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ import uuid -from city_model_structure.attributes.material import Material +from city_model_structure.building_demand.material import Material class Layer: diff --git a/city_model_structure/attributes/material.py b/city_model_structure/building_demand/material.py similarity index 100% rename from city_model_structure/attributes/material.py rename to city_model_structure/building_demand/material.py diff --git a/city_model_structure/attributes/occupants.py b/city_model_structure/building_demand/occupants.py similarity index 100% rename from city_model_structure/attributes/occupants.py rename to city_model_structure/building_demand/occupants.py diff --git a/city_model_structure/attributes/storey.py b/city_model_structure/building_demand/storey.py similarity index 92% rename from city_model_structure/attributes/storey.py rename to city_model_structure/building_demand/storey.py index 568c506b..590bcaba 100644 --- a/city_model_structure/attributes/storey.py +++ b/city_model_structure/building_demand/storey.py @@ -8,9 +8,9 @@ from __future__ import annotations from typing import List import numpy as np -from city_model_structure.attributes.surface import Surface -from city_model_structure.attributes.thermal_boundary import ThermalBoundary -from city_model_structure.attributes.thermal_zone import ThermalZone +from city_model_structure.building_demand.surface import Surface +from city_model_structure.building_demand.thermal_boundary import ThermalBoundary +from city_model_structure.building_demand.thermal_zone import ThermalZone import helpers.constants as cte diff --git a/city_model_structure/attributes/surface.py b/city_model_structure/building_demand/surface.py similarity index 98% rename from city_model_structure/attributes/surface.py rename to city_model_structure/building_demand/surface.py index 9a1a035d..eb162ad6 100644 --- a/city_model_structure/attributes/surface.py +++ b/city_model_structure/building_demand/surface.py @@ -11,8 +11,8 @@ import uuid from city_model_structure.attributes.polygon import Polygon from city_model_structure.attributes.plane import Plane from city_model_structure.attributes.point import Point -from city_model_structure.attributes.pv_system import PvSystem -from city_model_structure.attributes.thermal_boundary import ThermalBoundary +from city_model_structure.energy_systems.pv_system import PvSystem +from city_model_structure.building_demand.thermal_boundary import ThermalBoundary import helpers.constants as cte diff --git a/city_model_structure/attributes/thermal_boundary.py b/city_model_structure/building_demand/thermal_boundary.py similarity index 98% rename from city_model_structure/attributes/thermal_boundary.py rename to city_model_structure/building_demand/thermal_boundary.py index b02b97c5..7e992a30 100644 --- a/city_model_structure/attributes/thermal_boundary.py +++ b/city_model_structure/building_demand/thermal_boundary.py @@ -5,8 +5,8 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ from typing import List, TypeVar, Union -from city_model_structure.attributes.layer import Layer -from city_model_structure.attributes.thermal_opening import ThermalOpening +from city_model_structure.building_demand.layer import Layer +from city_model_structure.building_demand.thermal_opening import ThermalOpening ThermalZone = TypeVar('ThermalZone') Polygon = TypeVar('Polygon') diff --git a/city_model_structure/attributes/thermal_opening.py b/city_model_structure/building_demand/thermal_opening.py similarity index 100% rename from city_model_structure/attributes/thermal_opening.py rename to city_model_structure/building_demand/thermal_opening.py diff --git a/city_model_structure/attributes/thermal_zone.py b/city_model_structure/building_demand/thermal_zone.py similarity index 97% rename from city_model_structure/attributes/thermal_zone.py rename to city_model_structure/building_demand/thermal_zone.py index c07843e8..f6db43c4 100644 --- a/city_model_structure/attributes/thermal_zone.py +++ b/city_model_structure/building_demand/thermal_zone.py @@ -6,8 +6,8 @@ Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ import uuid from typing import List, TypeVar -from city_model_structure.attributes.surface import Surface -from city_model_structure.attributes.usage_zone import UsageZone +from city_model_structure.building_demand.surface import Surface +from city_model_structure.building_demand.usage_zone import UsageZone ThermalBoundary = TypeVar('ThermalBoundary') Polyhedron = TypeVar('Polyhedron') diff --git a/city_model_structure/attributes/usage_zone.py b/city_model_structure/building_demand/usage_zone.py similarity index 100% rename from city_model_structure/attributes/usage_zone.py rename to city_model_structure/building_demand/usage_zone.py diff --git a/city_model_structure/city_object.py b/city_model_structure/city_object.py index aa08dedc..329e276e 100644 --- a/city_model_structure/city_object.py +++ b/city_model_structure/city_object.py @@ -3,9 +3,9 @@ CityObject module SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ -from city_model_structure.attributes.sensor import Sensor +from city_model_structure.iot.sensor import Sensor from typing import List, Union -from city_model_structure.attributes.surface import Surface +from city_model_structure.building_demand.surface import Surface from city_model_structure.attributes.polyhedron import Polyhedron from helpers.configuration_helper import ConfigurationHelper diff --git a/city_model_structure/city_objects_cluster.py b/city_model_structure/city_objects_cluster.py index 7bcdc49e..d52ec264 100644 --- a/city_model_structure/city_objects_cluster.py +++ b/city_model_structure/city_objects_cluster.py @@ -6,7 +6,7 @@ Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.mons from abc import ABC from typing import List -from city_model_structure.attributes.sensor import Sensor +from city_model_structure.iot.sensor import Sensor from city_model_structure.city_object import CityObject diff --git a/city_model_structure/attributes/heat_pump.py b/city_model_structure/energy_systems/heat_pump.py similarity index 100% rename from city_model_structure/attributes/heat_pump.py rename to city_model_structure/energy_systems/heat_pump.py diff --git a/city_model_structure/attributes/pv_system.py b/city_model_structure/energy_systems/pv_system.py similarity index 100% rename from city_model_structure/attributes/pv_system.py rename to city_model_structure/energy_systems/pv_system.py diff --git a/city_model_structure/attributes/concordia_energy_sensor.py b/city_model_structure/iot/concordia_energy_sensor.py similarity index 94% rename from city_model_structure/attributes/concordia_energy_sensor.py rename to city_model_structure/iot/concordia_energy_sensor.py index e6be9ed4..0c3e66c9 100644 --- a/city_model_structure/attributes/concordia_energy_sensor.py +++ b/city_model_structure/iot/concordia_energy_sensor.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ -from city_model_structure.attributes.sensor import Sensor +from city_model_structure.iot.sensor import Sensor import pandas as pd diff --git a/city_model_structure/attributes/concordia_gas_flow_sensor.py b/city_model_structure/iot/concordia_gas_flow_sensor.py similarity index 94% rename from city_model_structure/attributes/concordia_gas_flow_sensor.py rename to city_model_structure/iot/concordia_gas_flow_sensor.py index 2f36abe8..7b87a866 100644 --- a/city_model_structure/attributes/concordia_gas_flow_sensor.py +++ b/city_model_structure/iot/concordia_gas_flow_sensor.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ -from city_model_structure.attributes.sensor import Sensor +from city_model_structure.iot.sensor import Sensor import pandas as pd diff --git a/city_model_structure/attributes/concordia_temperature_sensor.py b/city_model_structure/iot/concordia_temperature_sensor.py similarity index 94% rename from city_model_structure/attributes/concordia_temperature_sensor.py rename to city_model_structure/iot/concordia_temperature_sensor.py index 227edd51..8c4d0a6c 100644 --- a/city_model_structure/attributes/concordia_temperature_sensor.py +++ b/city_model_structure/iot/concordia_temperature_sensor.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ -from city_model_structure.attributes.sensor import Sensor +from city_model_structure.iot.sensor import Sensor import pandas as pd diff --git a/city_model_structure/attributes/sensor.py b/city_model_structure/iot/sensor.py similarity index 100% rename from city_model_structure/attributes/sensor.py rename to city_model_structure/iot/sensor.py diff --git a/city_model_structure/traffic_network.py b/city_model_structure/traffic_network.py new file mode 100644 index 00000000..9f56d066 --- /dev/null +++ b/city_model_structure/traffic_network.py @@ -0,0 +1,148 @@ +""" +Traffic network module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List +from city_model_structure.city_object import CityObject +from city_model_structure.transport.road_type import RoadType +from city_model_structure.transport.node import Node +from city_model_structure.transport.join import Join +from city_model_structure.transport.join_exclude import JoinExclude +from city_model_structure.transport.edge import Edge +from city_model_structure.transport.roundabout import Roundabout +from city_model_structure.transport.connection import Connection +from city_model_structure.transport.crossing import Crossing +from city_model_structure.transport.walking_area import WalkingArea +from city_model_structure.transport.traffic_light_logic import TrafficLightLogic + + +class TrafficNetwork(CityObject): + """ + TrafficNetwork(CityObject) class + """ + def __init__(self, name, lod, surfaces, city_lower_corner): + super().__init__(name, lod, surfaces, city_lower_corner) + self._types = None + self._nodes = None + self._joins = None + self._join_excludes = None + self._edges = None + self._roundabouts = None + self._connections = None + self._prohibitions = None + self._crossings = None + self._walking_areas = None + self._traffic_light_logics = None + + @property + def types(self) -> List[RoadType]: + return self._types + + @types.setter + def types(self, value): + """ + :param value: [RoadType] + """ + self._types = value + + @property + def nodes(self) -> List[Node]: + return self._nodes + + @nodes.setter + def nodes(self, value): + """ + :param value: [Node] + """ + self._nodes = value + + @property + def joins(self) -> List[Join]: + return self._joins + + @joins.setter + def joins(self, value): + """ + :param value: [Join] + """ + self._joins = value + + @property + def join_excludes(self) -> List[JoinExclude]: + return self._join_excludes + + @join_excludes.setter + def join_excludes(self, value): + """ + :param value: [JoinExclude] + """ + self._join_excludes = value + + @property + def edges(self) -> List[Edge]: + return self._edges + + @edges.setter + def edges(self, value): + """ + :param value: [Edge] + """ + self._edges = value + + @property + def roundabouts(self) -> List[Roundabout]: + return self._roundabouts + + @roundabouts.setter + def roundabouts(self, value): + """ + :param value: [Roundabout] + """ + self._roundabouts = value + + @property + def connections(self) -> List[Connection]: + return self._connections + + @connections.setter + def connections(self, value): + """ + :param value: [Connection] + """ + self._connections = value + + @property + def crossings(self) -> List[Crossing]: + return self._crossings + + @crossings.setter + def crossings(self, value): + """ + :param value: [Crossing] + """ + self._crossings = value + + @property + def walking_areas(self) -> List[WalkingArea]: + return self._walking_areas + + @walking_areas.setter + def walking_areas(self, value): + """ + :param value: [WalkingArea] + """ + self._walking_areas = value + + @property + def traffic_light_logics(self) -> List[TrafficLightLogic]: + return self._traffic_light_logics + + @traffic_light_logics.setter + def traffic_light_logics(self, value): + """ + :param value: [TrafficLightLogic] + """ + self._traffic_light_logics = value diff --git a/city_model_structure/transport/connection.py b/city_model_structure/transport/connection.py new file mode 100644 index 00000000..6da75dc7 --- /dev/null +++ b/city_model_structure/transport/connection.py @@ -0,0 +1,121 @@ +""" +Connection module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import TypeVar + +Edge = TypeVar['Edge'] +Lane = TypeVar['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: + """ + Edge the vehicle leaves + :return: Edge + """ + return self._from_edge + + @from_edge.setter + def from_edge(self, value): + """ + Edge the vehicle leaves setter + :param value: Edge + """ + self._from_edge = value + + @property + def to_edge(self) -> Edge: + """ + Edge the vehicle reaches + :return: Edge + """ + return self._to_edge + + @to_edge.setter + def to_edge(self, value): + """ + Edge the vehicle reaches setter + :param value: Edge + """ + self._to_edge = value + + @property + def from_lane(self) -> Lane: + """ + Incoming lane + :return: Lane + """ + return self._to_lane + + @from_lane.setter + def from_lane(self, value): + """ + Incoming lane setter + :param value: Lane + """ + self._from_lane = value + + @property + def to_lane(self) -> Lane: + """ + Outgoing lane + :return: Lane + """ + return self._to_lane + + @to_lane.setter + def to_lane(self, value): + """ + Outgoing lane setter + :param value: Lane + """ + self._to_lane = value + + @property + def pass_not_wait(self): + """ + if set, vehicles which pass this (lane-2-lane) connection will not wait + :return: bool + """ + return self._pass + + @pass_not_wait.setter + def pass_not_wait(self, value): + """ + pass_not_wait setter + :param value: bool + """ + self._pass = value + + @property + def keep_clear(self): + """ + if set to false, vehicles which pass this (lane-2-lane) connection will not worry about blocking the intersection + :return: bool + """ + return self._keep_clear + + @keep_clear.setter + def keep_clear(self, value): + """ + keep_clear setter + :param value: bool + """ + self._keep_clear = value diff --git a/city_model_structure/transport/crossing.py b/city_model_structure/transport/crossing.py new file mode 100644 index 00000000..36cecae4 --- /dev/null +++ b/city_model_structure/transport/crossing.py @@ -0,0 +1,104 @@ +""" +Crossing module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Edge = TypeVar['Edge'] +Node = TypeVar['Node'] + + +class Crossing: + """ + Crossing class + """ + + def __init__(self): + self._node = None + self._edges = None + self._priority = None + self._width = None + self._shape = None + + @property + def node(self) -> Node: + """ + The node at which this crossing is located + :return: Node + """ + return self._node + + @node.setter + def node(self, value): + """ + The node at which this crossing is located setter + :param value: Node + """ + self._node = value + + @property + def edges(self) -> List[Edge]: + """ + The (road) edges which are crossed + :return: [Edge] + """ + return self._edges + + @edges.setter + def edges(self, value): + """ + The (road) edges which are crossed setter + :param value: [Edge] + """ + self._edges = value + + @property + def priority(self): + """ + Whether the pedestrians have priority over the vehicles (automatically set to true at tls-controlled intersections). + :return: bool + """ + return self._priority + + @priority.setter + def priority(self, value): + """ + Priority setter + :param value: bool + """ + self._priority = value + + @property + def width(self): + """ + Width in m + :return: float + """ + return self._width + + @width.setter + def width(self, value): + """ + Width in m setter + :param value: float + """ + self._width = value + + @property + def shape(self) -> List[List[float]]: + """ + List of positions (positions in m) + :return: [[x, y, (z)]] + """ + return self._shape + + @shape.setter + def shape(self, value): + """ + List of positions setter + :param value: [[x, y, (z)]] + """ + self._shape = value diff --git a/city_model_structure/transport/edge.py b/city_model_structure/transport/edge.py new file mode 100644 index 00000000..79696fa8 --- /dev/null +++ b/city_model_structure/transport/edge.py @@ -0,0 +1,168 @@ +""" +Edge module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Node = TypeVar['Node'] +Lane = TypeVar['Lane'] + + +class Edge: + """ + Edge class + Each edge is unidirectional and starts at the "from" node and ends at the "to" node + """ + + def __init__(self): + self._id = None + self._from_node = None + self._to_node = None + self._type = None + self._lanes = None + self._number_lanes = None + self._priority = None + self._speed = None + self._length = None + + @property + def id(self): + """ + Edge id + :return: str + """ + return self._id + + @id.setter + def id(self, value): + """ + Edge id setter + :param value: str + """ + self._id = value + + @property + def from_node(self) -> Node: + """ + Starting node + :return: Node + """ + return self._from_node + + @from_node.setter + def from_node(self, value): + """ + Starting node setter + :param value: Node + """ + self._from_node = value + + @property + def to_node(self) -> Node: + """ + Ending node + :return: Node + """ + return self._to_node + + @to_node.setter + def to_node(self, value): + """ + Ending node setter + :param value: Node + """ + self._to_node = value + + @property + def type(self): + """ + The name of a type within the SUMO edge type file + :return: str + """ + return self._type + + @type.setter + def type(self, value): + """ + Type setter + :param value: str + """ + self._type = value + + @property + def lanes(self) -> List[Lane]: + """ + List of lanes on an edge + :return: List[Lane] + """ + return self._lanes + + @lanes.setter + def lanes(self, value): + """ + List of lanes on an edge setter + :param value: List[Lane] + """ + self._lanes = value + + @property + def number_lanes(self): + """ + Number of default lanes on an edge + :return: int + """ + if self._number_lanes is None: + self._number_lanes = len(self.lanes) + return self._number_lanes + + @property + def priority(self): + """ + A number, which determines the priority between different road types. + It starts with one; higher numbers represent more important roads. + :return: int + """ + return self._priority + + @priority.setter + def priority(self, value): + """ + Priority setter + :param value: int + """ + self._priority = value + + @property + def speed(self): + """ + The speed limit in m/s + :return: float + """ + return self._speed + + @speed.setter + def speed(self, value): + """ + The speed limit in m/s setter + :param value: float + """ + self._speed = value + + @property + def length(self): + """ + Length in m + :return: float + """ + return self._length + + @length.setter + def length(self, value): + """ + Length in m setter + :param value: float + """ + self._length = value diff --git a/city_model_structure/transport/join.py b/city_model_structure/transport/join.py new file mode 100644 index 00000000..d226ca34 --- /dev/null +++ b/city_model_structure/transport/join.py @@ -0,0 +1,36 @@ +""" +Join module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Node = TypeVar['Node'] + + +class Join: + """ + Join class + """ + + def __init__(self): + self._nodes = None + self._nodes_ids = None + + @property + def nodes(self) -> List[Node]: + """ + List of nodes which are very close together forming a big cluster + :return: [Node] + """ + return self._nodes + + @nodes.setter + def nodes(self, value): + """ + List of nodes setter + :param value: [Node] + """ + self._nodes = value diff --git a/city_model_structure/transport/join_exclude.py b/city_model_structure/transport/join_exclude.py new file mode 100644 index 00000000..44cfaf87 --- /dev/null +++ b/city_model_structure/transport/join_exclude.py @@ -0,0 +1,36 @@ +""" +Join Exclude module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Node = TypeVar['Node'] + + +class JoinExclude: + """ + JoinExclude class + """ + + def __init__(self): + self._nodes = None + self._nodes_ids = None + + @property + def nodes(self) -> List[Node]: + """ + List of nodes which are excluded from the big cluster + :return: [Node] + """ + return self._nodes + + @nodes.setter + def nodes(self, value): + """ + List of nodes setter + :param value: [Node] + """ + self._nodes = value diff --git a/city_model_structure/transport/lane.py b/city_model_structure/transport/lane.py new file mode 100644 index 00000000..d89481d8 --- /dev/null +++ b/city_model_structure/transport/lane.py @@ -0,0 +1,136 @@ +""" +Lane module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List + + +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): + """ + Lane index + The enumeration index of the lane (0 is the rightmost lane, -1 is the leftmost one) + :return: int + """ + return self._index + + @index.setter + def index(self, value): + """ + Index setter + :param value: int + """ + self._index = value + + @property + def allow(self) -> List[str]: + """ + List of allowed vehicle classes + :return: [str] + """ + return self._allow + + @allow.setter + def allow(self, value): + """ + List of allowed vehicle classes setter + :param value: [str] + """ + self._allow = value + + @property + def disallow(self) -> List[str]: + """ + List of not allowed vehicle classes + :return: [str] + """ + return self._disallow + + @disallow.setter + def disallow(self, value): + """ + List of not allowed vehicle classes setter + :param value: [str] + """ + self._disallow = value + + @property + def change_left(self) -> List[str]: + """ + List of vehicle classes that may change left from this lane + :return: [str] + """ + return self._change_left + + @change_left.setter + def change_left(self, value): + """ + change_left setter + :param value: [str] + """ + self._change_left = value + + @property + def change_right(self) -> List[str]: + """ + List of vehicle classes that may change right from this lane + :return: [str] + """ + return self._change_right + + @change_right.setter + def change_right(self, value): + """ + change_right setter + :param value: [str] + """ + self._change_right = value + + @property + def speed(self): + """ + Speed in m/s + :return: float + """ + return self._speed + + @speed.setter + def speed(self, value): + """ + Speed in m/s setter + :param value: float + """ + self._speed = value + + @property + def width(self): + """ + Width in m + :return: float + """ + return self._width + + @width.setter + def width(self, value): + """ + Width in m setter + :param value: float + """ + self._width = value diff --git a/city_model_structure/transport/node.py b/city_model_structure/transport/node.py new file mode 100644 index 00000000..86c217d3 --- /dev/null +++ b/city_model_structure/transport/node.py @@ -0,0 +1,92 @@ +""" +Node module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + + +class Node: + """ + Node class + """ + + def __init__(self): + self._id = None + self._x = None + self._y = None + self._z = None + self._type = None + + @property + def id(self): + """ + Node id + :return: str + """ + return self._id + + @id.setter + def id(self, value): + """ + Node id setter + :param value: str + """ + self._id = value + + @property + def x(self): + """ + The x-position of the node on the plane in m + :return: float + """ + return self._x + + @x.setter + def x(self, value): + """ + The x-position of the node on the plane in m setter + :param value: float + """ + self._x = value + + @property + def y(self): + """ + The y-position of the node on the plane in m + :return: float + """ + return self._y + + @y.setter + def y(self, value): + """ + The y-position of the node on the plane in m setter + :param value: float + """ + self._y = value + + @property + def z(self): + """ + The z-position of the node on the plane in m + :return: float + """ + return self._z + + @z.setter + def z(self, value): + """ + The z-position of the node on the plane in m setter + :param value: float + """ + self._z = value + + @property + def type(self): + """ + Type + enum ( "priority", "traffic_light", "right_before_left", "unregulated", "priority_stop", "traffic_light_unregulated", "allway_stop", "rail_signal", "zipper", "traffic_light_right_on_red", "rail_crossing") + :return: enum + """ + return self._type diff --git a/city_model_structure/transport/phase.py b/city_model_structure/transport/phase.py new file mode 100644 index 00000000..cc3f7a83 --- /dev/null +++ b/city_model_structure/transport/phase.py @@ -0,0 +1,125 @@ +""" +Phase module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List + + +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): + """ + Duration in seconds + :return: int + """ + return self._duration + + @duration.setter + def duration(self, value): + """ + Duration setter + :param value: int + """ + self._duration = value + + @property + def state(self): + """ + List of signal states + :return: [] + """ + return self._state + + @state.setter + def state(self, value): + """ + List of signal states setter + :param value: [] + """ + self._state = value + + @property + def min_duration(self): + """ + Minimum duration in seconds + :return: int + """ + if self._min_duration is None: + self._min_duration = self._duration + return self._min_duration + + @min_duration.setter + def min_duration(self, value): + """ + Minimum duration setter + :param value: int + """ + self._min_duration = value + + @property + def max_duration(self): + """ + Maximum duration in seconds + :return: int + """ + if self._max_duration is None: + self._max_duration = self._duration + return self._max_duration + + @max_duration.setter + def max_duration(self, value): + """ + Maximum duration setter + :param value: int + """ + self._max_duration = value + + @property + def name(self): + """ + Phase name + :return: str + """ + return self._name + + @name.setter + def name(self, value): + """ + Phase name setter + :param value: str + """ + self._name = value + + @property + def next(self) -> List[int]: + """ + 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: [int] + """ + return self._next + + @next.setter + def next(self, value): + """ + Next setter + :param value: [int] + """ + self._next = value diff --git a/city_model_structure/transport/road_type.py b/city_model_structure/transport/road_type.py new file mode 100644 index 00000000..a6971e12 --- /dev/null +++ b/city_model_structure/transport/road_type.py @@ -0,0 +1,166 @@ +""" +Road Type module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Lane = TypeVar['Lane'] + + +class RoadType: + """ + RoadType class + """ + + def __init__(self): + self._id = None + self._allow = None + self._disallow = None + self._discard = False + self._lanes = None + self._number_lanes = None + self._priority = None + self._speed = None + self._sidewalk_width = -1 + + @property + def id(self): + """ + Type id + :return: str + """ + return self._id + + @id.setter + def id(self, value): + """ + Type id setter + :param value: str + """ + self._id = value + + @property + def allow(self) -> List[str]: + """ + List of allowed vehicle classes + :return: [str] + """ + return self._allow + + @allow.setter + def allow(self, value): + """ + List of allowed vehicle classes setter + :param value: [str] + """ + self._allow = value + + @property + def disallow(self) -> List[str]: + """ + List of not allowed vehicle classes + :return: [str] + """ + return self._disallow + + @disallow.setter + def disallow(self, value): + """ + List of not allowed vehicle classes setter + :param value: [str] + """ + self._disallow = value + + @property + def discard(self) -> bool: + """ + If "yes", edges of that type are not imported + :return: bool + """ + return self._discard + + @discard.setter + def discard(self, value): + """ + Discard setter + :param value: bool + """ + self._discard = value + + @property + def lanes(self) -> List[Lane]: + """ + List of default lanes on an edge + :return: List[Lane] + """ + return self._lanes + + @lanes.setter + def lanes(self, value): + """ + List of default lanes on an edge setter + :param value: List[Lane] + """ + self._lanes = value + + @property + def number_lanes(self): + """ + Number of default lanes on an edge + :return: int + """ + if self._number_lanes is None: + self._number_lanes = len(self.lanes) + return self._number_lanes + + @property + def priority(self): + """ + A number, which determines the priority between different road types. + It starts with one; higher numbers represent more important roads. + :return: int + """ + return self._priority + + @priority.setter + def priority(self, value): + """ + Priority setter + :param value: int + """ + self._priority = value + + @property + def speed(self): + """ + The default (implicit) speed limit in m/s + :return: float + """ + return self._speed + + @speed.setter + def speed(self, value): + """ + The default (implicit) speed limit in m/s setter + :param value: float + """ + self._speed = value + + @property + def sidewalk_width(self): + """ + The default width for added sidewalks in m + :return: float + """ + return self._sidewalk_width + + @sidewalk_width.setter + def sidewalk_width(self, value): + """ + The default width for added sidewalks in m setter + :param value: float + """ + self._sidewalk_width = value diff --git a/city_model_structure/transport/roundabout.py b/city_model_structure/transport/roundabout.py new file mode 100644 index 00000000..60427994 --- /dev/null +++ b/city_model_structure/transport/roundabout.py @@ -0,0 +1,35 @@ +""" +Roundabout module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Edge = TypeVar['Edge'] + + +class Roundabout: + """ + Roundabout class + """ + + def __init__(self): + self._edges = None + + @property + def edges(self) -> List[Edge]: + """ + Edges that conform the roundabout + :return: [Edge] + """ + return self._edges + + @edges.setter + def edges(self, value): + """ + Edges that conform the roundabout setter + :param value: [Edge] + """ + self._edges = value diff --git a/city_model_structure/transport/split.py b/city_model_structure/transport/split.py new file mode 100644 index 00000000..32925e71 --- /dev/null +++ b/city_model_structure/transport/split.py @@ -0,0 +1,122 @@ +""" +Split module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Lane = TypeVar['Lane'] +Edge = TypeVar['Edge'] + + +class Split: + """ + Split class + """ + + def __init__(self): + self._position = None + self._lanes = None + self._speed = None + self._id = None + self._edge_before = None + self._edge_after = None + + @property + def position(self): + """ + The position along the edge at which the split shall be done (in m); + if a negative position is given, the split is inserted counting from the end of the edge + :return: float + """ + return self._position + + @position.setter + def position(self, value): + """ + Position setter + :param value: float + """ + self._position = value + + @property + def lanes(self) -> List[Lane]: + """ + List of lanes after the split + :return: List[Lane] + """ + return self._lanes + + @lanes.setter + def lanes(self, value): + """ + List of lanes setter + :param value: List[Lane] + """ + self._lanes = value + + @property + def speed(self): + """ + Speed limit after the split in m/s + :return: float + """ + return self._speed + + @speed.setter + def speed(self, value): + """ + Speed limit in m/s setter + :param value: float + """ + self._speed = value + + @property + def id(self): + """ + Type id + :return: str + """ + return self._id + + @id.setter + def id(self, value): + """ + Type id setter + :param value: str + """ + self._id = value + + @property + def edge_before(self) -> Edge: + """ + Edge before the split + :return: Edge + """ + return self._edge_before + + @edge_before.setter + def edge_before(self, value): + """ + edge_before setter + :param value: Edge + """ + self._edge_before = value + + @property + def edge_after(self) -> Edge: + """ + Edge after the split + :return: Edge + """ + return self._edge_after + + @edge_after.setter + def edge_after(self, value): + """ + edge_after setter + :param value: Edge + """ + self._edge_after = value diff --git a/city_model_structure/transport/traffic_light_logic.py b/city_model_structure/transport/traffic_light_logic.py new file mode 100644 index 00000000..e67a201b --- /dev/null +++ b/city_model_structure/transport/traffic_light_logic.py @@ -0,0 +1,105 @@ +""" +Traffic light Logic module +These network elements are used to connect multiple side walks and pedestrian crossings +(typically one in each corner of an intersection). +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Phase = TypeVar['Phase'] + + +class TrafficLightLogic: + """ + TrafficLightLogic class + """ + + def __init__(self): + self._id = None + self._type = None + self._program_id = None + self._offset = None + self._phases = None + + @property + def id(self): + """ + Traffic light's id + :return: str + """ + return self._id + + @id.setter + def id(self, value): + """ + Traffic light's id setter + :param value: str + """ + self._id = value + + @property + def type(self): + """ + enum (static, actuated, delay_based) + :return: + """ + return self._type + + @type.setter + def type(self, value): + """ + Type setter + :param value: + """ + self._type = value + + @property + def program_id(self): + """ + Traffic light program's id + :return: str + """ + return self._program_id + + @program_id.setter + def program_id(self, value): + """ + Traffic light program's id setter + :param value: str + """ + self._program_id = value + + @property + def offset(self): + """ + The initial time offset of the program + :return: int + """ + return self._offset + + @offset.setter + def offset(self, value): + """ + The initial time offset of the program setter + :param value: int + """ + self._offset = value + + @property + def phases(self) -> List[Phase]: + """ + Phases of the traffic light logic + :return: [Phase] + """ + return self._phases + + @phases.setter + def phases(self, value): + """ + Phases setter + :param value: [Phase] + """ + self._phases = value diff --git a/city_model_structure/transport/walking_area.py b/city_model_structure/transport/walking_area.py new file mode 100644 index 00000000..54a2294e --- /dev/null +++ b/city_model_structure/transport/walking_area.py @@ -0,0 +1,70 @@ +""" +Walking area module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +Contributor Milad milad.aghamohamadnia@concordia.ca +""" + +from typing import List, TypeVar + +Edge = TypeVar['Edge'] +Node = TypeVar['Node'] + + +class WalkingArea: + """ + WalkingArea class + """ + + def __init__(self): + self._node = None + self._edges = None + self._shape = None + + @property + def node(self) -> Node: + """ + The node at which this walking area is located + :return: Node + """ + return self._node + + @node.setter + def node(self, value): + """ + The node at which this walking area is located setter + :param value: Node + """ + self._node = value + + @property + def edges(self) -> List[Edge]: + """ + The (road) edges which uniquely define the walking area + :return: [Edge] + """ + return self._edges + + @edges.setter + def edges(self, value): + """ + The (road) edges which uniquely define the walking area setter + :param value: [Edge] + """ + self._edges = value + + @property + def shape(self) -> List[List[float]]: + """ + List of positions (positions in m) + :return: [[x, y, (z)]] + """ + return self._shape + + @shape.setter + def shape(self, value): + """ + List of positions setter + :param value: [[x, y, (z)]] + """ + self._shape = value diff --git a/helpers/monthly_to_hourly_demand.py b/helpers/monthly_to_hourly_demand.py index a927466b..118f6715 100644 --- a/helpers/monthly_to_hourly_demand.py +++ b/helpers/monthly_to_hourly_demand.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ import pandas as pd -from city_model_structure.attributes.occupants import Occupants +from city_model_structure.building_demand.occupants import Occupants import calendar as cal import helpers.constants as cte diff --git a/imports/construction/us_physics_parameters.py b/imports/construction/us_physics_parameters.py index 15c765f8..ea6d7bf8 100644 --- a/imports/construction/us_physics_parameters.py +++ b/imports/construction/us_physics_parameters.py @@ -8,8 +8,8 @@ import sys from imports.construction.nrel_physics_interface import NrelPhysicsInterface from imports.construction.helpers.construction_helper import ConstructionHelper -from city_model_structure.attributes.layer import Layer -from city_model_structure.attributes.material import Material +from city_model_structure.building_demand.layer import Layer +from city_model_structure.building_demand.material import Material class UsPhysicsParameters(NrelPhysicsInterface): diff --git a/imports/geometry/citygml_classes/citygml_lod1.py b/imports/geometry/citygml_classes/citygml_lod1.py index b830e147..1cf3b975 100644 --- a/imports/geometry/citygml_classes/citygml_lod1.py +++ b/imports/geometry/citygml_classes/citygml_lod1.py @@ -5,7 +5,7 @@ Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ from imports.geometry.citygml_classes.citygml_base import CityGmlBase -from city_model_structure.attributes.surface import Surface +from city_model_structure.building_demand.surface import Surface from city_model_structure.attributes.polygon import Polygon diff --git a/imports/geometry/citygml_classes/citygml_lod2.py b/imports/geometry/citygml_classes/citygml_lod2.py index 3ecd687e..c169d58b 100644 --- a/imports/geometry/citygml_classes/citygml_lod2.py +++ b/imports/geometry/citygml_classes/citygml_lod2.py @@ -5,7 +5,7 @@ Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ from imports.geometry.citygml_classes.citygml_base import CityGmlBase -from city_model_structure.attributes.surface import Surface +from city_model_structure.building_demand.surface import Surface from city_model_structure.attributes.polygon import Polygon from imports.geometry.helpers.geometry_helper import GeometryHelper diff --git a/imports/geometry/obj.py b/imports/geometry/obj.py index f5019a6d..54ceae34 100644 --- a/imports/geometry/obj.py +++ b/imports/geometry/obj.py @@ -8,7 +8,7 @@ from trimesh import Scene import trimesh.geometry from city_model_structure.city import City from city_model_structure.building import Building -from city_model_structure.attributes.surface import Surface +from city_model_structure.building_demand.surface import Surface from city_model_structure.attributes.polygon import Polygon diff --git a/imports/sensors/concordia_energy_consumption.py b/imports/sensors/concordia_energy_consumption.py index c9cefd6a..ad8cd9aa 100644 --- a/imports/sensors/concordia_energy_consumption.py +++ b/imports/sensors/concordia_energy_consumption.py @@ -5,7 +5,7 @@ Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ import pandas as pd from imports.sensors.concordia_file_report import ConcordiaFileReport -from city_model_structure.attributes.concordia_energy_sensor import ConcordiaEnergySensor +from city_model_structure.iot.concordia_energy_sensor import ConcordiaEnergySensor class ConcordiaEnergyConsumption(ConcordiaFileReport): diff --git a/imports/sensors/concordia_file_report.py b/imports/sensors/concordia_file_report.py index 25b67ef0..453d77fc 100644 --- a/imports/sensors/concordia_file_report.py +++ b/imports/sensors/concordia_file_report.py @@ -8,7 +8,6 @@ import io import json from pathlib import Path import pandas as pd -from city_model_structure.attributes.concordia_energy_sensor import ConcordiaEnergySensor class ConcordiaFileReport: diff --git a/imports/sensors/concordia_gas_flow.py b/imports/sensors/concordia_gas_flow.py index 48a22bf1..e88c4832 100644 --- a/imports/sensors/concordia_gas_flow.py +++ b/imports/sensors/concordia_gas_flow.py @@ -5,7 +5,7 @@ Copyright © 2021 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.mons """ import pandas as pd from imports.sensors.concordia_file_report import ConcordiaFileReport -from city_model_structure.attributes.concordia_gas_flow_sensor import ConcordiaGasFlowSensor +from city_model_structure.iot.concordia_gas_flow_sensor import ConcordiaGasFlowSensor class ConcordiaGasFlow(ConcordiaFileReport): diff --git a/imports/sensors/concordia_temperature.py b/imports/sensors/concordia_temperature.py index 9f5ccc53..a796955c 100644 --- a/imports/sensors/concordia_temperature.py +++ b/imports/sensors/concordia_temperature.py @@ -5,7 +5,7 @@ Copyright © 2021 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.mons """ import pandas as pd from imports.sensors.concordia_file_report import ConcordiaFileReport -from city_model_structure.attributes.concordia_temperature_sensor import ConcordiaTemperatureSensor +from city_model_structure.iot.concordia_temperature_sensor import ConcordiaTemperatureSensor class ConcordiaTemperature(ConcordiaFileReport): diff --git a/imports/usage/hft_usage_parameters.py b/imports/usage/hft_usage_parameters.py index 40b2883b..4c968481 100644 --- a/imports/usage/hft_usage_parameters.py +++ b/imports/usage/hft_usage_parameters.py @@ -7,8 +7,8 @@ import sys from imports.geometry.helpers.geometry_helper import GeometryHelper as gh from imports.usage.hft_usage_interface import HftUsageInterface -from city_model_structure.attributes.usage_zone import UsageZone -from city_model_structure.attributes.internal_gains import InternalGains +from city_model_structure.building_demand.usage_zone import UsageZone +from city_model_structure.building_demand.internal_gains import InternalGains class HftUsageParameters(HftUsageInterface):