starling_sim.basemodel.agent.vehicles.service_vehicle
Module Contents
Classes
This class describes a vehicle providing transport services (pickup, dropoff) |
- class starling_sim.basemodel.agent.vehicles.service_vehicle.ServiceVehicle(simulation_model, agent_id, origin, seats, operator_id, dwell_time=30, trip_id=None, depot=None, **kwargs)
Bases:
starling_sim.basemodel.agent.vehicles.vehicle.Vehicle
This class describes a vehicle providing transport services (pickup, dropoff)
- SCHEMA
- SERVICE_INIT
- SERVICE_UP
- SERVICE_PAUSE
- SERVICE_END
- trigger_signal()
- trace_event(event)
The vehicle adds its move and route traces to its occupants.
- Parameters:
event –
- Returns:
- update_service_status(new_status_value: str)
Update the value of the vehicle’s service status and trace a ServiceEvent.
See possible values in starling_sim.utils.constants
- Parameters:
new_status_value – new service status value
- process_stop_(stop)
- process_stop_list(stop_list)
Method called for processing the stop point pickup or dropoff list
- Parameters:
stop_list – list of user stops to be processed
- Returns:
list of agent ids that where processed
- process_user_stop(user_stop)
Process the user stop if it is relevant, by calling either the pickup or dropoff method.
The stop is processed if its trip matches the service vehicle, and if it respects the capacity constraints of the service vehicle
- Parameters:
user_stop – UserStop object
- Returns:
Boolean indicating if the user stop has been processed
- pickup(stop)
Realise the pickup of the given stop request.
If the request has been cancelled, remove all the related stops of the planning
- Parameters:
stop – UserStop object, with type GET
- dropoff(stop)
Realise the dropoff of the given stop request
- Parameters:
stop – UserStop object, with type PUT
- serve_stop(user_stop)
Determine if the stop should be processed by the service vehicle.
By default, use the trip id.
- Parameters:
user_stop – UserStop
- Returns:
boolean indicating if the stop should be processed
- exceeds_capacity(user_stop)
Execute the procedure for stops that cannot be picked up because of capacity.
This method is called when a GET request cannot be served because of the capacity constraint.
For instance, trigger the stop pickup event, or let the agent wait for another vehicle.
- Parameters:
user_stop – UserStop object
- compute_dwell_time(stop)
Compute the dwell time of the vehicle when processing the stop.
The dwell time is spent between the dropoffs and the pickups. The computation method may differ depending if the stop is a StopPoint or a UserStop, or on the number of pickups and dropoffs.
- Parameters:
stop – Stop object
- Returns:
stop dwell time
- go_to_next_stop_(next_stop, duration=None)
Move to the next stop location.
Check changes in the tempDestination and the planning during move.
- Parameters:
next_stop – StopPoint or USerStop object
duration – duration of the move
- Raises:
PlanningChange if move is interrupted or next stop is changed
- set_planning(new_planning)
Set a new planning for the service vehicle.
The planning change can imply a redirection or change the idle state of the service vehicle
- Parameters:
new_planning – list of Stop objects
- insert_in_planning(request, indexes)
Insert the stops of the given request in the planning.
- Parameters:
request – TripRequest
indexes – tuple of indexes for the insertion
- test_idle_()
Execute a certain behavior if the vehicle is idle.
The vehicle is considered idle if its planning is empty. The idle behaviour is provided by the vehicle’s operator.
- Returns:
yield the idle behaviour process. Return time being idle
- return_to_depot_(service_status=None)
Move to service vehicle depot.
- Parameters:
service_status – optional new service status value