{
  "schemaVersion": 1,
  "slug": "towing-capacity-calculator",
  "category": "automotive",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "477be4d8fd418a455f70233d1aeda1374cf7cdb7a3371c3f7128f9a74b035405",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/towing-capacity-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "L = min(T, H, { P ÷ (q ÷ 100), q > 0; 0, q = 0 }); v = 𝟙[W ≤ L ∧ q × W ÷ 100 ≤ P]",
    "vars": [
      [
        "L",
        "Maximum trailer weight"
      ],
      [
        "W",
        "Trailer weight"
      ],
      [
        "T,H",
        "Tow rating; hitch rating"
      ],
      [
        "P",
        "Remaining payload"
      ],
      [
        "q",
        "Tongue weight (%)"
      ],
      [
        "v,𝟙[x]",
        "Verdict (1 pass, 0 fail); indicator: 1 if x holds, else 0"
      ]
    ],
    "note": "P = max(0, GVWR − curb weight − passengers); q = 0 makes the payload-based limit 0."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const payloadCapacity=gvwr-curbWeight,remainingPayload=payloadCapacity-passengers,tongueWeight=trailerWeight*tonguePercent/100;if(payloadCapacity<=0||remainingPayload<0||towRating<=0||hitchRating<=0||tonguePercent<=0) return {payloadCapacity:null,remainingPayload:null,tongueWeight:null,maxTrailer:null,verdict:null,__error:'inputError'};const maxTrailer=Math.min(towRating,remainingPayload/(tonguePercent/100),hitchRating),ok=trailerWeight<=maxTrailer&&tongueWeight<=remainingPayload;return {payloadCapacity,remainingPayload,tongueWeight,maxTrailer,verdict:ok?'Within the entered ratings':'Exceeds at least one entered limit'};",
    "inputs": [
      {
        "name": "gvwr",
        "type": "number",
        "default": 7000,
        "min": 1000,
        "max": 30000,
        "step": 100,
        "slider": true
      },
      {
        "name": "curbWeight",
        "type": "number",
        "default": 5200,
        "min": 500,
        "max": 20000,
        "step": 50,
        "slider": true
      },
      {
        "name": "passengers",
        "type": "number",
        "default": 600,
        "min": 0,
        "max": 5000,
        "step": 50,
        "slider": true
      },
      {
        "name": "towRating",
        "type": "number",
        "default": 9000,
        "min": 0,
        "max": 40000,
        "step": 100,
        "slider": true
      },
      {
        "name": "trailerWeight",
        "type": "number",
        "default": 6000,
        "min": 0,
        "max": 40000,
        "step": 100,
        "slider": true
      },
      {
        "name": "tonguePercent",
        "type": "number",
        "default": 12,
        "min": 5,
        "max": 25,
        "step": 1,
        "slider": true
      },
      {
        "name": "hitchRating",
        "type": "number",
        "default": 10000,
        "min": 0,
        "max": 40000,
        "step": 100,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "payloadCapacity",
        "precision": 0,
        "unit": "lb"
      },
      {
        "name": "remainingPayload",
        "precision": 0,
        "unit": "lb"
      },
      {
        "name": "tongueWeight",
        "precision": 0,
        "unit": "lb"
      },
      {
        "name": "maxTrailer",
        "precision": 0,
        "unit": "lb"
      },
      {
        "name": "verdict",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
