Files
laadpalenviewer/webapp/lib/colors.ts
T
robbertjanssen85andClaude Fable 5 cbd4531574 Rework freight classification and fix analysis/webapp derivations
Freight classification v2: two-tier freightKind ('dedicated' via truck
operator, truck-named location (forklifts excluded), MCS, logistics depot
>=150 kW DC, or curated hub; 'hpc' for power-only >=350 kW DC) with
freightReason carried through to the map and detail panel. Connector power
is now derived from V x A when max_electric_power is missing or implausible
(caps out NDW garbage like 7.36 MW on a 22 kW AC post), eliminating all
zero-kW points. Adds Milence Waddinxveen to curated hubs and a
nearest-gemeente fallback so coastal/industrial sites get detail bundles.
Tariff matching now honors one-sided time windows.

Analysis: peak load finally uses the 150 kW freight constant (was priced at
11 kW), crop stats split by layer so freight no longer skews supply/price
metrics, occupancy is EVSE-weighted, charging_now samples one common hour,
and a new Logistiek metric group exports chargers_freight/freight_dedicated/
freight_power_kw. Relabels peer-model outputs as modelled supply.

Webapp: freight markers colored by kind with status ring, dedicated-only
filter, filter counts respect the power filter, status tallies scoped to
passenger, national-view detail panel can jump into the point's gemeente,
connector kW display mirrors the pipeline derivation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 01:08:54 +02:00

48 lines
1.6 KiB
TypeScript

// Color palettes for the deck.gl layers and legend.
import type { AggregateStatus } from "@/types/charging";
export type RGBA = [number, number, number, number];
// Passenger points: colored by OCPI status (fleetsim-style).
export const STATUS_AVAILABLE: RGBA = [34, 197, 94, 210]; // green-500
export const STATUS_CHARGING: RGBA = [59, 130, 246, 210]; // blue-500
export const STATUS_UNAVAILABLE: RGBA = [239, 68, 68, 210]; // red-500
export const STATUS_UNKNOWN: RGBA = [107, 114, 128, 200]; // gray-500
// Freight points: amber/orange; megawatt = red-orange; truck-capable HPC = light amber.
export const FREIGHT: RGBA = [245, 158, 11, 235]; // amber-500
export const FREIGHT_MEGAWATT: RGBA = [234, 88, 12, 245]; // orange-600
export const FREIGHT_HPC: RGBA = [252, 211, 77, 220]; // amber-300
export const BOUNDARY_LINE: RGBA = [79, 70, 229, 200]; // indigo-600
export function statusColor(status: AggregateStatus): RGBA {
switch (status) {
case "AVAILABLE":
return STATUS_AVAILABLE;
case "CHARGING":
return STATUS_CHARGING;
case "UNAVAILABLE":
return STATUS_UNAVAILABLE;
default:
return STATUS_UNKNOWN;
}
}
export function freightColor(isMegawatt: boolean, kind?: string): RGBA {
if (isMegawatt) return FREIGHT_MEGAWATT;
return kind === "hpc" ? FREIGHT_HPC : FREIGHT;
}
// Hex equivalents for legend / UI swatches.
export const LEGEND = {
available: "#22c55e",
charging: "#3b82f6",
unavailable: "#ef4444",
unknown: "#6b7280",
freight: "#f59e0b",
freightMegawatt: "#ea580c",
freightHpc: "#fcd34d",
boundary: "#4f46e5",
};