# Power systems continuity course

[Read all 24 searchable lesson notes](https://khanlab.co.technology/learn/) with worked answers, configuration tables and source links, even with JavaScript disabled.

**24 browser lessons for datacenter engineers: twelve continuity lessons followed by twelve Infrastructure Engineering lessons.**

Start with the [power and energy lesson](https://khanlab.co.technology/?lesson=power-energy), then use the lesson selector or **Next lesson**. The continuity lessons each have one input, a challenge value, a worked answer, and a result you can inspect in the browser. Infrastructure lessons use separate educational screens, explicit Run controls and three assessments per lesson.

After power/energy and ride-through, try [same 375 kWh, different outage outcomes](demand-timing.md): compare three demand schedules with identical total energy, peak power and storage, then explain the effect of outage overlap.

![The interactive course studio with a 50 MW lesson, selectable isometric objects, event replay, and a prediction-and-result workspace](../images/course-studio.png)

## Explore, predict, explain

For a different timescale after the twelve continuity lessons, try [Inside a voltage sag](../studies/emt.md) and the [Power dynamics study studio](../studies/power-dynamics.md). These separate advanced studies include their own equations, solver settings and numerical checks.

Open **Explore all 24 lessons** to see the Infrastructure Engineering track and the original four continuity chapters: energy and reserve, continuity systems, shared risks and reserve, and planning at scale. Each lesson has its own accent color and scene. Numbers, titles, units and asset-state labels carry the meaning as well as color.

1. **Configure:** use the slider or numeric field, or choose the starting or challenge input. A changed input stays a draft until you select **Run lesson**.
2. **Predict:** optionally enter the expected result in the displayed units. Run the lesson to compare your prediction and the starting result with the completed calculation.
3. **Inspect:** select an object for its quantities, drag **Lesson replay interval**, or jump to an event. A boundary event selects the interval in which the event takes effect. The PUE lesson instead partitions annual IT and non-IT energy.
4. **Explain:** reveal the worked answer after making a prediction. It explains the starting and challenge inputs; other inputs can produce different event sequences.
5. **Keep the evidence:** export JSON, or a Markdown/HTML continuity report, and optionally verify the complete result against Python. **Mark as reviewed** is a temporary self-mark for this visit, not a saved score or certificate.

Objects are original vector illustrations of the returned values. **Pause motion** and your device's reduced-motion preference stop decorative animation; the replay controls remain usable. See the [course studio guide](../engineering/course-studio.md) for keyboard controls, event edge cases and reproduction.

## Print a lesson worksheet

In any of the twelve continuity lessons, enter an optional prediction, select **Run lesson**, then select **Download lesson worksheet** under **Reproduce this lesson**. Open the downloaded HTML in a browser to read it offline or use **Print / Save as PDF**. Choose A4 or US Letter, 100% scale, with browser headers and footers off; check print preview before sharing.

The three sections start on separate printed pages:

1. **Prediction and exercise:** the completed input, scheduled events and the estimate submitted with that run, plus space for reasoning.
2. **Result and worked calculation:** the actual result, unit-labelled steps, a power or annual-energy chart, and space to explain the difference.
3. **Assumptions and reproduction:** asset capacities and connections where applicable, input hash, engine version, source revision when known, and model limits.

The export keeps the last completed calculation. Editing a draft input or estimate afterwards does not rewrite that record; run the lesson again to include the edits. An automatically opened lesson has no submitted estimate. Estimates are self-reported, not evidence that a learner predicted the answer before seeing a result.

The HTML embeds the complete result under **Embedded calculation**, without scripts, external resources or telemetry. Displayed quantities use up to six decimal places; embedded JSON preserves the full engine output. Unknown costs and absent events remain explicit. Save the ordinary JSON export as well when comparing calculations. Local builds without a recorded public revision say **Unknown for this build** rather than inventing one.

The existing [lesson 3 battery worksheet](battery-ride-through-worksheet.md) remains a ready-made 100/50 kWh exercise. The `1.0.0` release includes this export for all twelve configured lessons. The historical `0.4.0rc2` assets remain unchanged.

## The headline result

![Section 04 · Verification / output](../visuals/sections/section-04-verification.svg)

The AI-outage lesson uses a synthetic aggregate **50,000 kW (50 MW)** IT request and **5,000 kWh (5 MWh)** initial stored battery energy. Utility and generator supply fail at 300 s. With 0.90 battery discharge efficiency and 0.95 distribution efficiency:

```text
total modeled efficiency = 0.90 × 0.95 = 0.855
IT-boundary reserve      = 5,000 kWh × 0.855 = 4,275 kWh
ride-through             = 4,275 kWh / 50,000 kW × 3,600 s/h
                         = 307.8 s
battery depletion       = 300 s + 307.8 s = 607.8 s
```

The utility restoration event is at 900 s, leaving `900 − 607.8 = 292.2 s` after depletion. If the aggregate request stays at 50,000 kW, that interval contains:

```text
unserved IT energy = 50,000 kW × 292.2 s / 3,600 s/h
                   = 4,058.333333... kWh
```

The calculation is a scaled teaching fixture. It answers how the declared reserve and efficiencies behave in this event sequence; it does not infer GPU throughput, job completion, grid adequacy, or site performance.

## Run the lessons

![Section 03 · Reproduce / parameters](../visuals/sections/section-03-reproduce.svg)

1. Open the [course at lesson 1](https://khanlab.co.technology/?lesson=power-energy).
2. Predict the challenge value shown by the lesson, then select **Try the challenge value** and **Run lesson**.
3. Open **Show worked answer**, compare the displayed result and energy-balance residual, and move to the next lesson.
4. Jump directly to [the 50 MW AI-outage lesson](https://khanlab.co.technology/?lesson=ai-outage).

The browser course needs no installation or account. The default calculation uses exact JavaScript arithmetic. **Verify against Python** is an optional action on a completed run; it loads the Python runtime only when selected.

## Lesson map

For lesson 3, use the [printable battery ride-through worksheet](battery-ride-through-worksheet.md)
to write a prediction before checking the worked answer on a separate page.

| # | Lesson and link | Question | Default → challenge | Expected check |
| ---: | --- | --- | --- | --- |
| 1 | [Power becomes energy](https://khanlab.co.technology/?lesson=power-energy) | How much energy does a constant load request in half an hour? | 1,000 → 500 kW | `1,000 × 0.5 = 500 kWh`; the challenge gives 250 kWh. |
| 2 | [Account for distribution losses](https://khanlab.co.technology/?lesson=distribution-loss) | How much source power is needed to deliver 1,000 kW? | 0.95 → 0.90 ratio | `1,000 / 0.95 = 1,052.631... kW`; at 0.90 it is `1,111.111... kW`. |
| 3 | [Calculate battery ride-through](https://khanlab.co.technology/?lesson=ride-through) | Does half the stored energy give half the ride-through duration? | 100 → 50 kWh | Charging is disabled for this lesson: depletion is 607.8 s → 453.9 s. |
| 4 | [Bridge generator startup](https://khanlab.co.technology/?lesson=generator-delay) | What changes when startup takes 60 seconds instead of 30? | 30 → 60 s | Generator-ready event moves from 330 s to 360 s; the battery bridges both inputs. |
| 5 | [Add a failed generator](https://khanlab.co.technology/?lesson=generator-failure) | What changes if the generator cannot start? | Failed → available | Failed case depletes at 607.8 s with 292.2 s unserved; available generation starts at 330 s. |
| 6 | [Check a surviving path](https://khanlab.co.technology/?lesson=n-plus-one) | Can either path carry the whole 1 MW load? | 700 → 1,100 kW gross path | `700 × 0.95 = 665 kW`, leaving 335 kW; 1,100 kW gross supplies the full request after loss. |
| 7 | [Expose shared control failures](https://khanlab.co.technology/?lesson=shared-controls) | Can a shared control fault defeat both paths? | Shared → removed from Path B | Both paths unavailable gives 1,000 kW unmet; removing the dependency leaves 665 kW served. |
| 8 | [Find a single point of failure](https://khanlab.co.technology/?lesson=single-point) | What happens when the common main bus fails? | Failed → available | A 600 s outage gives `1,000 × 600/3,600 = 166.666... kWh` unserved. |
| 9 | [Track energy before the outage](https://khanlab.co.technology/?lesson=precharge) | Why can a 50 kWh case last longer when it charges first? | 100 → 0 kW charging | Pre-outage charging adds `100 × 300/3,600 × 0.95 = 7.9166... kWh`; depletion is 478.2675 s → 453.9 s. |
| 10 | [Interrupt a 50 MW AI cluster](https://khanlab.co.technology/?lesson=ai-outage) | How long can 5 MWh bridge a 50 MW load? | 5,000 → 2,500 kWh | Full reserve depletes at 607.8 s; the half-reserve challenge, with pre-outage charging, depletes at 478.2675 s. |
| 11 | [Catch a sub-second service gap](https://khanlab.co.technology/?lesson=recovery-deadline) | Does 57 kWh bridge recovery at 500 s? Does 58 kWh? | 57 → 58 kWh | 57 kWh depletes at 499.8135 s, leaving 0.1865 s unserved; 58 kWh bridges the event. |
| 12 | [Separate PUE from continuity](https://khanlab.co.technology/?lesson=pue) | How does assumed PUE change annual energy for the same 50 MW IT load? | 1.25 → 1.15 ratio | `50,000 × 8,760 × 1.25 = 547,500,000 kWh`; at 1.15 it is 503,700,000 kWh. |

The lesson values above are the course defaults and challenge values. Other values can change event order, service gaps, and the reported ledger; read the result's assumptions and input hash with the number.

## Reproduce the reference calculations with the CLI

The public CLI accepts the original reference presets and the two AI-cluster presets. These commands use the documented `simulate` syntax and write Markdown reports to new paths:

```sh
python -m datacenter_twin simulate --preset generator_failure --format markdown --output outputs/course-generator-failure.md
python -m datacenter_twin simulate --preset path_maintenance --format markdown --output outputs/course-path-maintenance.md
python -m datacenter_twin simulate --preset ai_cluster_generator_failure --format markdown --output outputs/course-ai-generator-failure.md
python -m datacenter_twin simulate --preset ai_cluster_utility_loss --format markdown --output outputs/course-ai-utility-loss.md
python -m unittest discover -s tests -p test_continuity.py -v
```

The first report reproduces the 1 MW / 100 kWh calculation: 307.8 s of battery ride-through and depletion at 607.8 s. The second checks `700 kW × 0.95 = 665 kW` served and `335 kW` unserved during the 600 s maintenance interval. Choose new output paths or add `--force` when replacing an existing report.

For the 50 MW case, use the browser's [AI-outage lesson](https://khanlab.co.technology/?lesson=ai-outage) or either AI-cluster CLI command above. The lesson selects the implemented `ai_cluster_generator_failure` scenario and exposes the inputs and result without requiring a source checkout.

## Assumptions and limits

![Section 02 · Equations / provenance](../visuals/sections/section-02-equations.svg)

The lessons use synthetic electrical and planning exercises. The 50 MW examples represent one aggregate requested IT load. They do not model GPU jobs, workload queues, cooling, grid adequacy, AC transients, protection coordination, facility safety, reliability probabilities, selected equipment, or certified uptime. The N+1 lesson tests a path-capacity condition only. The PUE lesson is a separate annual energy calculation; do not add its overhead to the continuity losses a second time.

The 1 MW reference fixture uses 1,000 kW IT demand, 100 kWh initial and maximum battery energy, 0.90 discharge efficiency, 0.95 distribution efficiency, a 30 s generator start delay, 700 kW gross paths, and explicit 300 s / 900 s events. The AI-cluster case scales the aggregate electrical quantities and storage by 50× while retaining the timing and modeled ratios. These are assumptions, not facility measurements, live prices, grid studies, or equipment ratings.

No physical controls or external telemetry are used. The browser has no shared simulation backend or client analytics, and the local API binds to loopback. Independent external technical review, formal security audit, facility calibration, and real-site validation are absent. Lesson completion is not collected. Unknown costs and unavailable quantities remain explicit in exports.

The course uses the repository's original synthetic fixtures and code under [Apache-2.0](../../LICENSE). See [NOTICE](../../NOTICE), [synthetic provenance](../../data/provenance/manifest.json), and [browser runtime licenses](../third-party/README.md).

## Infrastructure Engineering, lessons 13–24

Continue from PUE to the [evidence/load ledger](https://khanlab.co.technology/?lesson=evidence-load-ledger), or select the Infrastructure Engineering track. Read the declared source boundary, optionally predict, select **Run screen**, inspect the applied result, then select **Apply challenge** and run again. Each lesson includes its supplied prose, source locators, three assessments with answer criteria, a separate SVG scene and a no-JavaScript reading note. **Export completed screen** keeps the applied values, units, assumptions, version and hashes even after draft edits. Generator fuel has its own screen.

Play/Pause and narrative stepping are explanatory; physical seconds appear only in the separately labelled thermal preview. Static tables and reduced motion preserve essential states. Source statement, Editorial derivation, Illustrative assumption and Unresolved identify the claim boundaries. Numerical agreement does not clear engineering HOLD. Infrastructure results have no supported in-browser Python-verification protocol. The existing worksheets and Python comparison remain available for their original continuity result family.
