← back to Charge And Explore
backend/src/core/types.ts
48 lines
// Shared domain types for the Charge & Explore recommendation core.
// These mirror the Swift value types on the iOS client so the contract
// stays identical on both sides of the first-party API.
export interface GeoPoint {
latitude: number;
longitude: number;
}
/** A single band of the (nonlinear) DC charging curve for a vehicle/pack. */
export interface ChargeCurveBand {
/** State-of-charge (%) at which this band begins (inclusive). */
minSoc: number;
/** State-of-charge (%) at which this band ends (exclusive of the next). */
maxSoc: number;
/**
* Fraction of the base (min of vehicle/station) power actually delivered
* in this band. Tapers toward 1.0 at low SOC and small values near 100%.
*/
powerMultiplier: number;
}
export interface ChargeEstimateInput {
arrivalSocPercent: number;
targetSocPercent: number;
usableBatteryKWh: number;
vehicleMaxDcKw: number;
stationMaxKw: number;
chargingCurve: ChargeCurveBand[];
/** Bounded weather/temperature derate, e.g. 0.55 (cold) – 1.05. */
environmentFactor: number;
/** Bounded AC/DC conversion efficiency, e.g. 0.85 – 0.98. */
conversionEfficiency: number;
/** Fixed minutes for plugging in, auth, handshake, etc. */
connectionOverheadMinutes: number;
}
export type PlaceCategory =
| "restaurant"
| "cafe"
| "restroom"
| "park"
| "playground"
| "grocery"
| "shopping"
| "hotel"
| "attraction";