spice_ev.battery.Battery

class spice_ev.battery.Battery(capacity, loading_curve, soc, efficiency=0.95, unloading_curve=None, loss_rate=None)

Battery class

__init__(capacity, loading_curve, soc, efficiency=0.95, unloading_curve=None, loss_rate=None)

Initialize the battery.

Parameters:
  • capacity (numerical) – capacity of the battery in kWh

  • loading_curve (spice_ev.loading_curve.LoadingCurve) – loading curve of the battery

  • soc (float) – soc of the battery

  • efficiency (float) – efficiency of the battery

  • unloading_curve (spice_ev.loading_curve.LoadingCurve) – unloading curve of the battery. Defaults to None for backwards-compatibility (discharge with maximum power of loading curve)

  • loss_rate (dict) – adjusted loss rate per timestep. Can have keys relative (percent in relation to current charge), fixed_relative (percent in relation to capacity) and fixed_absolute (energy in kWh independent of capacity)

Methods

__init__(capacity, loading_curve, soc[, ...])

Initialize the battery.

get_available_power(timedelta)

Returns maximum available power for timedelta duration.

load(timedelta[, max_power, target_soc, ...])

Adjust SoC, return average charging power for given timedelta and max charging power.

load_iterative(timedelta, max_charging_power)

Adjust SoC, return average charging power for given timedelta and max charging power.

unload(timedelta[, max_power, target_soc, ...])

Discharge battery.