nrel.hive.state.vehicle_state.servicing_pooling_trip

Module Contents

Classes

ServicingPoolingTrip

a pooling trip is in service, for the given trips in the given trip_order.

Attributes

log

nrel.hive.state.vehicle_state.servicing_pooling_trip.log[source]
class nrel.hive.state.vehicle_state.servicing_pooling_trip.ServicingPoolingTrip[source]

Bases: nrel.hive.state.vehicle_state.vehicle_state.VehicleState

a pooling trip is in service, for the given trips in the given trip_order.

property vehicle_state_type: nrel.hive.state.vehicle_state.vehicle_state_type.VehicleStateType

unique state type, used for comparison, replaces need to call isinstance on the concrete VehicleState type (which leads to circular dependencies amongst VehicleStates) :return: the VehicleStateType of this VehicleState

property route: nrel.hive.model.roadnetwork.route.Route

makes this uniform with other “move” states to have a “route” property :return:

vehicle_id: nrel.hive.util.typealiases.VehicleId
trip_plan: Tuple[Tuple[nrel.hive.util.typealiases.RequestId, nrel.hive.model.vehicle.trip_phase.TripPhase], Ellipsis]
boarded_requests: immutables.Map[nrel.hive.util.typealiases.RequestId, nrel.hive.model.request.Request]
departure_times: immutables.Map[nrel.hive.util.typealiases.RequestId, nrel.hive.model.sim_time.SimTime]
routes: Tuple[nrel.hive.model.roadnetwork.route.Route, Ellipsis]
num_passengers: int
instance_id: nrel.hive.state.vehicle_state.vehicle_state.VehicleStateInstanceId
classmethod build(vehicle_id: nrel.hive.util.typealiases.VehicleId, trip_plan: Tuple[Tuple[nrel.hive.util.typealiases.RequestId, nrel.hive.model.vehicle.trip_phase.TripPhase], Ellipsis], boarded_requests: immutables.Map[nrel.hive.util.typealiases.RequestId, nrel.hive.model.request.Request], departure_times: immutables.Map[nrel.hive.util.typealiases.RequestId, nrel.hive.model.sim_time.SimTime], routes: Tuple[nrel.hive.model.roadnetwork.route.Route, Ellipsis], num_passengers: int) ServicingPoolingTrip[source]
update_route(route: nrel.hive.model.roadnetwork.route.Route) ServicingPoolingTrip[source]
update(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]

apply any effects due to an entity being advanced one discrete time unit in this EntityState

Parameters:
  • sim – the simulation state

  • env – the simulation environment

Returns:

an exception due to failure or an optional updated simulation

enter(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]

transition from DispatchTrip into a pooling trip service leg. this first frame of servicing a pooling trip should be happening at the start location of the first request in the pool, which should already be boarded (so, the first trip_phase is not to pick that request up).

Parameters:
  • sim – the simulation state

  • env – the simulation environment

Returns:

an error, or, the sim with state entered

exit(next_state: nrel.hive.state.vehicle_state.vehicle_state.VehicleState, sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]

exit when there is no remaining trip_phase to complete

Parameters:
  • sim – the sim state

  • env – the sim environment

Returns:

None, None - cannot invoke “exit” on ServicingPoolingTrip

_has_reached_terminal_state_condition(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) bool[source]

ignored: this should be handled in the update phase when the length of the final route is zero.

Parameters:
  • sim – the simulation state

  • env – the simulation environment

Returns:

true if our trip is done

_default_terminal_state(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) Tuple[Exception | None, nrel.hive.state.vehicle_state.vehicle_state.VehicleState | None][source]

give the default state to transition to after having met a terminal condition

Parameters:
  • sim – the simulation state

  • env – the simulation environment

Returns:

an exception due to failure or the next_state after finishing a task

_perform_update(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]

move forward on our trip, making pickups and dropoffs as needed

Parameters:
  • sim – the simulation state

  • env – the simulation environment

Returns:

the vehicle after advancing in time on a servicing trip