Download wallpaper

CO2 Control: Human Impact

Sample 2. Same controller as sample 1. Now with three astronauts living inside.

The scenario

A sealed lunar habitat. Three astronauts inside. They breathe, they work, they sleep, and every breath adds CO2 to a closed cabin. Above 4000 ppm focus drops. Above 5000 you start risking loss of consciousness. Above 8000 it is life-threatening over hours.

A chemical scrubber can remove CO2, but it draws power. Solar input varies, batteries have to survive the 14-day lunar night, and no one is going to help from outside. Earth is 2.5 seconds of round-trip latency away; in an emergency that is too long. A small controller, on a chip inside the habitat, has to decide by itself when to turn the scrubber on, at what power, and for how long.

The simulator gives you three scrubber states and three controllers. Pick any combination, press Start, watch the cabin dynamics unfold for as long as you want. Switch controller or scrubber state and the previous run stays on the right for comparison.

Scrubber states. Oversized is a brand-new, over-dimensioned unit (anything works here). Normal is the nominal end-of-life regime. Degraded is a partially clogged or tired unit where max capacity barely covers three crew at rest. Minimal is the failure mode: the scrubber can only sustain one or two crew. Three is unsustainable; the habitat will have to lose someone.

Controllers. Predictive (AI) runs a tiny world model (a 401-parameter neural net, about 2.2 KB of ONNX) plus a planner: at every step it rolls out the next 30 simulated minutes against several candidate action sequences and picks the one with the lowest cost. Reactive threshold is a bang-bang controller: above 3500 ppm turn scrubber high, below 2500 turn it off. Simple, effective, no anticipation. No control leaves the scrubber off; included so you can see how fast CO2 climbs with nothing to remove it.

The whole decision loop runs entirely in your browser on the same SpikyPanda runtime that runs on an ESP32 class microcontroller, under 2 ms per step. No cloud, no GPU, no network.

Why this sample exists

Sample 1 compared the MPC against a threshold on CO2 alone. The gap was real but small. A well-tuned classical loop got close to the AI. That was the honest conclusion, and it still is.

Same simulation here. Same physics, same controllers. What is added is the crew: three astronauts with heart rate, SpO2, respiratory rate, cognitive alertness, and a work-efficiency readout. Each value reacts to CO2 and to the activity schedule using published physiological curves.

Work efficiency is where it becomes interesting. Health is one thing, productivity is another. A crew at 70 percent cognitive does not do 70 percent of the work. They do closer to 60, because they make mistakes, redo tasks, and move slower. That means more minutes at heavy activity to finish the same job, which produces more CO2, which slows them down further. The "work per Wh" line in the comparison panel catches this: how much useful output you got per Wh of scrubber energy. That number moves a lot more than the max-CO2 number does.

Run threshold. Watch the Work bar drop during a heavy-work period and the crew slide from nominal to elevated. Switch to the AI. Same run. The vitals barely move because CO2 never pushes them.

The controllers do not read the vitals. Everything you see on the crew cards is downstream of the CO2 they produce. Sample 3 closes that loop.

Crew status

Three astronauts, each with a slightly different sensitivity profile. Respiratory rate follows CO2 almost directly (that is how the body regulates it). Heart rate tracks both CO2 and the current activity. SpO2 only starts moving at high CO2. Cognitive drops with sustained exposure and recovers slower than it falls. Work is a non-linear function of all of these. Once a crew member hits critical they cannot recover on their own, and after prolonged exposure their ECG goes flat.

Run the simulation

Brand new scrubber, over-dimensioned. Any action handles any load. Threshold and AI look alike here.

Crew aggregate: solid green line = mean work efficiency, dashed blue = mean cognitive alertness, red band at the bottom = minutes with at least one impaired/critical crew. Dashed yellow line at 80 % is the productivity reference.

Current CO2
- ppm
parts per million
Scrubber
-
command (effective %)
Time
-
simulated
Total energy
-
scrubber consumption

Head-to-head: the human side

Run one controller, then switch and run the other. The first result stays pinned on the right. Only the numbers about the crew are here, not the CO2 profile. Lower average HR, higher minimum SpO2, fewer crew-minutes impaired, fewer deaths. The last two lines are productivity: how much of the scheduled work got done, and how many units of output you bought per Wh of scrubber energy. Those two are where the gap between the controllers actually widens.

Current run

Controller-
Duration0 min
Max CO2- ppm
Avg crew heart rate- bpm
Min crew SpO2- %
Crew-minutes impaired0
Crew deaths0
Work done / scheduled0 / 0 (100%)
Work per Wh-
Scrubber energy0 Wh

Physiological model

The vitals are driven by published data on human CO2 response in confined spaces (Satish et al. 2012, Allen et al. 2016, NASA Human Integration Design Handbook). Below 1500 ppm the crew sits at baseline.

Heart rate. Rises roughly linearly with CO2, a few bpm per 1000 ppm at rest, more under activity. Per-member sensitivity varies.

SpO2. Mostly flat until CO2 gets high (above 3500 ppm in this model). Bicarbonate buffering breaks down and the O2 dissociation curve shifts. Drops of 1 to 3 percent are realistic at very high CO2; worse numbers in real habitats usually mean ambient O2 is also low, which we do not model here.

Respiratory rate. The fastest responder, because brainstem chemoreceptors sense CO2 directly and scale minute ventilation. Doubling CO2 roughly doubles respiratory drive.

Cognitive alertness. Degrades with sustained exposure. Mild effects start around 2500 ppm, strong ones above 5000 ppm. Recovery is slower than the drop.

Work efficiency. Derived, not measured. We map it from cognitive state with a non-linear curve (roughly cognitive1.5) plus multiplicative penalties for sustained tachycardia and low SpO2. A modest dip in alertness produces a larger dip in output, because errors, retries, and slow coordination compound. The run total (work done divided by work scheduled) is what turns "my CO2 peaked at X" into a mission cost.

Critical and death. A crew member reaches critical when cognitive falls below 30, or SpO2 below 88, or HR above 145. Critical is a trap: they stay critical even if CO2 recovers, and they cannot perform tasks. After 90 sim minutes in critical without rescue, the ECG goes flat. In real CO2 narcosis this takes hours at these levels; the demo compresses it so the arc fits in a 24-hour run.

The model is simplified on purpose. It runs locally and deterministically, to make the human side of a CO2 control decision visible. It is not medical software.

Log