nrel.hive.state.vehicle_state.servicing_trip
Module Contents
Classes
Attributes
- class nrel.hive.state.vehicle_state.servicing_trip.ServicingTrip[source]
Bases:
nrel.hive.state.vehicle_state.vehicle_state.VehicleState- 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
- vehicle_id: nrel.hive.util.typealiases.VehicleId
- request: nrel.hive.model.request.Request
- departure_time: nrel.hive.model.sim_time.SimTime
- route: nrel.hive.model.roadnetwork.route.Route
- instance_id: nrel.hive.state.vehicle_state.vehicle_state.VehicleStateInstanceId
- classmethod build(vehicle_id: nrel.hive.util.typealiases.VehicleId, request: nrel.hive.model.request.Request, departure_time: nrel.hive.model.sim_time.SimTime, route: nrel.hive.model.roadnetwork.route.Route) ServicingTrip[source]
build a servicing trip state
- Parameters:
vehicle_id – the vehicle id
request – the request
departure_time – the departure time
route – the route
- Returns:
the servicing trip state
- update_route(route: nrel.hive.model.roadnetwork.route.Route) ServicingTrip[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 non-pooling trip service leg
- 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]
leave this state when the route is completed
- Parameters:
sim – the sim state
env – the sim environment
- Returns:
None, None - cannot invoke “exit” on ServicingTrip
- _has_reached_terminal_state_condition(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) bool[source]
if the route is complete we are finished
- Parameters:
sim – the sim state
env – the sim environment
- Returns:
True if we have reached the base
- _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]
gets the default terminal state for this state which should be transitioned to once it reaches the end of the current task. :param sim: the sim state :param env: the sim environment :return: an exception or the default VehicleState
- _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]
take a step along the route to a trip destination
- Parameters:
sim – the simulation state
env – the simulation environment
- Returns:
the sim state with vehicle moved