Skip to content

karidasd/winemaking-calculators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Winemaking Calculators Banner

🍷 Winemaking Calculators (AI Edition)

Enterprise-grade tools for Oenologists & Master Blenders — Powered by Machine Learning.
19 professional modules. Zero fluff. 100% open source.

Winemaking Calculators Screenshot


🧪 Why this exists

Winemakers and oenologists deal with the same calculations daily — SO₂ additions, chaptalization, acidification, yeast rehydration — often done by hand, on a notepad, at 3am in a cellar.

This repository gives you clean, documented Python code for every core winemaking formula, wrapped in a beautiful web UI you can run on any device — including your phone in the vineyard.


🛠️ Available Calculators

# Calculator What it does
1 🧪 SO₂ Manager Molecular SO₂, free SO₂ needed, additions in g for K₂S₂O₅ / liquid SO₂
2 🍬 Sugar & Alcohol Brix → Potential Alcohol, SG → Brix, Chaptalization amounts
3 🧊 Acidity Adjustment Tartaric acid addition (acidification), CaCO₃ deacidification
4 🌱 Yeast & Nutrients GO-FERM rehydration, DAP/Fermaid-O YAN additions
5 🔀 Blending Tool Blend result calculator + Pearson's Square for target blends
6 🧹 Fining Agents Bentonite, egg white, gelatine, isinglass, carbon additions
7 🫧 Dissolved CO₂ Henry's Law CO₂ estimates by temperature and wine style
8 🟤 H₂S Treatment Copper sulfate (CuSO₄·5H₂O) addition for rotten egg removal
9 🧫 MLF Tracker Malolactic Fermentation progress and pH/TA impact
10 ❄️ Cold Stabilization Würdig formula stabilization temp, duration, seeding, conductivity test
11 🍯 Sorbate + SO₂ Sweet wine chemical stabilization with EU legal limits check
12 🗺️ Vineyard Comparison Score and compare 2-5 lots/vineyards using radar charts
13 📓 Vintage Logbook Cellar logbook diary with filtering and CSV export
14 🍾 Bottling Suite Bottle/case needs with transfer losses and thermal expansion check
15 🪵 Oak & Tannins Oak alternative dosage (chips, cubes, staves) with extraction times
16 🧪 Wine Fault Diagnosis Rule-based diagnosis based on sensory analysis symptoms
17 🏛 Greek Varieties Analytical benchmark against optimal grape ranges (Xinomavro, Assyrtiko, etc.)
18 🤖 AI Ferment Predictor Machine Learning (Scikit-Learn) forecasting for sugar depletion curve
19 🧠 AI Master Blender Agentic LLM (BYOK) blending ratios optimization based on scientific profiling

🧠 Enterprise AI Architecture

This project has been upgraded beyond standard static formulas to include modern AI capabilities:

  1. Machine Learning Forecasting (scikit-learn): We use Polynomial Regression to track the fermentation curve dynamically, predicting the exact day your tank will go dry and flagging stuck-fermentation risks mathematically.
  2. Agentic Workflows (openai / deepseek): The Master Blender module uses the BYOK (Bring Your Own Key) pattern to integrate with LLMs without exposing public keys. It acts as a Master Sommelier, ingesting your lot analytics and returning scientifically reasoned blending percentages.

🚀 Quick Start

Option 1: Run the Web App

git clone https://github.com/karidasd/winemaking-calculators
cd winemaking-calculators
pip install -r requirements.txt
streamlit run app.py

Open your browser at http://localhost:8501

Option 2: Use as Python Library

from calculators import molecular_so2, so2_needed_for_molecular, so2_addition_grams

# What's my current molecular SO₂?
mol = molecular_so2(free_so2=30, ph=3.6)
print(f"Molecular SO₂: {mol} mg/L")  # → 0.68 mg/L

# How much SO₂ do I need to add?
needed = so2_needed_for_molecular(target_molecular=0.8, ph=3.6, current_free_so2=30)
print(f"Need to add: {needed} mg/L free SO₂")

# How many grams of K₂S₂O₅ for a 5000L tank?
amounts = so2_addition_grams(needed, volume_liters=5000)
print(f"Add: {amounts['potassium_metabisulfite_g']}g of K₂S₂O₅")

📐 Formula Reference

SO₂

Molecular SO₂ = Free SO₂ / (1 + 10^(pH - 1.81))

Potential Alcohol

PA (% ABV) = (Brix × 0.5765) - 0.65

Chaptalization

Sugar to add (g) = ΔBrix × 17 × Volume (L)

Pearson's Square

Parts A = |Value_B - Target|
Parts B = |Value_A - Target|
Volume A = (Parts A / Total Parts) × Total Volume

📚 References

  • Boulton, R. et al. Principles and Practices of Winemaking (2013)
  • Zoecklein, B. et al. Wine Analysis and Production (1995)
  • OIV International Standards — oiv.int
  • Peynaud, E. Knowing and Making Wine (1984)

⚠️ Disclaimer

These calculators are for educational and reference purposes. Always verify critical additions with a certified oenologist. Legal limits for additives vary by country and wine style.


Built with ❤️ by DarkAIs | MIT License

About

🍷 Professional winemaking calculators for oenologists. SO₂, Sugar, Acidity, Blending, Fining & more. Python library + Streamlit web app.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages