{
  "schemaVersion": 1,
  "slug": "power-calculator",
  "category": "conversion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0544ec73b759d5ceacfd197fd8ec0d562359d4380aa2655e619804efdeccbee0",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/power-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": "result = v · F[s] ÷ F[t]",
    "vars": [
      [
        "result",
        "Converted value"
      ],
      [
        "v",
        "Value in source unit"
      ],
      [
        "F",
        "Unit factor table (see note)"
      ],
      [
        "s",
        "Source unit code"
      ],
      [
        "t",
        "Target unit code"
      ]
    ],
    "note": "F table: W 1, kW 1000, MW 10^6, hp 745.6999, metric hp 735.4988, BTU/h 0.2931, refrigeration ton 3516.85."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "NIST SP 811 — Conversion factors by quantity",
        "url": "https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b9"
      }
    ],
    "basis": "Convert power via watts; mechanical horsepower and metric horsepower use different factors.",
    "limitations": "Only the displayed unit definitions are converted; rounding and measurement uncertainty are separate.",
    "implementationHash": "0544ec73b759d5ceacfd197fd8ec0d562359d4380aa2655e619804efdeccbee0",
    "domain": "conversion"
  },
  "contract": {
    "compute": "const units={\"w\":\"W\",\"kw\":\"kW\",\"mw\":\"MW\",\"hp\":\"hp\",\"hpmetric\":\"PS\",\"btuh\":\"BTU/h\",\"ton\":\"RT\"}, factors={\"w\":1,\"kw\":1000,\"mw\":1000000,\"hp\":745.6998715822702,\"hpmetric\":735.49875,\"btuh\":0.29307107017222,\"ton\":3516.8528420667}; if(!Number.isFinite(value)||value<-1000000000000||value>1000000000000||!Object.prototype.hasOwnProperty.call(units,from)||!Object.prototype.hasOwnProperty.call(units,to))return {\"result\":null,\"watts\":null,\"kw\":null,\"hp\":null,\"__error\":\"inputError\"}; const out=(function(){const F={w:1,kw:1000,mw:1e6,hp:745.69987158227022,hpmetric:735.49875,btuh:0.29307107017222,ton:3516.8528420667}; const w=value*F[from]; return { result: w/F[to], watts: w, kw: w/1000, hp: w/745.69987158227022 };})(); if(out.__error)return {...{\"result\":null,\"watts\":null,\"kw\":null,\"hp\":null},...out}; out.__resultUnit=units[to]; out.__unitRatio=factors[to]/factors[from]; return out;",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": 1,
        "min": -1000000000000,
        "max": 1000000000000,
        "step": 0.0001,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "from",
        "type": "select",
        "default": "hp",
        "options": [
          {
            "value": "hp"
          },
          {
            "value": "w"
          },
          {
            "value": "kw"
          },
          {
            "value": "mw"
          },
          {
            "value": "hpmetric"
          },
          {
            "value": "btuh"
          },
          {
            "value": "ton"
          }
        ]
      },
      {
        "name": "to",
        "type": "select",
        "default": "kw",
        "options": [
          {
            "value": "kw"
          },
          {
            "value": "w"
          },
          {
            "value": "mw"
          },
          {
            "value": "hp"
          },
          {
            "value": "hpmetric"
          },
          {
            "value": "btuh"
          },
          {
            "value": "ton"
          }
        ]
      },
      {
        "name": "precision",
        "type": "select",
        "default": 4,
        "options": [
          {
            "value": 0
          },
          {
            "value": 2
          },
          {
            "value": 4
          },
          {
            "value": 6
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "result",
        "precision": 4,
        "unit": "",
        "precisionField": "precision",
        "unitField": "__resultUnit",
        "trimTrailingZeros": true,
        "notation": "auto"
      },
      {
        "name": "watts",
        "precision": 2,
        "unit": "W",
        "showWhen": {
          "to": [
            "kw",
            "mw",
            "hp",
            "hpmetric",
            "btuh",
            "ton"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "kw",
        "precision": 6,
        "unit": "kW",
        "showWhen": {
          "to": [
            "w",
            "mw",
            "hp",
            "hpmetric",
            "btuh",
            "ton"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "hp",
        "precision": 4,
        "unit": "hp",
        "showWhen": {
          "to": [
            "w",
            "kw",
            "mw",
            "hpmetric",
            "btuh",
            "ton"
          ]
        },
        "notation": "auto"
      }
    ],
    "interpret": null
  }
}
