{
  "schemaVersion": 1,
  "slug": "brine-ratio-calculator",
  "category": "cooking",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "82d414ac1be30865fb8320bfa20382d7a529530df87f9d1e88c3a20ac31c367b",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/brine-ratio-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": "Salt = T·p ÷ 100;  Sugar = Salt·q ÷ 100;  T = F + m·W,  m ∈ {0,1}",
    "vars": [
      [
        "Salt",
        "Salt, g"
      ],
      [
        "T",
        "Total brine weight, g"
      ],
      [
        "p",
        "Brine strength, % of total weight"
      ],
      [
        "q",
        "Sugar as % of salt"
      ],
      [
        "F",
        "Food weight, g"
      ],
      [
        "W",
        "Water weight for wet brine, g"
      ],
      [
        "Sugar",
        "Sugar, g"
      ],
      [
        "m",
        "Brine mode: 0 dry, 1 wet"
      ]
    ],
    "note": "Calculates ingredient quantities from the selected ratio basis. It does not estimate brining time or food safety."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const total = method === 'wet' ? (foodWeight + waterWeight) : foodWeight; const salt = total*salinePct/100; const sugar = salt*sugarPct/100; const concentration = foodWeight > 0 ? salt/foodWeight*100 : 0; return { saltGrams: salt, saltOunces: salt/28.3495, saltTablespoons: salt/18, sugarGrams: sugar, totalLiquid: total, concentration: concentration };",
    "inputs": [
      {
        "name": "method",
        "type": "select",
        "default": "wet",
        "options": [
          {
            "value": "wet"
          },
          {
            "value": "dry"
          }
        ]
      },
      {
        "name": "foodWeight",
        "type": "number",
        "default": 2000,
        "min": 1,
        "max": 1000000,
        "step": 1
      },
      {
        "name": "waterWeight",
        "type": "number",
        "default": 3000,
        "min": 0,
        "max": 1000000,
        "step": 1
      },
      {
        "name": "salinePct",
        "type": "number",
        "default": 5,
        "min": 0.5,
        "max": 15,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "sugarPct",
        "type": "number",
        "default": 50,
        "min": 0,
        "max": 200,
        "step": 5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "saltGrams",
        "precision": 1,
        "unit": "g"
      },
      {
        "name": "saltOunces",
        "precision": 1,
        "unit": "oz"
      },
      {
        "name": "saltTablespoons",
        "precision": 1,
        "unit": "tbsp"
      },
      {
        "name": "sugarGrams",
        "precision": 1,
        "unit": "g"
      },
      {
        "name": "totalLiquid",
        "precision": 0,
        "unit": "g"
      },
      {
        "name": "concentration",
        "precision": 2,
        "unit": "%"
      }
    ],
    "interpret": null
  }
}
