nrel.hive.state.vehicle_state.charging_station
Module Contents
Classes
a vehicle is charging at a station with a specific charger_id type |
Attributes
- class nrel.hive.state.vehicle_state.charging_station.ChargingStation[source]
Bases:
nrel.hive.state.vehicle_state.vehicle_state.VehicleStatea vehicle is charging at a station with a specific charger_id type
- 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
- 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) ChargingStation[source]
build a charging station state
- Parameters:
vehicle_id – the vehicle id
station_id – the station id
charger_id – the charger id
- Returns:
a charging station state
- 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 event requires attaining a charger_id from the 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]
exiting a charge event requires returning the charger_id to the station
- Parameters:
sim – the simulation state
env – the simulation environment
- Returns:
an exception due to failure or an optional updated simulation
- _has_reached_terminal_state_condition(sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) bool[source]
test if charging is finished
- Parameters:
sim – the simulation state
env – the simulation environment
- Returns:
True if the vehicle is fully charged
- _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]
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
self.vehicle_id – the vehicle transitioning
- Returns:
an exception due to failure or an optional updated simulation