spice_ev.battery.Battery._adjust_soc

Battery._adjust_soc(timedelta, charging_curve, target_soc)

Helper function that loads or unloads battery to a given target SoC.

Keeps track of the duration and stops the process early if a time limit is reached.

Parameters:
  • timedelta (datetime.timedelta) – Maximum amount of time available for (dis)charge process.

  • charging_curve (spice_ev.loading_curve.LoadingCurve) – The charging curve that relates the SOC to (dis)charge power. This charging curve reflects the exact amount of power the battery releases/receives. The curve must already be clamped and scaled to account for losses due to efficiency and limitations of connected devices.

  • target_soc (numeric) – SOC to (dis)charge to.

Returns:

Average power released/received across entire timedelta.

Return type:

numeric