nrel.hive.state.vehicle_state.vehicle_state_ops
Module Contents
Classes
Typed version of namedtuple. |
Functions
|
apply any effects due to a vehicle being advanced one discrete time unit in this VehicleState |
sets a vehicle to OutOfService if it is out of energy after a move event. |
|
|
Moves the vehicles. |
- nrel.hive.state.vehicle_state.vehicle_state_ops.charge(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment, vehicle_id: nrel.hive.util.typealiases.VehicleId, station_id: nrel.hive.util.typealiases.StationId, charger_id: nrel.hive.util.typealiases.ChargerId) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]
apply any effects due to a vehicle being advanced one discrete time unit in this VehicleState
- Parameters:
sim – the simulation state
env – the simulation environment
vehicle_id – the vehicle transitioning
station_id – the station where we are charging
charger_id – the charger_id we are using
- Returns:
an exception due to failure or an optional updated simulation
- class nrel.hive.state.vehicle_state.vehicle_state_ops.MoveResult[source]
Bases:
NamedTupleTyped version of namedtuple.
Usage in Python versions >= 3.6:
class Employee(NamedTuple): name: str id: int
This is equivalent to:
Employee = collections.namedtuple('Employee', ['name', 'id'])
The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:
Employee = NamedTuple('Employee', name=str, id=int)
In Python versions <= 3.5 use:
Employee = NamedTuple('Employee', [('name', str), ('id', int)])
- prev_vehicle: nrel.hive.model.vehicle.vehicle.Vehicle | None
- next_vehicle: nrel.hive.model.vehicle.vehicle.Vehicle | None
- route_traversal: nrel.hive.model.roadnetwork.routetraversal.RouteTraversal
- nrel.hive.state.vehicle_state.vehicle_state_ops._go_out_of_service_on_empty(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment, vehicle_id: nrel.hive.util.typealiases.VehicleId) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]
sets a vehicle to OutOfService if it is out of energy after a move event. this assumes we’ve already confirmed a vehicle is out of energy.
- Parameters:
sim – the sim before the move event
env – the sim environment
vehicle_id – the vehicle that moved and ran out of energy
- Returns:
an optional error, or an optional sim with the out of service vehicle
- nrel.hive.state.vehicle_state.vehicle_state_ops.move(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment, vehicle_id: nrel.hive.util.typealiases.VehicleId) Tuple[Exception | None, nrel.hive.state.simulation_state.simulation_state.SimulationState | None][source]
Moves the vehicles. Transitions to OutOfService if the vehicle is empty
- Parameters:
sim – the simulation state
env – the simulation environment
vehicle_id – the vehicle moving
- Returns:
an error, or a sim with the moved vehicle, or (None, None) if no changes