The Hydro-Orbit simulation engine generates realistic sensor data for development and testing without requiring physical hardware.
The simulation uses an in-memory MockDb class (defined in both apps/web/src/hooks/useApi.ts and apps/mobile/src/hooks/useApi.ts) that:
- Pre-populates farms, zones, and sensors with realistic test data
- Generates sensor readings using noise-based algorithms
- Responds to irrigation commands by modifying moisture levels
- Triggers alerts based on configurable thresholds
| Parameter | Behavior |
|---|---|
| Soil Moisture | Starts at ~45%, decreases by 0.5–2% per tick depending on environmental factors |
| Irrigation | Increases moisture by 5–10% per tick toward 80% max |
| Battery | Decreases by 0.1–0.3% per reading, charges when "solar" is active |
| Temperature | Simulated sine wave diurnal cycle: 18°C night → 32°C day |
| pH | Normally distributed around 6.5 (range 5.5–7.5) |
The simulation runs automatically when you start the development server. No configuration is needed. The mock API intercepts all HTTP calls and returns simulated data.
To disable the simulation and connect to real hardware:
- Set
VITE_API_URLto point to your production API - Ensure the API server is running with real database and MQTT broker
- Restart the development server
Edit the MockDb class constructor in useApi.ts to adjust:
- Initial soil moisture values
- Moisture decay rates
- Sensor reading intervals
- Alert thresholds
- Weather-aware simulation (rain events, drought periods)
- Multi-zone interference modeling
- Historical replay mode (replay recorded sensor data)
- Monte Carlo scenarios for stress testing