How STEMSCAPE is modelled
STEMSCAPE is a browser game, but every number it shows is the output of a small engineering model running on your device. This page lists the equations, the parameter values, the simplifications we made and why. Parameter values are representative of rural and small-town India and are chosen for teaching consistency, not as a design reference — see Limitations.
Design of each mission is stored as a plain object; the simulation is a pure function simulate(design) → results, so re-running the same design always gives the same report. Random elements (grid outages, cloud cover) are generated from a fixed seed.
Mission 1 · Village Power
Site and demand
Kesarpur: 1,240 people in 260 households (26 house tiles × 10), a primary health clinic, a school and a well. Demand profiles are hourly shapes normalised to daily energy:
| Load | Daily energy | Shape |
|---|---|---|
| Households | 1.6 kWh/household/day (416 kWh) | Evening peak 18:00–21:00 (≈2.5× the night base) |
| Clinic | 30 kWh/day | Night base (vaccine fridge) + daytime activity |
| School | 15 kWh/day | 07:00–16:00 only |
| Well pump | 3 kW while running | Deferrable: prefers daylight, runs when the tank drops below 35% |
Connectivity
Distribution lines, generation, batteries, the pump and the grid connection point are conductive tiles. Their 4-neighbour connected components are separate networks, each simulated independently. A house, the clinic or the school is attached to the network of any adjacent conductive tile; if none is adjacent it is unconnected and its entire demand counts as unserved.
Hourly dispatch (7 days × 24 h)
Battery usable energy is 85% of nameplate (depth of discharge), round-trip efficiency 92% split equally between charge and discharge, and C-rate 0.5. Grid availability is a two-state Markov chain (P(up→down) = 0.09/h, P(down→up) = 0.13/h → ≈59% availability) from a fixed seed, so outages are identical between runs.
Water sub-model
Demand is 50 L/person/day (62,000 L) with a morning/evening shape. The pump delivers 12,000 L/h into storage (20,000 L per tank + a 2,000 L header). Each hour the pump runs for the fraction of the hour the tank can absorb; if the network cannot power it, pumping scales with the served fraction. Water reliability = delivered ÷ demanded.
Costs and emissions
| Item | Capex | Notes |
|---|---|---|
| Distribution line | ₹15,000 / tile | Pole + LV line |
| Solar array 5 kW | ₹2,00,000 | ₹40/W installed, derating 0.80 |
| Wind turbine 10 kW | ₹9,00,000 | Average capacity factor ≈ 0.28 |
| Battery 10 kWh | ₹1,20,000 | ₹12,000/kWh |
| Diesel generator 15 kW | ₹3,20,000 | ₹26/kWh fuel, 0.78 kg CO₂/kWh |
| Grid import | — | ₹8/kWh, 0.71 kg CO₂/kWh (Indian grid average) |
| Well pump / tank | ₹1,20,000 / ₹90,000 | 3 kW, 12,000 L/h / 20,000 L |
Opex per year = diesel kWh × ₹26 + grid kWh × ₹8 + 1.5% of capex (maintenance). CO₂ is compared with a diesel-only baseline (all demand × 0.78 kg/kWh); credit is only given for energy actually served.
Mission 2 · Bridge Builder
Geometry and loads
A 24 m span with joints on a 2 m grid, y from −4 m to +6 m. The left abutment is a pin (u = v = 0), the right a roller (v = 0). The deck is the chain of deck-level joints (y = 0) from x = 0 to 24 with no panel longer than 6 m; deck stringers hand loads to the two bounding joints by the lever rule. The deck surface weighs 2 kN/m. The truck is 12 t (117.7 kN) on two axles 4 m apart, stepped across in 2 m increments (15 positions); every position is solved.
Solver
Self-weight of every member (ρ·A·L·g) is split between its end joints. The determinacy count m + r − 2j is reported; indeterminate trusses are solved by the same stiffness method.
Materials and capacity
| Material | ρ (kg/m³) | σ allow tension / compression | E | Price | Sections |
|---|---|---|---|---|---|
| Steel tube | 7,850 | 250 / 250 MPa | 200 GPa | ₹80/kg | 80, 120, 160 mm hollow square |
| Sal timber | 800 | 14 / 11 MPa | 12 GPa | ₹35/kg | 100, 150, 200 mm solid |
| Bamboo bundle | 700 | 25 / 18 MPa | 15 GPa | ₹12/kg | 3 or 6 culms Ø100 mm |
| Precast concrete | 2,500 | 3 / 15 MPa | 27 GPa | ₹9/kg | 200, 300 mm solid |
Cost = Σ ρ·A·L·price + ₹4,000 per joint + ₹36,000 for the deck surface; budget ₹6 lakh.
Mission 3 · Clean Water
Dhaneri: 3,800 people × 40 L/day = 152,000 L/day. Source water: 85 NTU turbidity, 1,200 E. coli CFU/100 mL, 45 µg/L arsenic, 1.8 mg/L fluoride. Limits used: turbidity < 1 NTU, E. coli < 1/100 mL, arsenic < 10 µg/L, fluoride ≤ 1.5 mg/L (aligned with WHO guideline values).
Treatment train
Stages on the process lane are ordered by x-position (left → right). Repeated stages of the same type are parallel units (capacity adds, removal applies once). Removal is applied in series:
Conditional performance (the part that teaches process order): slow sand filters receiving > 30 NTU clog (half capacity, 70% removal); rapid sand filters without upstream coagulation only remove 50% turbidity; chlorination and UV receiving > 5 NTU only achieve 1-log / 1.5-log because particles shield organisms; RO fouls above 5 NTU (half capacity). Without an intake screen the pump loses 30% capacity to clogging.
| Stage | Capacity L/day | Turbidity | E. coli | As | F | kWh/m³ | Capex | Opex/yr |
|---|---|---|---|---|---|---|---|---|
| Intake pump | 240,000 | — | — | — | — | 0.35 | ₹1.8 L | ₹20 k |
| Intake screen | 400,000 | 5% | — | — | — | 0 | ₹40 k | ₹2 k |
| Coagulation + settling | 120,000 | 85% | 0.5 log | 60% | 10% | 0.02 | ₹2.6 L | ₹60 k |
| Slow sand filter | 60,000 | 90% | 2.0 log | 10% | — | 0 | ₹1.8 L | ₹15 k |
| Rapid sand filter | 200,000 | 80% | 0.5 log | — | — | 0.05 | ₹2.2 L | ₹30 k |
| Activated carbon | 150,000 | 10% | — | 15% | 5% | 0.02 | ₹1.5 L | ₹45 k |
| Activated alumina | 100,000 | — | — | 50% | 90% | 0.02 | ₹1.6 L | ₹55 k |
| Chlorination | 500,000 | — | 3.0 log | — | — | 0.005 | ₹60 k | ₹25 k |
| UV | 150,000 | — | 4.0 log | — | — | 0.04 | ₹1.4 L | ₹20 k |
| Reverse osmosis | 80,000 | 99% | 4.0 log | 95% | 95% | 2.5 | ₹4.5 L | ₹1.2 L |
Storage: 50,000 L per tank; reliability = 0.6 + 0.4 × min(1, storage hours ÷ 12). Population served = 3,800 × min(1, capacity ÷ demand) × reliability, and only counts as safe if all four limits are met. Energy is bought from the grid at ₹9/kWh (0.71 kg CO₂/kWh); each 5 kW solar array offsets 20 kWh/day. Budget ₹18 lakh.
Mission 4 · Flood Defence
Storm and channel
Routing
Level-pool routing over a 1 km reach: dS/dt = I − O − spill, with S(h) the stage-storage of channel + floodplain (the town-side floodplain is removed when a levee exists — which is why a levee raises the river level, the "levee effect" the game reports). Detention basins (2.5 million m³ each) divert inflow above 250 m³/s until full.
Damage and risk
All three storms are routed on every run; the selected storm drives the animation and the "damage avoided" sub-score, while residual risk uses the integral. Costs: levee ₹30k / ₹60k / ₹1 lakh per metre for 1 / 2 / 3 m (100 m per tile), basin ₹12 crore, dredging ₹40 lakh per tile (+1 m, whole reach required), widening ₹60 lakh per tile (+10 m), pump ₹80 lakh, elevating a house tile ₹25 lakh (assets ×3). Budget ₹40 crore.
Scoring, stars and badges
Each mission computes 5 sub-scores in [0, 1] from the simulation variables and combines them with fixed weights; the formula and every sub-score are printed in the report so nothing is hidden.
| Mission | Weights | Penalty |
|---|---|---|
| Village Power | Reliability 30 · Population 20 · Cost 20 · Environment 20 · Water 10 | × 0.6 if over budget |
| Bridge Builder | Safety 35 · Deflection 20 · Cost 25 · Material efficiency 10 · Crossing 10 | × 0.5 on collapse |
| Clean Water | Safety 35 · Coverage 25 · Cost 20 · Energy 10 · Reliability 10 | × 0.6 if over budget |
| Flood Defence | Damage avoided 35 · Residual risk 25 · Cost 20 · People 10 · Pump energy 10 | × 0.6 if over budget |
The cost sub-score is 1 − 0.6 × capex ÷ budget (0.4 at exactly the budget, 0 above it), scaled by how much of the population is actually served so that an empty design cannot score on frugality. Stars: ≥ 50 → 1, ≥ 70 → 2, ≥ 85 → 3. Missions unlock when the previous mission has at least one star; "Unlock all (free play)" bypasses this. Badges are derived from run results only (e.g. Zero diesel requires no generator energy and ≥ 90% reliability; Under budget requires a passing score).
Accessibility
- The canvas is a focusable
role="application": arrow keys move a tile cursor, Enter places, Delete removes, I inspects, digits pick palette items, R runs, Escape cancels. Tab reaches the palette, mode buttons, inspector, run button and report. - Every canvas change is announced in an
aria-livestatus line and reflected in the "Placed components" text list; the world map has an equivalent mission list of buttons. - The report is plain text (downloadable and printable); charts are SVGs with a full-data
aria-label; colour is never the only indicator (member failure is red and dashed and listed). prefers-reduced-motiondisables the animation loop: the scene is drawn once per change with a static day-time frame.- Text is in rem units, contrast ≥ 4.5:1 on all panels, visible focus rings, no keyboard traps (the tutorial is a native
<dialog>). - On phones the palette becomes a bottom sheet; all controls remain reachable.
Limitations (honest list)
- Parameter values are representative, not sourced from a specific tariff order, code or catalogue. Do not use STEMSCAPE outputs for real design.
- Village Power ignores voltage drop, line losses, reactive power, generator minimum load, battery degradation and solar tilt; the grid is a simple capacity with random availability.
- Bridge Builder is a pin-jointed 2D truss: no bending in members, no joint design, no lateral stability, no dynamic or fatigue effects; buckling uses pin-ended Euler with no effective-length factors.
- Clean Water uses fixed removal efficiencies; real performance depends on dose, contact time, temperature, pH and maintenance. Fluoride and arsenic chemistry (As(III) vs As(V)) is not modelled.
- Flood Defence is one-dimensional: a single reach, a lumped town stage–storage, no groundwater, seepage, levee breach or debris; the depth–damage curve is a single generic function.
- Scores are a teaching device: the weights encode our priorities, not a regulatory or economic standard.
Data & privacy
No account, no analytics, no network calls except Google Fonts. Progress, designs, run history and the tutorial flag are stored in your browser under the localStorage key stemscape:v1; "Reset progress" on the world map removes it. The downloadable report is generated locally as a text file.