diff --git a/city_model_structure/building.py b/city_model_structure/building.py index 7605dc03..9e144141 100644 --- a/city_model_structure/building.py +++ b/city_model_structure/building.py @@ -13,6 +13,7 @@ from city_model_structure.building_demand.thermal_boundary import ThermalBoundar from city_model_structure.building_demand.usage_zone import UsageZone from city_model_structure.building_demand.storey import Storey from city_model_structure.city_object import CityObject +from city_model_structure.building_demand.household import Household class Building(CityObject): @@ -22,6 +23,7 @@ class Building(CityObject): def __init__(self, name, lod, surfaces, year_of_construction, function, city_lower_corner, terrains=None): super().__init__(name, lod, surfaces, city_lower_corner) + self._households = None self._basement_heated = None self._attic_heated = None self._terrains = terrains @@ -352,3 +354,11 @@ class Building(CityObject): else: self._thermal_boundaries.append(thermal_boundary) return self._thermal_boundaries + + @property + def households(self) -> List[Household]: + """ + Get the list of households inside the building + :return: List[Household] + """ + return self._households diff --git a/city_model_structure/building_demand/household.py b/city_model_structure/building_demand/household.py new file mode 100644 index 00000000..251c8dbd --- /dev/null +++ b/city_model_structure/building_demand/household.py @@ -0,0 +1,31 @@ +""" +Household module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +""" + + +class Household: + """ + Household class + """ + + def __init__(self): + self._number_of_people = None + self._number_of_cars = None + + @property + def number_of_people(self): + """ + Get number of people leaving in the household + :return: int + """ + return self._number_of_people + + @property + def number_of_cars(self): + """ + Get number of cars owned by the householders + :return: int + """ + return self._number_of_cars diff --git a/city_model_structure/transport/origin_destination_edge.py b/city_model_structure/transport/origin_destination_edge.py new file mode 100644 index 00000000..c3d3f3c1 --- /dev/null +++ b/city_model_structure/transport/origin_destination_edge.py @@ -0,0 +1,37 @@ +""" +Origin-Destination edge module +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.edge import Edge +from city_model_structure.attributes.schedule import Schedule + + +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 movement_schedule(self) -> Schedule: + """ + Get the schedule of the movement of people along this edge + :return: Schedule + """ + return self._movement_schedule diff --git a/city_model_structure/transport/origin_destination_network.py b/city_model_structure/transport/origin_destination_network.py new file mode 100644 index 00000000..b23bb01c --- /dev/null +++ b/city_model_structure/transport/origin_destination_network.py @@ -0,0 +1,24 @@ +""" +Origin-Destination network module +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.network import Network + + +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 diff --git a/city_model_structure/transport/origin_destination_node.py b/city_model_structure/transport/origin_destination_node.py new file mode 100644 index 00000000..5e46e92d --- /dev/null +++ b/city_model_structure/transport/origin_destination_node.py @@ -0,0 +1,74 @@ +""" +Origin-Destination node module +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +""" +from typing import List + +from city_model_structure.attributes.node import Node +from city_model_structure.attributes.point import Point +from city_model_structure.attributes.polygon import Polygon +from city_model_structure.city_object import CityObject + + +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 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/city_model_structure/transport/traffic_edge.py b/city_model_structure/transport/traffic_edge.py index 5f8578e5..1fd77299 100644 --- a/city_model_structure/transport/traffic_edge.py +++ b/city_model_structure/transport/traffic_edge.py @@ -1,5 +1,5 @@ """ -Edge module +Traffic 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 @@ -13,7 +13,7 @@ from city_model_structure.transport.lane import Lane class TrafficEdge(Edge): """ - Edge class + TrafficEdge class Each edge is unidirectional and starts at the "from" node and ends at the "to" node """ diff --git a/city_model_structure/transport/traffic_network.py b/city_model_structure/transport/traffic_network.py index 5b5406d1..27e30096 100644 --- a/city_model_structure/transport/traffic_network.py +++ b/city_model_structure/transport/traffic_network.py @@ -11,7 +11,7 @@ from city_model_structure.network import Network class TrafficNetwork(Network): """ - TrafficNetwork(CityObject) class + TrafficNetwork(Network) class """ def __init__(self, name, edges=None, nodes=None): super().__init__(name, edges, nodes) diff --git a/city_model_structure/transport/traffic_node.py b/city_model_structure/transport/traffic_node.py index 375660bb..3008cf97 100644 --- a/city_model_structure/transport/traffic_node.py +++ b/city_model_structure/transport/traffic_node.py @@ -1,5 +1,5 @@ """ -Node module +TrafficNode 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 @@ -17,7 +17,7 @@ from city_model_structure.transport.connection import Connection class TrafficNode(Node): """ - Node class + TrafficNode class """ def __init__(self, name, coordinates, node_type='TrafficNode', edges=None, prohibitions=None, connections=None):