New classes for traffic group

This commit is contained in:
Pilar 2021-10-18 16:07:18 -04:00
parent a41a7ef801
commit 5794ea09f7
8 changed files with 181 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
"""

View File

@ -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)

View File

@ -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):