{
  "schemaVersion": 1,
  "slug": "solar-panel-calculator",
  "category": "electrical",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "44d549e0075c943b5724c94b7242c6dcae625bff7fc4499711baf5c72707c19d",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/solar-panel-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": "n = ⌈(M×12÷365) ÷ (h×(1−l÷100)) × 1000 ÷ P⌉; E = n×P÷1000×h×(1−l÷100)×365",
    "vars": [
      [
        "M",
        "Monthly electricity use (kWh)"
      ],
      [
        "h",
        "Peak sun hours/day"
      ],
      [
        "l",
        "System losses (%)"
      ],
      [
        "P",
        "Panel rating (W)"
      ]
    ],
    "note": "Array sizing divides average daily kWh by peak sun hours adjusted for entered system loss, then rounds panel count upward. Savings apply the entered USD/kWh rate to all modeled generation; this assumes full retail offset and excludes many site-specific costs and credits. Payback is undefined when savings are zero."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "NREL — PVWatts assumptions and system losses",
        "url": "https://pvwatts.nrel.gov/pvwatts.php"
      }
    ],
    "referenceRole": "context",
    "implementationHash": "44d549e0075c943b5724c94b7242c6dcae625bff7fc4499711baf5c72707c19d",
    "basis": "n = ⌈(M×12÷365) ÷ (h×(1−l÷100)) × 1000 ÷ P⌉; E = n×P÷1000×h×(1−l÷100)×365",
    "limitations": "The references provide context and limitations. They do not validate this page’s illustrative multipliers, lookup values or predictions."
  },
  "contract": {
    "compute": "const dailyUse = monthlyUsageKwh*12/365;\nconst yieldPerKw = Math.max(0.1, sunHoursPerDay*(1 - systemLosses/100));\nconst neededKw = dailyUse/yieldPerKw;\nconst panels = panelWatts > 0 ? Math.ceil(neededKw*1000/panelWatts) : 0;\nconst actualKw = panels*panelWatts/1000;\nconst annual = actualKw*yieldPerKw*365;\nconst cost = panels*panelWatts*costPerWatt;\nconst savings = annual*electricityRate;\nconst annualUse = monthlyUsageKwh*12;\nreturn { systemSizeKw: actualKw, panelsNeeded: panels, roofAreaSqFt: panels*panelArea, annualProductionKwh: annual, annualSavings: savings, offsetPercent: annualUse > 0 ? annual/annualUse*100 : 0, paybackYears: savings > 0 ? cost/savings : null };",
    "inputs": [
      {
        "name": "monthlyUsageKwh",
        "type": "number",
        "default": 900,
        "min": 10,
        "max": 20000,
        "step": 10,
        "slider": true
      },
      {
        "name": "sunHoursPerDay",
        "type": "number",
        "default": 4.5,
        "min": 1,
        "max": 8,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "panelWatts",
        "type": "number",
        "default": 400,
        "min": 50,
        "max": 800,
        "step": 5,
        "slider": true
      },
      {
        "name": "panelArea",
        "type": "number",
        "default": 18,
        "min": 3,
        "max": 60,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "systemLosses",
        "type": "number",
        "default": 18,
        "min": 0,
        "max": 50,
        "step": 1,
        "slider": true
      },
      {
        "name": "electricityRate",
        "type": "number",
        "default": 0.16,
        "min": 0,
        "max": 2,
        "step": 0.01,
        "slider": true
      },
      {
        "name": "costPerWatt",
        "type": "number",
        "default": 2.8,
        "min": 0.3,
        "max": 10,
        "step": 0.1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "systemSizeKw",
        "precision": 2,
        "unit": "kW"
      },
      {
        "name": "panelsNeeded",
        "precision": 0,
        "unit": "panels"
      },
      {
        "name": "roofAreaSqFt",
        "precision": 0,
        "unit": "sq ft"
      },
      {
        "name": "annualProductionKwh",
        "precision": 0,
        "unit": "kWh"
      },
      {
        "name": "annualSavings",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "offsetPercent",
        "precision": 0,
        "unit": "%"
      },
      {
        "name": "paybackYears",
        "precision": 1,
        "unit": "years",
        "optional": true
      }
    ],
    "interpret": null
  }
}
