nrel.hive.model.station.charger_state

Module Contents

Classes

ChargerState

Typed version of namedtuple.

class nrel.hive.model.station.charger_state.ChargerState[source]

Bases: NamedTuple

Typed 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)])
id: nrel.hive.util.typealiases.ChargerId
charger: nrel.hive.model.energy.charger.charger.Charger
total_chargers: int
available_chargers: int
price_per_kwh: nrel.hive.util.units.Currency
enqueued_vehicles: int
classmethod build(charger: nrel.hive.model.energy.charger.charger.Charger, count: int) ChargerState[source]

builds a ChargerState from a charger and some total count of this charger type at a station

Parameters:
  • charger – an instance of a Charger to track the state of

  • count – the count of this Charger at some station

Returns:

initial ChargerState

add_chargers(charger_count: int) ChargerState[source]

adds chargers to this ChargerState, updating the total and available charger counts

Parameters:

charger_count – count to add

Returns:

updated ChargerState

has_available_charger() bool[source]

whether there are chargers of this type available :return: true if there are available chargers

increment_available_chargers() nrel.hive.util.error_or_result.ErrorOr[ChargerState][source]

increments the number of chargers of this type that are available :return: updated charger state or an error

decrement_available_chargers() nrel.hive.util.error_or_result.ErrorOr[ChargerState][source]

decrements the number of chargers of this type that are available :return: updated charger state or an error

increment_enqueued_vehicles() ChargerState[source]

increments the number of vehicles enqueued to charge at this station with this charger type :return: updated charger state

decrement_enqueued_vehicles() nrel.hive.util.error_or_result.ErrorOr[ChargerState][source]

decrements the number of vehicles enqueued to charge at this station with this charger type :return: updated charger state or an error

set_charge_rate(value: nrel.hive.util.units.KwH) returns.result.ResultE[ChargerState][source]

sets the charge rate to some provided KwH :param value: the value to set :return: the updated charger state or an error if the value does not fall in the range [0, factory_charge_rate]

scale_charge_rate(factor: float) returns.result.ResultE[ChargerState][source]

scales the charge rate by a factor of the Charger’s prototype rate.

Parameters:

factor – the factor, a percentage value in [0, 1]

Returns:

updated charger state or an error