nrel.hive.state.vehicle_state.charge_queueing

Module Contents

Classes

ChargeQueueing

A vehicle tracks it's own place in a queue (Stations do not know about queues), and what guarantees

Attributes

log

nrel.hive.state.vehicle_state.charge_queueing.log[source]
class nrel.hive.state.vehicle_state.charge_queueing.ChargeQueueing[source]

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

A vehicle tracks it’s own place in a queue (Stations do not know about queues), and what guarantees a respect to vehicle queue positioning is their respective queue_times, which is used to sort all vehicles when applying the step_simulation_ops.perform_vehicle_state_updates.

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
station_id: nrel.hive.util.typealiases.StationId
charger_id: nrel.hive.util.typealiases.ChargerId
enqueue_time: nrel.hive.model.sim_time.SimTime
instance_id: nrel.hive.state.vehicle_state.vehicle_state.VehicleStateInstanceId
classmethod build(vehicle_id: nrel.hive.util.typealiases.VehicleId, station_id: nrel.hive.util.typealiases.StationId, charger_id: nrel.hive.util.typealiases.ChargerId, enqueue_time: nrel.hive.model.sim_time.SimTime) ChargeQueueing[source]
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]

entering a charge queueing state requires being at that station

Parameters:
  • sim – the simulation state

  • env – the simulation environment

Returns:

an exception due to failure or an optional updated simulation

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

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]

remove agent from queue before exiting this state

Parameters:
  • sim

  • env

Returns:

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

vehicle has reached a terminal state if the station disappeared or if it has at least one charger_id of the correct type

Parameters:
  • sim

  • env

Returns:

_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]

similarly to the idle state, we incur an idling penalty here

Parameters:
  • sim

  • env

Returns: