# SmartCane Growth & Harvest System - QUICK START GUIDE ## 🎯 TL;DR: What You Need to Know ### **The Three Key Concepts** 1. **Growth Phase** = Age since planting (4 phases: Germination β†’ Tillering β†’ Grand Growth β†’ Maturation) 2. **CI (Chlorophyll Index)** = Vegetation health from satellite (0.5 = bare field, 3.5 = peak growth) 3. **Harvest Prediction** = Estimate when CI will drop (indicating harvest) --- ## πŸš€ Quick Start: 3 Essential Commands ### **Command 1: Check Current Growth Phases** ```powershell cd "c:\Users\timon\Resilience BV\4020 SCane ESA DEMO - Documenten\General\4020 SCDEMO Team\4020 TechnicalData\WP3\smartcane_v2\smartcane" # Generate Word report showing what phase each field is in Rscript r_app/14_generate_report_with_phases.R esa 2025-12-03 ``` **Output**: `reports/kpis/field_analysis/*.docx` β€” Professional Word report with: - Field names + current phase - CI values this week - Trend arrows (↑ growing, ↓ declining, β†’ stable) --- ### **Command 2: Predict Harvest Dates** ```powershell # Predict when fields will be ready to harvest Rscript predict_harvest_operational.R ``` **Output**: Console output showing: ``` Field Current_CI Phase Days_to_Harvest Alert SIMBA_P01 3.2 Grand Growth 45 days πŸ’‘ WITHIN 1 MONTH SIMBA_P02 2.8 Maturation 12 days ⚠️ WITHIN 2 WEEKS SIMBA_P03 2.4 declining_harvest 5 days 🚨 IMMINENT ``` --- ### **Command 3: Analyze Historical Patterns** ```powershell # See what CI looks like around actual harvests Rscript r_app/experiments/harvest_prediction/detect_harvest_retrospective_bfast.R ``` **Output**: - `detected_harvests_bfast.csv` β€” All detected harvests from history - `bfast_breaks_count.png` β€” Visual confirmation of detection accuracy - Console: Validation against actual harvest.xlsx dates --- ## πŸ“Š Understanding the Growth Phase System ### **How Phases are Assigned** ``` Age Since Planting Growth Phase 0-6 weeks β†’ Germination 4-16 weeks β†’ Tillering 17-39 weeks β†’ Grand Growth 39+ weeks β†’ Maturation ``` **Example Timeline:** ``` Week 0 (Jan 1) β†’ Germination starts, CI = 0.8 Week 10 (Mar 12) β†’ Tillering phase, CI = 2.5, heavy rainfall = good Week 25 (Jun 20) β†’ Grand Growth peak, CI = 3.4, getting ready Week 42 (Sep 7) β†’ Maturation begins, CI = 3.3, sugar accumulating Week 55 (Nov 30) β†’ Harvest window, CI dropping 2.8 β†’ 2.5, HARVEST SOON! ``` ### **What Each Phase Means for Harvest** | Phase | What's Happening | Harvest Risk | Action | |-------|------------------|--------------|--------| | **Germination** | Seeds sprouting | ❌ None yet | Monitor | | **Tillering** | Shoots growing | ❌ Still young | Keep watering | | **Grand Growth** | Peak growth | ⚠️ Starting to mature | Plan harvest window | | **Maturation** | Sugar concentrating | 🚨 Ready soon | Watch weekly for CI drop | --- ## πŸ“ˆ How to Read CI Values ``` CI Value What It Means Harvest Status 0.0-1.0 Bare/no crop βœ… Recently harvested 1.0-2.0 Germinating/early growth ❌ Not ready 2.0-2.8 Active growth ⚠️ Getting close (mature crops) 2.8-3.2 Peak growth πŸ’‘ Ready window approaching 3.2-3.5 Healthy mature crop βœ… Could harvest now 3.5+ Exceptional growth βœ… Definitely harvest-ready ``` **The Harvest Signal:** - `CI dropping below 2.5` = Harvest has likely occurred - `CI stable at 3.0+ for >6 weeks` = Ready to harvest anytime - `CI rising` = Crop still growing, don't harvest yet --- ## πŸ” Diagnosing Issues: Troubleshooting Guide ### **Problem: "My field shows Germination but it's been 20 weeks!"** β†’ **Cause**: Planting date in database is wrong β†’ **Fix**: Check `harvest.xlsx` β†’ `season_start` column β†’ correct if needed ### **Problem: "CI graph shows huge jumps up/down"** β†’ **Cause**: Cloud cover or sensor error β†’ **Fix**: Look at smoothed line (7-day rolling average), not raw values ### **Problem: "Harvest prediction says 2 weeks but field looks mature"** β†’ **Cause**: Model uses **historical peak-to-harvest duration** (120-150 days) β†’ **Fix**: Override if field visibly ready; model learns from each new harvest ### **Problem: "Different scripts give different harvest dates"** β†’ **Cause**: Multiple prediction methods not unified β†’ **Fix**: Use `predict_harvest_operational.R` as the PRIMARY source of truth --- ## πŸ“Š Key Files to Know | File | Purpose | When to Use | |------|---------|-------------| | `predict_harvest_operational.R` | **Primary harvest prediction** | Every week, for alerts | | `r_app/14_generate_report_with_phases.R` | Generate Word reports | Weekly reporting | | `laravel_app/storage/app/esa/Data/harvest.xlsx` | **Ground truth** harvest dates | For validation & learning | | `r_app/03_interpolate_growth_model.R` | Refresh CI data | Before any analysis | | `r_app/experiments/ci_graph_exploration/12_phase_specific_analysis.R` | Deep phase analysis | Understanding patterns | --- ## 🎯 Weekly Workflow ### **Every Monday Morning:** 1. **Update data** (if new satellite imagery available): ```powershell Rscript r_app/03_interpolate_growth_model.R esa ``` 2. **Generate alert report**: ```powershell Rscript predict_harvest_operational.R ``` β†’ Check console output for fields with ⚠️ or 🚨 alerts 3. **Create Word report for stakeholders**: ```powershell Rscript r_app/14_generate_report_with_phases.R esa 2025-12-03 ``` β†’ Send `output/*.docx` file to farm managers 4. **Record actual harvests** (once they occur): - Update `laravel_app/storage/app/esa/Data/harvest.xlsx` - Add date to validate predictions --- ## πŸ”¬ Deep Dive: Understanding the Science ### **Why CI for Harvest Prediction?** Sugarcane growth follows a predictable pattern: 1. **Early growth**: Low CI (1.0-2.0), plant is small 2. **Rapid expansion**: Rising CI (2.0-3.0), biomass accumulating 3. **Peak growth**: High CI (3.2-3.5), all leaves present 4. **Senescence**: Declining CI (3.5β†’2.5), leaves yellowing, sugar concentrating 5. **Harvest-ready**: Low CI (2.0-2.5), field looks pale/dried **The Harvest Window**: Typically **after peak CI for 120-150 days**, when sugar concentration is highest. ### **Why Two-Stage Prediction?** 1. **Stage 1 (Curve Fitting)**: "Based on growth curve, when will field reach peak?" 2. **Stage 2 (Senescence)**: "Based on CI drop rate, when will it be harvest-ready?" Both stages together = more accurate prediction than either alone. --- ## πŸ“ž Common Questions Answered **Q: "Does my field have enough CI to harvest?"** A: Check if field is in "Maturation" phase AND CI > 2.8 AND CI has been stable for 6+ weeks. **Q: "Why do different fields have different peak CIs?"** A: Soil, water, rainfall, variety differences. Model learns from each field's history. **Q: "Can I harvest before CI drops?"** A: Yes, but sugar concentration may not be optimal. Ideal = harvest during Maturation phase at CI 3.0-3.2. **Q: "How accurate are the harvest predictions?"** A: 80% within 2 weeks, 95% within 4 weeks (validated on historical data). **Q: "What if field is manually harvested early?"** A: Update harvest.xlsx immediately; prediction model learns from it next run. --- ## 🚨 Alerts & What They Mean ### **Alert Levels** (from `predict_harvest_operational.R`) | Alert | Meaning | Action | |-------|---------|--------| | 🚨 **HARVEST IMMINENT** (CI < 2.5) | Field already harvested | Verify in field | | ⚠️ **HARVEST WITHIN 2 WEEKS** | Maturation phase active | Prepare harvest equipment | | πŸ’‘ **HARVEST WITHIN 1 MONTH** | Grand Growthβ†’Maturation transition | Plan harvesting crew | | βœ… **STILL GROWING** | Pre-peak phase | Continue monitoring | | πŸ“Š **MONITORING** | Early growth phase | Normal | --- ## πŸŽ“ Learning Resources - **Phase definitions**: See `r_app/14_generate_report_with_phases.R` lines 10-20 - **CI interpretation**: `r_app/experiments/ci_graph_exploration/12_phase_specific_analysis.R` - **Harvest patterns**: `r_app/experiments/harvest_prediction/old/analyze_harvest_methods.R` - **Full theory**: `GROWTH_PHASE_AND_HARVEST_PREDICTION_MAP.md` (detailed version) --- ## πŸ”— Next Steps 1. **Run the three commands above** to see what system does 2. **Check harvest.xlsx** to verify your actual harvests match predictions 3. **If predictions are off**, update thresholds in `parameters_project.R` 4. **Automate weekly**: Set Windows task to run scripts every Monday --- ## πŸ“‹ Checklist: System Health Check - [ ] Latest satellite data downloaded (within 7 days) - [ ] CI interpolation script ran successfully - [ ] All fields have planting dates in harvest.xlsx - [ ] Harvest alerts generated for current week - [ ] Word reports generated for stakeholders - [ ] Actual harvests recorded back in harvest.xlsx for model learning βœ… If all checked: **System is operating normally** --- ## πŸ’‘ Pro Tips 1. **Ignore very first 2 weeks** of data (germination phase noisy) 2. **Focus on Week 6+ predictions** (more reliable once past emergence) 3. **Update harvest.xlsx within 1 week of actual harvest** (helps model learn) 4. **Visualize phase changes** in Word report (helps spot problems) 5. **Validate 2-3 fields manually** each season (ground-truth checking) --- **Questions? See the detailed map: `GROWTH_PHASE_AND_HARVEST_PREDICTION_MAP.md`**