nrel.hive.model.station.station_ops
Module Contents
Functions
|
helper function for code where we want to perform an operation on a |
helper function for code where we want to perform an operation on a |
|
runs a batch update on a station's charger states |
Attributes
- nrel.hive.model.station.station_ops._EXPECTED_FIELDS = ['station_id', 'lat', 'lon', 'charger_id', 'charger_count', 'on_shift_access']
- nrel.hive.model.station.station_ops.station_state_update(station: nrel.hive.model.station.station.Station, charger_id: nrel.hive.util.typealiases.ChargerId, op: Callable[[nrel.hive.model.station.charger_state.ChargerState], nrel.hive.util.error_or_result.ErrorOr[nrel.hive.model.station.charger_state.ChargerState]]) nrel.hive.util.error_or_result.ErrorOr[nrel.hive.model.station.station.Station][source]
helper function for code where we want to perform an operation on a ChargerState and if it does not fail, update the Station with the state change.
- Parameters:
station – station to update
charger_id – charger id for charger state to update
op – a function to update a ChargerState, which can fail with an error, or return an updated ChargerState to replace the state in the Station
- Returns:
the updated Station or an error
- nrel.hive.model.station.station_ops.station_state_optional_update(station: nrel.hive.model.station.station.Station, charger_id: nrel.hive.util.typealiases.ChargerId, op: Callable[[nrel.hive.model.station.charger_state.ChargerState], nrel.hive.util.error_or_result.ErrorOr[nrel.hive.model.station.charger_state.ChargerState | None]]) nrel.hive.util.error_or_result.ErrorOr[nrel.hive.model.station.station.Station | None][source]
helper function for code where we want to perform an operation on a ChargerState and if it does not fail, update the Station with the state change.
- Parameters:
station – station to update
charger_id – charger id for charger state to update
op – a function to update a ChargerState, which can fail with an error, or return an updated ChargerState to replace the state in the Station
- Returns:
the updated Station or an error
- nrel.hive.model.station.station_ops.T
- nrel.hive.model.station.station_ops.station_state_updates(station: nrel.hive.model.station.station.Station, it: Iterable[nrel.hive.util.typealiases.Tuple[nrel.hive.util.typealiases.ChargerId, T]], op: Callable[[nrel.hive.model.station.charger_state.ChargerState, T], nrel.hive.util.error_or_result.ErrorOr[nrel.hive.model.station.charger_state.ChargerState]]) nrel.hive.util.error_or_result.ErrorOr[nrel.hive.model.station.station.Station][source]
runs a batch update on a station’s charger states
- Parameters:
station – station to update
it – iterable of ChargerIds and a generic update value
op – operation that applies an update to a ChargerState that has access to an instance of T that has a matching ChargerId
- Returns:
the update result to a station or an error