{
  "schemaVersion": 1,
  "slug": "battery-life-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0c6584df5b2953861a46e1719af4c6e817387662e679a40b93718eb9052c4ed3",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/battery-life-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": "t = C × η ÷ 100 ÷ P",
    "vars": [
      [
        "C",
        "Battery capacity"
      ],
      [
        "η",
        "Efficiency %"
      ],
      [
        "P",
        "Load"
      ],
      [
        "t",
        "Runtime, hours"
      ]
    ],
    "note": "Load units must match capacity: A vs Ah, or W vs Wh; η is entered in percent."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const usableCapacity = capacity*efficiency/100; const hours = load > 0 ? usableCapacity/load : 0; return { hours, usableCapacity, days: hours/24 };",
    "inputs": [
      {
        "name": "capacity",
        "type": "number",
        "default": 2000,
        "min": 1,
        "max": 200000,
        "step": 1
      },
      {
        "name": "load",
        "type": "number",
        "default": 100,
        "min": 0.01,
        "max": 100000,
        "step": 0.01
      },
      {
        "name": "efficiency",
        "type": "number",
        "default": 85,
        "min": 1,
        "max": 100,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "hours",
        "precision": 2,
        "unit": "hours"
      },
      {
        "name": "usableCapacity",
        "precision": 0,
        "unit": "mAh"
      },
      {
        "name": "days",
        "precision": 2,
        "unit": "days"
      }
    ],
    "interpret": null
  }
}
