View Source PorscheConnEx.Struct.Unit.Consumption.Energy (porsche_conn_ex v0.1.0)

Structure representing a ratio of energy consumed versus distance travelled.

Fields

  • unit (atom) — units used, depends on locale
    • :kwh_per_100km — kilowatt-hours per hundred kilometres (kWh/100km)
    • :miles_per_kwh - miles per kilowatt-hour (mi/kWh)
  • value (float) — value in above units
  • kwh_per_100km (float) — kWh/100km equivalent

Note that the ratios are inverted for metric versus imperial — metric is energy per unit of distance travelled (and lower numbers are more efficient), while imperial is distance travelled per unit of energy (and higher numbers are more efficient).

Like most units in this API, a normalised value (kwh_per_100km) is included, regardless of locale settings.

Given the numbers returned by the API, it's pretty clear that the values are stored in kWh/100km (rounded to one decimal of precision), and are converted to mi/kWh for imperial locales.

Summary

Types

@type t() :: %PorscheConnEx.Struct.Unit.Consumption.Energy{
  kwh_per_100km: float(),
  unit: unit(),
  value: float()
}
@type unit() :: :kwh_per_100km | :miles_per_kwh