Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions examples/quickstart-fr.py.py → examples/quickstart-fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
dotenv.load_dotenv()

mobility.set_params(
# package_data_folder_path=os.environ["MOBILITY_PACKAGE_DATA_FOLDER"],
# project_data_folder_path=os.environ["MOBILITY_PROJECT_DATA_FOLDER"]
package_data_folder_path="D:/mobility-data",
project_data_folder_path="D:/test-09",
package_data_folder_path=os.environ["MOBILITY_PACKAGE_DATA_FOLDER"],
project_data_folder_path=os.environ["MOBILITY_PROJECT_DATA_FOLDER"]
)

# Using Foix (a small town) and a limited radius for quick results
Expand All @@ -21,10 +19,10 @@
# Creating a synthetic population of 1000 for the area
pop = mobility.Population(transport_zones, sample_size = 1000)

# Simulating the trips for this population for three modes : car, walk and bicyle, and only home and work motives (OtherMotive is mandatory)
# Simulating the trips for this population for three modes : car, walk, bicyle and public transport, and only home and work motives (OtherMotive is mandatory)
pop_trips = mobility.PopulationTrips(
pop,
[mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones)],
[mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones), mobility.PublicTransportMode(transport_zones)],
[mobility.HomeMotive(), mobility.WorkMotive(), mobility.OtherMotive(population=pop)],
[emp]
)
Expand Down
14 changes: 9 additions & 5 deletions mobility/transport_modes/modal_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@ class IntermodalTransfer():
Dataclass for intermodal transfer parameters.

Args:
max_travel_time: maximum travel time to consider when estima
max_travel_time: maximum travel time to consider between those two modes
average_speed: average speed during the transfer (default is 4.0 km/h, considering walking)
transfer_time: to document
shortcuts_transfer_time: to document
shortcuts_locations: to document
"""

# Max travel time from or to the connection nodes, estimated from the crow
# fly distance around connection nodes and an average speed
max_travel_time: float # hours
average_speed: float # km/h
max_travel_time: float = 20.0 / 60.0 # hours
average_speed: float = 4.0 # km/h

# Average transfer time between the two connected modes
transfer_time: float # minutes
transfer_time: float = 1.0 # minutes

# Optional shortcuts to make some connections faster than average
shortcuts_transfer_time: float = None # minutes
shortcuts_locations: List[Coordinates] = None




Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from mobility.transport_zones import TransportZones
from mobility.transport_modes.transport_mode import TransportMode
from mobility.transport_modes.walk import WalkMode
from mobility.transport_modes.public_transport.public_transport_routing_parameters import PublicTransportRoutingParameters
from mobility.transport_modes.public_transport.public_transport_travel_costs import PublicTransportTravelCosts
from mobility.transport_modes.public_transport.public_transport_generalized_cost import PublicTransportGeneralizedCost
Expand Down Expand Up @@ -32,8 +33,8 @@ def __init__(
transport_zones: TransportZones,
first_leg_mode: TransportMode = None,
last_leg_mode: TransportMode = None,
first_intermodal_transfer: IntermodalTransfer = None,
last_intermodal_transfer: IntermodalTransfer = None,
first_intermodal_transfer: IntermodalTransfer = IntermodalTransfer(),
last_intermodal_transfer: IntermodalTransfer = IntermodalTransfer(),
routing_parameters: PublicTransportRoutingParameters = PublicTransportRoutingParameters(),
generalized_cost_parameters: GeneralizedCostParameters = None,
survey_ids: List[str] = [
Expand All @@ -43,6 +44,11 @@ def __init__(
],
ghg_intensity: float = 0.05
):

if first_leg_mode is None:
first_leg_mode = WalkMode(transport_zones)
if last_leg_mode is None:
last_leg_mode = WalkMode(transport_zones)

travel_costs = PublicTransportTravelCosts(
transport_zones,
Expand Down Expand Up @@ -94,4 +100,4 @@ def __init__(
def audit_gtfs(self):
logging.info("Auditing GTFS for this mode")
travel_costs = self.travel_costs.audit_gtfs()
return travel_costs
return travel_costs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_008_population_trips_can_be_computed(test_data, safe_json):

pop_trips = PopulationTrips(
population=pop,
modes=[mobility.CarMode(transport_zones)],
modes=[mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones), mobility.PublicTransportMode(transport_zones)],
motives=[
HomeMotive(),
WorkMotive(),
Expand Down
Loading