Inspiration

Millions of students spend six or more hours a day in classrooms where stale air pushes CO2 past 2,500 ppm, wildfire smoke drives indoor PM2.5 into unhealthy ranges, and poor ventilation raises airborne respiratory transmission risk. School communities often face confusing, expensive upgrade pitches without a clear way to compare low-cost actions like opening cross-ventilating windows or building DIY Corsi-Rosenthal fan boxes against commercial HEPA purifiers and MERV-13 upgrades. I built VentiLab as an offline, zero-dependency classroom physics workbench so students, teachers, and families can see the exact trade-offs between air quality, airborne risk, cost, electricity, and classroom noise.

What it does

  • Transient CO2 mass-balance solver (RK4): Integrates classroom CO2 across multi-period school schedules (class periods, passing breaks, lunch/recess) using a fixed-step 4th-order Runge-Kutta solver.
  • Natural + mechanical ventilation model: Combines wind-driven and thermal-stack airflow via root-sum-square for single-sided and cross-ventilation windows alongside mechanical outdoor air.
  • Wells-Riley airborne risk & wildfire PM2.5 ODE: Integrates accumulated infectious quanta dose with mask efficiency and equivalent clean airflow (HEPA, Corsi-Rosenthal boxes, MERV-13, UVGI) while simultaneously tracking indoor PM2.5 infiltration and filtration during wildfire smoke events.
  • Exact Pareto retrofit optimizer: Enumerates all 120 retrofit combinations under a chosen budget and extracts the exact non-dominated Pareto frontier across upfront cost, power draw (watts), acoustic noise (dBA), CO2 peak, mean PM2.5, and remaining airborne risk.
  • Five synthetic reference classroom presets: Standard 28-student classroom, crowded science lab, rural natural-ventilation room, wildfire smoke day, and DIY Corsi-Rosenthal comparison, plus validated URL-hash scenario sharing and a printable classroom action card.

How we built it

VentiLab runs 100% locally in plain browser ES modules with zero build step, zero npm packages, and zero network requests (src/engine.js for physics ODEs, Pareto optimization, and share-hash codec; src/viz.js for Canvas 2D classroom airflow diagrams and charts; src/app.js for state and DOM controls; tests/engine.test.mjs for deterministic Node tests).

Challenges we ran into

Ensuring numerical stability across both sealed low-ACH classrooms and stiff, small-room high-ACH cross-ventilation scenarios required careful RK4 step-size validation and strict input clamping so extreme sliders never produce NaN or unbounded oscillations. Comparing multi-objective retrofits also meant designing an exact dominance check that guarantees no frontier point is strictly dominated on all axes while respecting tight school budgets. Finally, every preset and panel is explicitly labeled as a synthetic reference model so the tool educates clearly without claiming real-school sensor measurements or engineering certification.

Accomplishments that we're proud of

  • 29 of 29 deterministic unit tests passing (node --test tests/engine.test.mjs), covering closed-form analytical ODE verification, monotonic risk/CADR invariants, Pareto dominance properties, stiff high-ACH stability, XSS escaping, and hostile URL-hash rejection.
  • Verified physics accuracy against closed-form analytical solutions (verifyAnalytics()):
    • CO2 RK4 vs closed-form RMSE: 8.06e-9 % (2.15e-7 ppm, target < 0.05 %)
    • PM2.5 filtration ODE vs closed-form RMSE: 4.80e-10 ug/m3
    • Integrated Wells-Riley quanta RMSE: 5.17e-13
    • Reference classroom CO2 time constant: 1.17 h (210 m3 / 180 m3/h)
  • Verified Pareto optimization & preset outputs:
    • Standard 28-student classroom (closed baseline): CO2 peak 2918.4 ppm, PM2.5 mean 10.02 ug/m3, Wells-Riley risk 45.55%; enumerating 120 retrofit combinations at the default $1,200 budget identifies 80 affordable options and 77 exact Pareto-optimal configurations.
    • Crowded science lab: CO2 peak 3014.9 ppm, PM2.5 mean 12.75 ug/m3, risk 63.10%.
    • Rural natural-ventilation room: CO2 peak 467.2 ppm, PM2.5 mean 7.93 ug/m3, risk 1.50%.
    • Wildfire smoke day (180 ug/m3 outdoor): CO2 peak 2549.7 ppm, indoor PM2.5 mean 149.49 ug/m3, risk 46.98%.
    • DIY Corsi-Rosenthal retrofit ($85, 35 W): CO2 peak 756.0 ppm, PM2.5 mean 14.50 ug/m3, risk 8.29% (85.6% risk reduction from baseline).

What we learned

Pairing textbook indoor-air physics (CO2 mass balance, Wells-Riley, PM2.5 infiltration) with exact multi-objective Pareto search reveals high-impact, low-budget wins immediately: a $85 DIY fan-filter box combined with sensible ventilation dramatically cuts airborne risk where multi-thousand-dollar HVAC overhauls are out of reach.

What's next

Add multi-zone hallway/classroom coupling, seasonal outdoor temperature and heating/cooling energy penalties for open windows, and a companion CSV importer so school science clubs can overlay real low-cost CO2/PM2.5 sensor logs alongside the analytical curves.

Honest AI Disclosure

An AI coding assistant helped implement the physics engine, Canvas visualizations, test suite, and documentation. I reviewed every change, ran node --test tests/engine.test.mjs (29 passed) and verified every analytical RMSE and preset output locally. All classroom scenarios are synthetic reference models for education, not real school measurements or HVAC engineering advice, and no external AI service runs inside VentiLab.

Built With

Share this project:

Updates

Submission history