{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.calculatorx.com/schemas/electrical.battery.pack_sizing.input.json",
  "title": "Battery pack sizing — input",
  "type": "object",
  "oneOf": [
    {
      "title": "watts",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "t_h",
        "V",
        "P_W"
      ],
      "properties": {
        "mode": {
          "const": "watts",
          "description": "Load entered as delivered load-side power P_W"
        },
        "t_h": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Desired runtime (hours)"
        },
        "V": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/V"
        },
        "P_W": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/P_W"
        },
        "dod": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/dod"
        },
        "eta": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/eta_watts"
        },
        "V_cell": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Optional cell nominal voltage; must pair with capacity_cell_Ah. Ns=ceil(V/V_cell) is a packing estimate only."
        },
        "capacity_cell_Ah": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Optional cell capacity; must pair with V_cell"
        }
      },
      "allOf": [
        {
          "oneOf": [
            {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "V_cell"
                    ]
                  },
                  {
                    "required": [
                      "capacity_cell_Ah"
                    ]
                  }
                ]
              }
            },
            {
              "required": [
                "V_cell",
                "capacity_cell_Ah"
              ]
            }
          ]
        }
      ]
    },
    {
      "title": "amps",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode",
        "t_h",
        "V",
        "I_A"
      ],
      "properties": {
        "mode": {
          "const": "amps",
          "description": "Load entered as battery-side discharge current I_A"
        },
        "t_h": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Desired runtime (hours)"
        },
        "V": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/V"
        },
        "I_A": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/I_A"
        },
        "dod": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/dod"
        },
        "eta": {
          "$ref": "https://www.calculatorx.com/schemas/common/battery-runtime-base.defs.json#/$defs/eta_amps"
        },
        "V_cell": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Optional cell nominal voltage; must pair with capacity_cell_Ah. Ns=ceil(V/V_cell) is a packing estimate only."
        },
        "capacity_cell_Ah": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Optional cell capacity; must pair with V_cell"
        }
      },
      "allOf": [
        {
          "oneOf": [
            {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "V_cell"
                    ]
                  },
                  {
                    "required": [
                      "capacity_cell_Ah"
                    ]
                  }
                ]
              }
            },
            {
              "required": [
                "V_cell",
                "capacity_cell_Ah"
              ]
            }
          ]
        }
      ]
    }
  ],
  "description": "Inverse of BatteryRuntimeBaseInput: required t_h + mode load; optional paired V_cell/capacity_cell_Ah for nominal Ns/Np packing estimate (not BMS design). (calculation_version 1.2.0)"
}
