Documentation
Tariff formula
The estimator on the Tariffs & estimator page computes a low–high range from the tariff table in src/data/tariffs.json. The formula is documented here so a buyer can audit it or replace it with their own.
Inputs
teu— number of TEU (1–500).size— container size, one of20,40,45.type— cargo type, one ofdry,reefer,tank,oog.dwell— dwell days alongside (1–30).terminal— terminal slug, used to look up the per-terminal surcharge.
Formula
base = perTeu[size][type] × teu
reeferSurcharge = (type == 'reefer') ? reefer.perDay × dwell × teu : 0
dwellSurcharge = max(0, dwell − freeDays) × dwell.perTeuPerDay × teu
subtotal = base + reeferSurcharge + dwellSurcharge
terminalAdj = subtotal × terminalSurcharge
mid = subtotal + terminalAdj
low = mid × (1 − uncertaintyBand)
high = mid × (1 + uncertaintyBand) Constants from tariffs.json
freeDays= 5 (free dwell period before surcharge applies)reefer.perDay= USD 22dwell.perTeuPerDay= USD 8uncertaintyBand= ±12% (covers variable handling conditions)
Replacing the formula
The estimator logic lives in src/components/Estimator.astro — both the server-side default estimate and the client-side interactive recompute use the same estimate() function. To replace the formula, edit estimate() in both places (or extract it into src/lib/tariff.ts if you want a single source of truth).