StateOfChargeCurve

Represents the state of charge (SOC) curve of an electric vehicle's battery.

The SOC curve defines the relationship between the energy stored in the battery and the corresponding battery percentage. It is represented as a list of (energy, percentage) pairs, sorted by both energy and percentage.

Parameters

curve

A list of Pair objects, where each pair represents a point

  • on the SOC curve. The first element of the pair is the energy level (Energy),

  • and the second element is the corresponding battery percentage (Float).

  • The list must contain at least two elements and be sorted in ascending order

  • by both energy and percentage.

Throws

if the curve has less than two elements or if the elements are not sorted.

Constructors

Link copied to clipboard
constructor(maxCharge: Energy)

Creates a linear StateOfChargeCurve with a specified maximum charge. This constructor creates a simple linear curve with two points: (0 energy, 0%) and (maxCharge, 100%).

constructor(curve: List<Pair<Energy, Float>>)

Creates a StateOfChargeCurve with a custom curve.

Functions

Link copied to clipboard

Calculates the battery energy for a given percentage.

Link copied to clipboard

Calculates the battery percentage for a given energy level.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int