{
  "capability_id": "electrical.battery.pack_sizing",
  "tool_id": "battery-pack-sizing",
  "engine": "battery-pack-sizing",
  "calculation_version": "1.2.0",
  "generated_at": "2026-09-16T22:03:43.720Z",
  "engine_build": "2026-09-10",
  "test_count": 27,
  "passed": 27,
  "failed": 0,
  "tests_summary": {
    "golden": {
      "total": 3,
      "passed": 3
    },
    "boundary": {
      "total": 17,
      "passed": 17
    },
    "property": {
      "total": 7,
      "passed": 7
    }
  },
  "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-09-05",
  "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-09-05",
    "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 as nominal packing estimate; not Peukert or BMS design",
    "Amps mode I_A is battery-side; η does not enter Ah",
    "V is target/system nominal voltage; V_pack = Ns·V_cell may differ"
  ],
  "limitations": [
    "Constant-load inverse of BatteryRuntimeBaseInput / battery_runtime 1.2+",
    "Amps mode = battery-side current; η does not enter Ah",
    "Cell Ns/Np use ceil — nominal packing estimate only, not BMS / chemistry pack design",
    "When V_pack ≠ V_target the result includes warning PACK_VOLTAGE_DIFFERS_FROM_TARGET",
    "mode=watts requires P_W; mode=amps requires I_A",
    "V_cell XOR incomplete pair → NEEDS_TWO_INPUTS (both or neither)"
  ],
  "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",
    "t/V/P/I ≤ 0 → VALUE_MUST_BE_POSITIVE / VOLTAGE_MUST_BE_POSITIVE / LOAD_MUST_BE_POSITIVE",
    "V_pack ≠ V → warning PACK_VOLTAGE_DIFFERS_FROM_TARGET"
  ],
  "sources": [
    {
      "title": "IEC 60050 — International Electrotechnical Vocabulary",
      "section": "Electric battery capacity and related quantities",
      "supports": "Ah capacity and Wh energy relationship E ≈ Q·V for nominal estimates",
      "kind": "standard"
    },
    {
      "title": "Victron Energy — Battery capacity and Peukert exponent",
      "section": "SmartShunt / battery monitor documentation",
      "url": "https://www.victronenergy.com/media/pg/SmartShunt/en/battery-capacity-and-peukert-exponent.html",
      "supports": "Ideal Ah ≈ I·t under constant current; Peukert and rate effects as reasons this tool stays first-order (Not Peukert)",
      "kind": "reference"
    },
    {
      "title": "CalculatorX Battery Runtime capability",
      "section": "Constant-load watts/amps model (1.2+) — internal method dependency",
      "supports": "Inverse capacity sizing; shared watts/amps semantics with electrical.battery_runtime",
      "kind": "other"
    }
  ],
  "methods": [
    "derived_from:electrical.battery_runtime@1.2.0 — inverse constant-load watts/amps model"
  ],
  "derived_from": {
    "capability_id": "electrical.battery_runtime",
    "calculation_version": "1.2.0",
    "relation": "inverse_model",
    "note": "inverse constant-load watts/amps model"
  },
  "fingerprint": "sha256:b3a87a18a21fe41a5c7d2da0d313bf40be7ccbbf30980df5749b8ea96dbd34ca",
  "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
      },
      "expectWarning": null,
      "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
      },
      "expectWarning": null,
      "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
      },
      "expectWarning": null,
      "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": "nonintegral-series",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "V_cell": 3.7,
        "capacity_cell_Ah": 2.5
      },
      "expect": {
        "capacity_Ah": 10,
        "n_s": 4,
        "n_p": 4,
        "n_cells": 16,
        "V_pack": 14.8
      },
      "expectWarning": "PACK_VOLTAGE_DIFFERS_FROM_TARGET",
      "actual": {
        "mode": "watts",
        "capacity_Ah": 10,
        "E_Wh": 120,
        "t_h": 6,
        "V": 12,
        "dod": 1,
        "eta": 1,
        "P_W": 20,
        "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,
        "warnings": [
          {
            "code": "PACK_VOLTAGE_DIFFERS_FROM_TARGET",
            "severity": "warning",
            "detail": "Requested nominal voltage: 12 V; calculated nominal cell-stack voltage: 14.8 V (Ns=ceil(V/V_cell)=4).",
            "suggestion": "Series count is a nominal packing estimate only. Verify cell min/max voltage, system operating range, BMS limits, and chemistry requirements before pack design."
          }
        ]
      },
      "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
      },
      "expectWarning": null,
      "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
      },
      "expectWarning": null,
      "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-cell-capacity-only",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "capacity_cell_Ah": 2.5
      },
      "expectError": "NEEDS_TWO_INPUTS",
      "code": "NEEDS_TWO_INPUTS",
      "error": "V_cell and capacity_cell_Ah must both be provided"
    },
    {
      "id": "boundary-invalid-mode",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "dc",
        "P_W": 20,
        "t_h": 6,
        "V": 12
      },
      "expectError": "INVALID_MODE",
      "code": "INVALID_MODE",
      "error": "mode must be \"watts\" or \"amps\""
    },
    {
      "id": "boundary-dod-over-one",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "dod": 1.2
      },
      "expectError": "FRACTION_OUT_OF_RANGE",
      "code": "FRACTION_OUT_OF_RANGE",
      "error": "dod must be in (0, 1]"
    },
    {
      "id": "boundary-eta-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "eta": 0
      },
      "expectError": "FRACTION_OUT_OF_RANGE",
      "code": "FRACTION_OUT_OF_RANGE",
      "error": "eta must be in (0, 1]"
    },
    {
      "id": "boundary-t-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 0,
        "V": 12
      },
      "expectError": "VALUE_MUST_BE_POSITIVE",
      "code": "VALUE_MUST_BE_POSITIVE",
      "error": "t_h must be greater than zero"
    },
    {
      "id": "boundary-V-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 0
      },
      "expectError": "VOLTAGE_MUST_BE_POSITIVE",
      "code": "VOLTAGE_MUST_BE_POSITIVE",
      "error": "V must be greater than zero"
    },
    {
      "id": "boundary-P-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 0,
        "t_h": 6,
        "V": 12
      },
      "expectError": "LOAD_MUST_BE_POSITIVE",
      "code": "LOAD_MUST_BE_POSITIVE",
      "error": "P_W must be greater than zero"
    },
    {
      "id": "boundary-I-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "amps",
        "I_A": 0,
        "t_h": 4,
        "V": 12
      },
      "expectError": "LOAD_MUST_BE_POSITIVE",
      "code": "LOAD_MUST_BE_POSITIVE",
      "error": "I_A must be greater than zero"
    },
    {
      "id": "boundary-dod-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "dod": 0
      },
      "expectError": "FRACTION_OUT_OF_RANGE",
      "code": "FRACTION_OUT_OF_RANGE",
      "error": "dod must be in (0, 1]"
    },
    {
      "id": "boundary-eta-over-one",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "P_W": 20,
        "t_h": 6,
        "V": 12,
        "eta": 1.1
      },
      "expectError": "FRACTION_OUT_OF_RANGE",
      "code": "FRACTION_OUT_OF_RANGE",
      "error": "eta must be in (0, 1]"
    },
    {
      "id": "boundary-watts-missing-P",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "watts",
        "t_h": 6,
        "V": 12
      },
      "expectError": "MISSING_REQUIRED_INPUT",
      "code": "MISSING_REQUIRED_INPUT",
      "error": "P_W is required"
    },
    {
      "id": "boundary-amps-missing-I",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "amps",
        "t_h": 4,
        "V": 12
      },
      "expectError": "MISSING_REQUIRED_INPUT",
      "code": "MISSING_REQUIRED_INPUT",
      "error": "I_A is required"
    },
    {
      "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 exact stack (no voltage-diff warning)",
      "expect": true,
      "actual": {
        "n_s": 4,
        "n_p": 4
      }
    },
    {
      "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 η."
          }
        ]
      }
    },
    {
      "id": "property-pack-voltage-differs",
      "ok": true,
      "kind": "property",
      "detail": "12 V / 3.7 V → V_pack 14.8 + PACK_VOLTAGE_DIFFERS_FROM_TARGET",
      "expect": {
        "n_s": 4,
        "V_pack": 14.8,
        "warning": "PACK_VOLTAGE_DIFFERS_FROM_TARGET"
      },
      "actual": {
        "n_s": 4,
        "V_pack": 14.8,
        "warnings": [
          {
            "code": "PACK_VOLTAGE_DIFFERS_FROM_TARGET",
            "severity": "warning",
            "detail": "Requested nominal voltage: 12 V; calculated nominal cell-stack voltage: 14.8 V (Ns=ceil(V/V_cell)=4).",
            "suggestion": "Series count is a nominal packing estimate only. Verify cell min/max voltage, system operating range, BMS limits, and chemistry requirements before pack design."
          }
        ]
      }
    },
    {
      "id": "property-roundtrip-runtime-watts",
      "ok": true,
      "kind": "property",
      "detail": "pack sizing ↔ battery_runtime watts round-trip",
      "expect": 6,
      "actual": 5.999999999999999
    },
    {
      "id": "property-roundtrip-runtime-amps",
      "ok": true,
      "kind": "property",
      "detail": "pack sizing ↔ battery_runtime amps round-trip",
      "expect": 4,
      "actual": 4
    }
  ],
  "tier": "internally_reviewed",
  "verification": {
    "tests": {
      "passed": 27,
      "total": 27,
      "golden": 3,
      "boundary": 17,
      "property": 7
    },
    "contract_checks": {
      "passed": 4,
      "total": 4
    }
  },
  "evidence_core_generated_at": "2026-09-05T15:29:50.831Z",
  "rendered_at": "2026-09-16T22:03:43.720Z",
  "release_integrity": {
    "status": "verified",
    "scope": "workspace",
    "production_attestation_required": true,
    "calculation_version": "1.2.0",
    "artifacts": {
      "engine": "1.2.0",
      "page": "1.2.0",
      "capability": "1.2.0",
      "evidence": "1.2.0",
      "input_schema": "1.2.0",
      "output_schema": "1.2.0",
      "mcp_contract": "1.2.0"
    },
    "digests": {
      "input_schema_sha256": "efbfe6f1c002ef9ba44af12ce224324e0618ece83cfc78c98f4db8b38c5f70f3",
      "output_schema_sha256": "acb2f259f709c99aca6f4aac55846212b216b63f875beae2644fd0d8aecde756",
      "evidence_sha256": "2cd4cdf43c88edce1db99d00d2ebe5d3d15279c9eb4d1cdce25d83a182453c73",
      "evidence_core_sha256": "2cd4cdf43c88edce1db99d00d2ebe5d3d15279c9eb4d1cdce25d83a182453c73",
      "capability_sha256": "e1d7fd780bc2b8f0807af598a5c89f6201a81aec0124178ac2a577998136adfc",
      "engine_sha256": "c8d4ccdbfeaf61d7b024d4e1babb0c2ba3b324c1b37bd0cb456a526d8d2b1bd1",
      "mcp_contract_sha256": "863098b311a7b17dc4b229a6302b90b3545b175f716e5d84772c7be8e9716b86"
    },
    "contract_checks": {
      "total": 4,
      "passed": 4,
      "failed": 0,
      "items": [
        {
          "id": "release-artifacts-aligned",
          "status": "pass",
          "detail": "1.2.0"
        },
        {
          "id": "schema-valid-input-executes",
          "status": "pass"
        },
        {
          "id": "engine-success-output-validates-schema",
          "status": "pass"
        },
        {
          "id": "schema-rejects-incomplete-input",
          "status": "pass"
        }
      ]
    },
    "report": "https://www.calculatorx.com/.well-known/calculatorx-release-integrity.json"
  }
}
