{
  "capability_id": "electrical.battery.pack_sizing",
  "tool_id": "battery-pack-sizing",
  "engine": "battery-pack-sizing",
  "calculation_version": "1.1.0",
  "generated_at": "2026-08-12T15:31:42.632Z",
  "engine_build": "2026-08-12",
  "test_count": 13,
  "passed": 13,
  "failed": 0,
  "tests_summary": {
    "golden": {
      "total": 3,
      "passed": 3
    },
    "boundary": {
      "total": 6,
      "passed": 6
    },
    "property": {
      "total": 4,
      "passed": 4
    }
  },
  "engine_tested": true,
  "expert_reviewed": false,
  "internally_reviewed": true,
  "review_kind": "internal",
  "source_checked": true,
  "reviewed_by": "CalculatorX electrical review",
  "reviewer_role": "electrical-engineer",
  "last_reviewed": "2026-08-12",
  "expert_review": {
    "status": "not_applicable",
    "reviewer": null,
    "note": "Internal domain review completed; not a named external expert review.",
    "kind": "internal"
  },
  "internal_review": {
    "status": "approved",
    "reviewer": {
      "name": "CalculatorX electrical review",
      "role": "electrical-engineer"
    },
    "reviewed_at": "2026-08-12",
    "scope": [
      "formula",
      "input semantics",
      "assumptions",
      "limitations",
      "sources",
      "tests"
    ],
    "kind": "internal"
  },
  "page": "https://www.calculatorx.com/calc/electric/battery-pack-sizing",
  "api": "https://www.calculatorx.com/api/v1/calc/battery-pack-sizing",
  "schema_input": "https://www.calculatorx.com/schemas/electrical.battery.pack_sizing.input.json",
  "schema_output": "https://www.calculatorx.com/schemas/electrical.battery.pack_sizing.output.json",
  "assumptions": [
    "Constant load; ceil cell counts; not Peukert",
    "Amps mode I_A is battery-side; η does not enter Ah"
  ],
  "limitations": [
    "Constant-load inverse of battery-runtime 1.2+",
    "Amps mode = battery-side current; η does not enter Ah",
    "Cell counts use ceil"
  ],
  "boundary_conditions": [
    "Only one of V_cell/capacity_cell_Ah → NEEDS_TWO_INPUTS",
    "Bad mode → INVALID_MODE; dod/eta out of range → FRACTION_OUT_OF_RANGE"
  ],
  "sources": [
    "CalculatorX Battery Runtime capability — Constant-load watts/amps model (1.2+) — Inverse capacity sizing"
  ],
  "fingerprint": "sha256:ebde9dfda4dc2bdbd9537930940697e18b7b1513b00cc42a0376841fdf9788df",
  "tests": [
    {
      "id": "ideal-10Ah",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "dod": 1,
        "eta": 1
      },
      "expect": {
        "capacity_Ah": 10,
        "E_Wh": 120
      },
      "actual": {
        "mode": "watts",
        "capacity_Ah": 10,
        "E_Wh": 120,
        "t_h": 6,
        "V": 12,
        "dod": 1,
        "eta": 1,
        "P_W": 20,
        "I_A": null
      },
      "tol": 1e-9
    },
    {
      "id": "cells",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "watts",
        "P_W": 29.6,
        "t_h": 5,
        "V": 14.8,
        "V_cell": 3.7,
        "capacity_cell_Ah": 2.5
      },
      "expect": {
        "capacity_Ah": 10,
        "n_s": 4,
        "n_p": 4,
        "n_cells": 16
      },
      "actual": {
        "mode": "watts",
        "capacity_Ah": 10,
        "E_Wh": 148,
        "t_h": 5,
        "V": 14.8,
        "dod": 1,
        "eta": 1,
        "P_W": 29.6,
        "I_A": null,
        "V_cell": 3.7,
        "capacity_cell_Ah": 2.5,
        "n_s": 4,
        "n_p": 4,
        "n_cells": 16,
        "V_pack": 14.8,
        "capacity_pack_Ah": 10
      },
      "tol": 1e-9
    },
    {
      "id": "cell-half",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "V_cell": 3.7
      },
      "expectError": "NEEDS_TWO_INPUTS",
      "code": "NEEDS_TWO_INPUTS",
      "error": "V_cell and capacity_cell_Ah must both be provided"
    },
    {
      "id": "missing-t",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "V": 12
      },
      "expectError": "MISSING_REQUIRED_INPUT",
      "code": "MISSING_REQUIRED_INPUT",
      "error": "t_h is required"
    },
    {
      "id": "amps-eta-ignored",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "amps",
        "I_A": 2,
        "t_h": 4,
        "V": 12,
        "dod": 0.8,
        "eta": 0.9
      },
      "expect": {
        "capacity_Ah": 10,
        "E_Wh": 96
      },
      "actual": {
        "mode": "amps",
        "capacity_Ah": 10,
        "E_Wh": 96,
        "t_h": 4,
        "V": 12,
        "dod": 0.8,
        "eta": 1,
        "P_W": null,
        "I_A": 2,
        "warnings": [
          {
            "code": "ETA_IGNORED_IN_AMPS_MODE",
            "severity": "info",
            "detail": "Amps mode treats I_A as battery-side discharge current; η does not enter capacity sizing (aligned with electrical.battery_runtime).",
            "suggestion": "Use watts mode with load-side P_W when applying system efficiency η."
          }
        ]
      },
      "tol": 1e-9
    },
    {
      "id": "boundary-10Ah",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12
      },
      "expect": {
        "capacity_Ah": 10,
        "E_Wh": 120
      },
      "actual": {
        "mode": "watts",
        "capacity_Ah": 10,
        "E_Wh": 120,
        "t_h": 6,
        "V": 12,
        "dod": 1,
        "eta": 1,
        "P_W": 20,
        "I_A": null
      },
      "tol": 1e-9
    },
    {
      "id": "boundary-cells",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 29.6,
        "t_h": 5,
        "V": 14.8,
        "V_cell": 3.7,
        "capacity_cell_Ah": 2.5
      },
      "expect": {
        "n_s": 4,
        "n_p": 4
      },
      "actual": {
        "mode": "watts",
        "capacity_Ah": 10,
        "E_Wh": 148,
        "t_h": 5,
        "V": 14.8,
        "dod": 1,
        "eta": 1,
        "P_W": 29.6,
        "I_A": null,
        "V_cell": 3.7,
        "capacity_cell_Ah": 2.5,
        "n_s": 4,
        "n_p": 4,
        "n_cells": 16,
        "V_pack": 14.8,
        "capacity_pack_Ah": 10
      },
      "tol": 1e-9
    },
    {
      "id": "boundary-half-cell",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "V_cell": 3.7
      },
      "expectError": "NEEDS_TWO_INPUTS",
      "code": "NEEDS_TWO_INPUTS",
      "error": "V_cell and capacity_cell_Ah must both be provided"
    },
    {
      "id": "boundary-amps-eta-ignored",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "amps",
        "I_A": 2,
        "t_h": 4,
        "V": 12,
        "dod": 0.8,
        "eta": 0.9
      },
      "expect": {
        "capacity_Ah": 10,
        "E_Wh": 96
      },
      "actual": {
        "mode": "amps",
        "capacity_Ah": 10,
        "E_Wh": 96,
        "t_h": 4,
        "V": 12,
        "dod": 0.8,
        "eta": 1,
        "P_W": null,
        "I_A": 2,
        "warnings": [
          {
            "code": "ETA_IGNORED_IN_AMPS_MODE",
            "severity": "info",
            "detail": "Amps mode treats I_A as battery-side discharge current; η does not enter capacity sizing (aligned with electrical.battery_runtime).",
            "suggestion": "Use watts mode with load-side P_W when applying system efficiency η."
          }
        ]
      },
      "tol": 1e-9
    },
    {
      "id": "property-ah",
      "ok": true,
      "kind": "property",
      "detail": "10 Ah",
      "expect": {
        "capacity_Ah": 10
      },
      "actual": {
        "mode": "watts",
        "capacity_Ah": 10,
        "E_Wh": 120,
        "t_h": 6,
        "V": 12,
        "dod": 1,
        "eta": 1,
        "P_W": 20,
        "I_A": null
      }
    },
    {
      "id": "property-load",
      "ok": true,
      "kind": "property",
      "detail": "2P → 2Ah",
      "expect": 20,
      "actual": 20
    },
    {
      "id": "property-cells",
      "ok": true,
      "kind": "property",
      "detail": "4S4P",
      "expect": true,
      "actual": true
    },
    {
      "id": "property-amps-eta-ignored",
      "ok": true,
      "kind": "property",
      "detail": "amps η ignored",
      "expect": {
        "capacity_Ah": 10,
        "E_Wh": 96
      },
      "actual": {
        "mode": "amps",
        "capacity_Ah": 10,
        "E_Wh": 96,
        "t_h": 4,
        "V": 12,
        "dod": 0.8,
        "eta": 1,
        "P_W": null,
        "I_A": 2,
        "warnings": [
          {
            "code": "ETA_IGNORED_IN_AMPS_MODE",
            "severity": "info",
            "detail": "Amps mode treats I_A as battery-side discharge current; η does not enter capacity sizing (aligned with electrical.battery_runtime).",
            "suggestion": "Use watts mode with load-side P_W when applying system efficiency η."
          }
        ]
      }
    }
  ],
  "tier": "internally_reviewed"
}
