How vaglar/greenhouse-digital-twin works
Greenhouse Digital Twin simulates a configured hydroponic tomato crop hour by hour using site weather, coupled greenhouse-climate and crop-growth models, and reports climate, resource-use, and yield results. The main user workflow is to adjust parameters in the web interface, request a run, and inspect daily charts and selected-day views. The README also describes automatic climate controls and hydroponic recipe/yield effects. Some implementation details for those capabilities were not sampled, so their wiring is shown only where the documented workflow or sampled source supports it.
Main entry points: main.py FastAPI endpoints · simulate.py Hourly orchestrator · App.tsx Twin dashboard · api.ts API client
Components 14
Web interface
- Twin dashboard
frontend/src/App.tsx - API client
frontend/src/api.ts - Parameter controls
frontend/src/ParamSlider.tsx
API service
- FastAPI endpoints
api/main.py - Simulation results
api/main.py
Simulation core
- Parameter schema
twin/params.py - Hourly orchestrator
twin/simulate.py - Climate model
twin/climate_model.py - Tomato crop model
twin/crop_model.py - Fertigation totals
twin/simulate.py - Weather loader
twin/weather.py
Model inputs
- Greenhouse config
config/greenhouse_example.yaml - Weather CSV
config/weather/alexandreia-imathias-typical-year.csv
Other components
- Grower
Connections 19
- Grower → Twin dashboard: sets parameters
- Twin dashboard → Parameter controls: edits values
- Twin dashboard → API client: requests config or run
- API client → FastAPI endpoints: HTTP requests
- FastAPI endpoints → Greenhouse config: reads config
- FastAPI endpoints → Parameter schema: validates parameters
- FastAPI endpoints → Hourly orchestrator: runs simulation
- FastAPI endpoints → Weather loader: previews weather
- Hourly orchestrator → Weather loader: loads time series
- Weather loader → Weather CSV: reads CSV
- Hourly orchestrator → Climate model: steps climate
- Hourly orchestrator → Tomato crop model: steps crop
- Climate model → Tomato crop model: supplies climate state
- Tomato crop model → Climate model: returns transpiration and CO2 uptake
- Hourly orchestrator → Fertigation totals: derives water and nutrient totals
- Hourly orchestrator → Simulation results: returns daily series and yield
- FastAPI endpoints → Simulation results: formats response
- API client → Twin dashboard: returns data
- Twin dashboard → Grower: shows charts and day views