{
  "schemaVersion": 1,
  "slug": "sod-calculator",
  "category": "construction",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "eb0eb90abed1db388118a791412caa70c33a2429a12f6f72fb4f8813be52d397",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/sod-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": "A = L×W×(1 + w÷100); P = ⌈A÷c⌉; R = ⌈A÷10⌉; C = A×p",
    "vars": [
      [
        "L",
        "Length (ft)"
      ],
      [
        "W",
        "Width (ft)"
      ],
      [
        "w",
        "Waste allowance (%)"
      ],
      [
        "c",
        "Pallet coverage (sq ft)"
      ],
      [
        "p",
        "Price per sq ft ($)"
      ],
      [
        "A",
        "Area incl. waste (sq ft)"
      ],
      [
        "P",
        "Pallets to order"
      ],
      [
        "R",
        "Rolls to order (10 sq ft each)"
      ],
      [
        "C",
        "Estimated total cost ($)"
      ]
    ],
    "note": "Each roll covers 10 sq ft; pallet and roll counts are rounded up."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const area = length*width;\nconst adj = area*(1+waste/100);\nreturn { area, areaWithWaste: adj, pallets: palletCoverage>0 ? Math.ceil(adj/palletCoverage) : 0, rolls: Math.ceil(adj/10), totalCost: adj*pricePerSqft };",
    "inputs": [
      {
        "name": "length",
        "type": "number",
        "default": 50,
        "min": 0,
        "max": 100000,
        "step": 0.5
      },
      {
        "name": "width",
        "type": "number",
        "default": 30,
        "min": 0,
        "max": 100000,
        "step": 0.5
      },
      {
        "name": "waste",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 30,
        "step": 1,
        "slider": true
      },
      {
        "name": "palletCoverage",
        "type": "number",
        "default": 450,
        "min": 1,
        "max": 2000,
        "step": 10,
        "slider": true
      },
      {
        "name": "pricePerSqft",
        "type": "number",
        "default": 0.45,
        "min": 0,
        "max": 100,
        "step": 0.01,
        "precision": 2
      }
    ],
    "outputs": [
      {
        "name": "area",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "areaWithWaste",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "pallets",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "rolls",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "totalCost",
        "precision": 2,
        "unit": "USD"
      }
    ],
    "interpret": null
  }
}
