nrel.hive.state.simulation_state.update.charging_price_update
Module Contents
Classes
loads charging prices from a file or sets all prices to zero if none provided |
Functions
|
adds a single row to an accumulator that is storing only the most recently |
updates a simulation state with prices for a station by station id |
|
|
in the case that updates are written by GeoId, map those to StationIds |
Attributes
- class nrel.hive.state.simulation_state.update.charging_price_update.ChargingPriceUpdate[source]
Bases:
nrel.hive.state.simulation_state.update.simulation_update.SimulationUpdateFunctionloads charging prices from a file or sets all prices to zero if none provided
- use_defaults: bool
- classmethod build(charging_price_file: str | None, chargers_file: str, lazy_file_reading: bool = False) ChargingPriceUpdate[source]
reads a requests file and builds a ChargingPriceUpdate SimulationUpdateFunction if no charging_file is specified, builds a price update which sets all charger_id types to a kw price of zero Currency units per kw
- Parameters:
charging_price_file – the optional charging price file provided by the user
chargers_file – the file listing all chargers for this scenario
lazy_file_reading – if true, we load all file data into memory
- Returns:
a SimulationUpdate function pointing at the first line of a request file
- Raises:
an exception if there were file reading issues
- update(sim_state: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) Tuple[nrel.hive.state.simulation_state.simulation_state.SimulationState, ChargingPriceUpdate | None][source]
update charging price when the simulation reaches the update’s time
- Parameters:
sim_state – the current sim state
env – static environment variables
- Returns:
sim state plus new requests
- nrel.hive.state.simulation_state.update.charging_price_update._add_row_to_this_update(acc: immutables.Map[str, immutables.Map[nrel.hive.util.typealiases.ChargerId, nrel.hive.util.units.Currency]], row: Dict[str, str]) immutables.Map[str, immutables.Map[nrel.hive.util.typealiases.ChargerId, nrel.hive.util.units.Currency]][source]
adds a single row to an accumulator that is storing only the most recently observed {StationId|GeoId}/charger_id/currency combinations
- Parameters:
acc – the accumulator
row – the row to add
- Returns:
the updated accumulator
- nrel.hive.state.simulation_state.update.charging_price_update._update_station_prices(simulation_state: nrel.hive.state.simulation_state.simulation_state.SimulationState, station_id: nrel.hive.util.typealiases.StationId, prices_update: immutables.Map[nrel.hive.util.typealiases.ChargerId, nrel.hive.util.units.Currency]) nrel.hive.state.simulation_state.simulation_state.SimulationState[source]
updates a simulation state with prices for a station by station id
- Parameters:
result – the simulation state in a partial update state
station_id – the station id of the station to update (assumed to be valid)
prices_update – the prices in Currency that we are updating for each Charger
- Returns:
the updated SimulationState with station prices modified
- nrel.hive.state.simulation_state.update.charging_price_update._map_to_station_ids(this_update: immutables.Map[str, immutables.Map[nrel.hive.util.typealiases.ChargerId, nrel.hive.util.units.Currency]], sim: nrel.hive.state.simulation_state.simulation_state.SimulationState) immutables.Map[nrel.hive.util.typealiases.StationId, immutables.Map[nrel.hive.util.typealiases.ChargerId, nrel.hive.util.units.Currency]][source]
in the case that updates are written by GeoId, map those to StationIds
- Parameters:
this_update – the update, which may be by StationId or GeoId
sim – the SimulationState provides h3 resolution and lookup tables
- Returns:
the price data organized by StationId