{
  "schemaVersion": 1,
  "slug": "water-usage-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "cb728b33745ce21753956dd9db6e0056ea067596cff664fdc5a0e4af70c537cb",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/water-usage-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": "G = p × n_s ÷ 7 × m_s × q_s + p × n_f × g_t + n_l ÷ 7 × 15 + G_o ÷ 7",
    "vars": [
      [
        "p",
        "People in household"
      ],
      [
        "n_s",
        "Showers per person/week"
      ],
      [
        "m_s",
        "Shower length (min)"
      ],
      [
        "q_s",
        "Shower flow (gal/min)"
      ],
      [
        "n_f",
        "Flushes per person/day"
      ],
      [
        "n_l",
        "Laundry loads/week"
      ]
    ],
    "note": "Also uses gallons per flush (g_t) and outdoor US gallons/week (G_o). The per-person daily figure divides all household use equally by p. Monthly = daily×30.44; cost = monthly US gal ÷1,000 × USD rate."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const shower = people*showersPerWeek/7*showerMinutes*showerFlow; const toilet = people*flushesPerDay*toiletGallons; const laundry = laundryLoads/7*15; const daily = shower+toilet+laundry+outdoorGallons/7; const monthly = daily*30.44; return { dailyGallons: daily, monthlyGallons: monthly, monthlyCost: monthly/1000*rate, yearlyCost: monthly/1000*rate*12, perPersonDay: daily/people };",
    "inputs": [
      {
        "name": "people",
        "type": "number",
        "default": 4,
        "min": 1,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "showersPerWeek",
        "type": "number",
        "default": 7,
        "min": 0,
        "max": 21,
        "step": 1,
        "slider": true
      },
      {
        "name": "showerMinutes",
        "type": "number",
        "default": 8,
        "min": 0,
        "max": 60,
        "step": 1,
        "slider": true
      },
      {
        "name": "showerFlow",
        "type": "number",
        "default": 2,
        "min": 0.5,
        "max": 10,
        "step": 0.1,
        "slider": true,
        "advanced": true
      },
      {
        "name": "flushesPerDay",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "toiletGallons",
        "type": "number",
        "default": 1.28,
        "min": 0.5,
        "max": 7,
        "step": 0.01,
        "slider": true,
        "advanced": true
      },
      {
        "name": "laundryLoads",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 50,
        "step": 1,
        "slider": true
      },
      {
        "name": "outdoorGallons",
        "type": "number",
        "default": 200,
        "min": 0,
        "max": 10000,
        "step": 10,
        "slider": true
      },
      {
        "name": "rate",
        "type": "number",
        "default": 4.5,
        "min": 0,
        "max": 50,
        "step": 0.1,
        "slider": true,
        "advanced": true
      }
    ],
    "outputs": [
      {
        "name": "dailyGallons",
        "precision": 1,
        "unit": "gal"
      },
      {
        "name": "monthlyGallons",
        "precision": 0,
        "unit": "gal"
      },
      {
        "name": "monthlyCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "yearlyCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "perPersonDay",
        "precision": 1,
        "unit": "gal"
      }
    ],
    "interpret": null
  }
}
