cleanyourtv-app
A community-built phone app for Clean Your TV: clean up an Android TV from your phone. No laptop, no coding agent, nothing uninstalled.
Solar microgrid simulation and AI decision support for rural electrification.
OtherGitHub @TokiariveloOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Repository information has not been collected yet.
No updates detected yet. GitHub releases will appear here.
Mitsinjo Grid — AI-powered decision support & 3D digital twin for rural solar microgrids. Simulates 24-hour energy flows, battery storage, and essential load shedding with a Meta AI copilot. Built with Next.js 15, Turborepo, Three.js, and TypeScript.
Taken from the repository README
Loading the full README.
Read the full README ↗⚠️ SIMULATED DATA NOTICE: All energy metrics, solar generation curves, battery state-of-charge figures, and load balances presented in this system are synthetic and generated for simulation, educational, and decision-support purposes. They do not represent real-time measurements from physical microgrid hardware.
Public Production Deployment: https://mitsinjo-grid.vercel.app
Demo Video (3 Minutes): Pending recording (P9-T5) — script in docs/demo-script.md
Documentation: docs/ · docs/assumptions.md · docs/demo-script.md · docs/known-limitations.md
In off-grid rural communities across Madagascar and Sub-Saharan Africa, small solar-plus-storage microgrids (typically 30–50 kWp solar PV + 100–150 kWh battery storage) are the sole lifeline for essential civic and economic infrastructure.
When sudden monsoon cloud cover, severe weather, or high peak demands strike, battery reserves deplete rapidly. Traditional microgrid controllers rely on naive proportional load shedding—reducing power equally across all circuits by percentage.
Under proportional shedding, a severe deficit reduces power to the Health Clinic at the exact same rate as street markets and domestic lighting. An unexpected deficit can cut power to the clinic's vaccine refrigeration cold chain, incubator, and emergency lighting, risking catastrophic loss of life and supplies.
Mitsinjo Grid addresses this challenge with:
MG) translations with 100% key parity.The platform is designed around a single, robust demonstration path that highlights the interplay between physical energy balance and AI reasoning:
[ 1. Weather Shock ] 40% solar drop at 13:00 (2 h) on a low battery; reserve (20%) is reached at 23:00.
│
▼
[ 2. Strategy Lab ] Proportional shedding cuts the Health Clinic below its essential need at 23:00.
│ Essential-First priority reroutes power, guaranteeing 100% lifeline coverage.
▼
[ 3. Meta AI Copilot ] Operator asks "Why is the clinic receiving less energy?".
│ Copilot calls get_grid_state() & compare_strategies(), diagnosing the root cause.
▼
[ 4. Computed Evidence ] AI streams structured evidence (with exact Simulation Run IDs) and
issues an interactive proposal to adopt the Essential-First strategy.
flowchart TD
subgraph Client ["Client Browser (Next.js 15 + React 19)"]
UI["UI Layer\nTailwind 4 + shadcn/ui"]
Store["Zustand Simulation Store\nClient State & Caching"]
R3F["3D Digital Twin\nReact Three Fiber + Drei"]
Charts["Analytics Charts\nRecharts"]
i18n["next-intl\nEN / FR / MG"]
end
subgraph EnginePkg ["@mitsinjo/engine (Pure TypeScript)"]
Sim["simulate() &\ncompare()"]
Invariants["Invariants Verifier\nε = 1e-9"]
Schemas["Zod Schemas\n(Source of Truth)"]
end
subgraph Server ["Server Backend (Next.js API Routes)"]
Route["/api/copilot\nSSE Streaming & Rate Limiting"]
Loop["Copilot Agent Loop\nMulti-turn Tool Calling"]
Tools["Copilot Tools\nget_grid_state, compare_strategies..."]
MetaProvider["Meta Muse Spark\nOpenAI-compatible Chat API"]
MockProvider["Deterministic Mock\nOffline / Fallback Provider"]
end
UI --> Store
Store --> Sim
Sim --> Invariants
Store --> R3F
Store --> Charts
UI --> i18n
UI -- "SSE Chat Query" --> Route
Route --> Loop
Loop --> Tools
Tools --> Sim
Loop -- "Tool Calling" --> MetaProvider
MetaProvider -. "Fallback / Offline" .-> MockProvider
Route -- "Text & Tool Streams" --> UI
@mitsinjo/engine has zero browser, React, or network dependencies. The exact same code runs synchronously in client state hooks (<3 ms) and inside the server-side Copilot tool executor.| Screen | Description | Mockup / Screenshot |
|---|---|---|
Overview (/overview) | Incident screen: is the clinic at risk today, engine-computed impact (outage hour, hours, kWh), one CTA to the copilot, and essential coverage rings per strategy. | design/stitch/overview.png |
Live Simulation (/simulation) | 24-hour simulation runner with interactive sliders, 3D village digital twin, hourly telemetry table, timeline scrubber, and a simulated fire alarm (« Report a fire » → sector cut at once, red banner + snackbar, fire in 3D / 2D / circuit). | design/stitch/live-simulation.png |
Strategy Lab (/strategies) | Side-by-side comparison matrix of Proportional vs. Essential-First vs. Balanced strategies with delta highlights and decision summaries. | design/stitch/strategy-lab.png |
AI Copilot (/copilot) | Streaming conversational copilot with 4-part structured reasoning, verifiable simulation IDs, and interactive one-click proposal cards. | design/stitch/copilot.png |
Scenarios (/scenarios) | Scenario library featuring pre-tuned community benchmarks: Baseline, Cloudy Afternoon, High Evening Demand, Battery Constraint, and Essential Stress. |
To maintain strict scientific and ethical integrity, Mitsinjo Grid explicitly categorizes all data:
| Category | Status | Details |
|---|---|---|
| Simulation Data | Synthetic | Hourly solar irradiance profiles, battery state-of-charge curves, and sector power demands are generated by mathematical models tuned to Malagasy solar coordinates ($\approx 3.1\text{ PSH}$). |
| Physical Quantities | Modeled | Battery charging/discharging efficiency ($95%$), power ceilings ($\pm 25\text{ kW}$), and reserve limits ($20%$) follow standard LiFePO4 commercial energy storage specifications. |
| Estimated Values | Calculated | Critical shortfall energy ($\text{kWh}$), coverage percentages ($%$), and unmet hours are calculated deterministically by @mitsinjo/engine. |
| AI Text | Advisory | Explanations generated by Meta Muse Spark are advisory decision-support statements. The AI cannot execute hardware commands directly; all proposals require human operator confirmation. |
For complete modeling formulas and boundary conditions, see docs/assumptions.md.
@theme tokens), shadcn/ui (custom restyled).apps/web/public/3d/CREDITS.md).EN), Français (FR), and Malagasy (MG).muse-spark-*) with automatic offline deterministic fallback (LLM_PROVIDER=mock).# Clone the repository
git clone https://github.com/Tokiarivelo/mitsinjo-grid.git
cd mitsinjo-grid
# Install workspace dependencies
make install
# Configure environment variables
make env
# Start development server on http://localhost:$PORT (PORT in .env, default 3000)
make dev
# Run development server with deterministic offline mock LLM
make dev-mock
# Run full quality check suite (typecheck + lint + 242 tests + i18n parity)
make check
# Run Playwright end-to-end test suite
make e2e
# Run production build
make build
# 3D budgets per quality tier (server running; -gpu = real GPU fps)
make scene-audit
make scene-audit-gpu
# Physical scale model (docs/maquette-physique.md, settings: docs/bridge.md): bridge + fake ESP32
make bridge # BRIDGE_MODE=twin make bridge → sensors feed the engine
make bridge-sim # c = cloud over the sun lamp, q = quit
# Deployed site: open /simulation?bridge=ws://localhost:8787 (add &bridgeToken=… if BRIDGE_TOKEN is set)
NEXT_PUBLIC_BRIDGE_URL=ws://localhost:8787 make dev-mock # /simulation → Controls → Physical scale model
Create .env at repo root or apps/web/.env.local (see .env.example; local vs Vercel checklist: docs/setup/env.md):
# LLM Provider: 'mock' (default, offline, zero-credential) or 'meta'
LLM_PROVIDER=mock
# Meta AI API Configuration (required when LLM_PROVIDER=meta)
META_API_KEY=your_meta_api_key_here
META_MODEL=muse-spark-v1
META_BASE_URL=https://api.meta.ai/v1
# Optional Stitch MCP / design tooling key
STITCH_API_KEY=
The project is configured for continuous deployment on Vercel:
main trigger production deployments.make deploy-link # Link clone to Vercel project (once per machine)
make deploy # Manual production deployment from clean origin/main
High 3D tier targets ≥ 30 fps on a discrete GPU; integrated GPUs fall back to Low (≥ 45 fps target) automatically. In headless Linux CI without a hardware GPU, software rasterization (SwiftShader) is used (make scene-audit; make scene-audit-gpu on a real GPU).meterReadings; a persistent gap > 25 % vs the expected profile for ≥ 2 h raises ANOMALY_TO_VERIFY (a signal to verify, never a fraud or fault conclusion). Synthetic meter_anomaly scenario./simulation (Buildings tab) a slider per sector scales its load ×0–3 and a button connects or disconnects it; each change re-runs the engine at once (3D, metrics, charts follow, even during playback). A small factory sector ships disconnected by default; adding another consumer sector follows the checklist in docs/engine-spec.md.sectorCaps and priority overrides the copilot can only propose; the user confirms, the engine recomputes. No real equipment control. Each decision locks the card and is posted in the chat; cutting the clinic needs a second confirmation.v1.0.0design/stitch/scenarios.png