{
  "schemaVersion": 1,
  "slug": "lighting-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "76f6d968420a2501c172c8c17692268211500416d3ea718df4faf5d1500677ef",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/lighting-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": "area = length × width; lumensNeeded = area × targetFc; bulbs = ceil(lumensNeeded ÷ bulbLumens)",
    "vars": [
      [
        "L",
        "room length (ft)"
      ],
      [
        "W",
        "room width (ft)"
      ],
      [
        "lumens",
        "total lumens needed"
      ],
      [
        "bulbs",
        "bulbs needed (rounded up)"
      ],
      [
        "lumens_per_bulb",
        "lumens provided by one bulb"
      ],
      [
        "targetFc",
        "user target illuminance (foot-candles)"
      ]
    ],
    "note": "Area = length × width (sq ft); lumens = area × user-entered foot-candle target; bulb count rounds up. This is a planning estimate, not a lighting standard."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "if(!Number.isFinite(length)||!Number.isFinite(width)||length<=0||width<=0||!Number.isFinite(targetFc)||targetFc<=0||!Number.isFinite(bulbLumens)||bulbLumens<=0)return{area:null,lumensNeeded:null,bulbs:null,__error:'inputError'};const area=length*width;const lumensNeeded=area*targetFc;return{area,lumensNeeded,bulbs:Math.ceil(lumensNeeded/bulbLumens)};",
    "inputs": [
      {
        "name": "length",
        "type": "number",
        "default": 12,
        "min": 0.1,
        "max": 500,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "width",
        "type": "number",
        "default": 12,
        "min": 0.1,
        "max": 500,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "targetFc",
        "type": "number",
        "default": 70,
        "min": 1,
        "max": 150,
        "step": 1,
        "slider": true
      },
      {
        "name": "bulbLumens",
        "type": "number",
        "default": 800,
        "min": 1,
        "max": 20000,
        "step": 50,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "area",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "lumensNeeded",
        "precision": 0,
        "unit": "lm"
      },
      {
        "name": "bulbs",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
