# Lower power can still cost more energy

This worked example compares energy to complete the same declared job. It is
constructed arithmetic, not an EXCES reproduction or hardware measurement.
The [EXCES definition](https://hesela.dev/terms/exces/) explains the historical
research that motivates including the whole system.

## Accounting boundary

For each alternative, E = (P_host + P_disk + P_cache) * T.
Power is the mean over that alternative's complete runtime, in watts; T is
seconds and E is joules. The components must be non-overlapping and exhaustive:
host includes the rest of the system, not storage already counted separately.
Transitions, reconfiguration and background work must be included in the means.
A measured mean must not have those costs added again.

All cases declare the same completed work and use the same accounting boundary.
The code can check the declaration, but cannot verify that two real benchmarks
actually complete equivalent work or meet equivalent durability requirements.
It is an accounting check, not a prediction of runtime or device-state behavior.

## Constructed inputs and results

The baseline is host 16 W plus disk 4 W for 100 s: 2000 J.
Each candidate keeps the host at 16 W and reduces the disk to 1 W.

| Cache mean power | Runtime | Total mean power | Energy | Saving against baseline |
| --- | --- | --- | --- | --- |
| 1 W | 100 s | 18 W | 1800 J | 10% |
| 1 W | 120 s | 18 W | 2160 J | -8% |
| 1 W | 1000/9 s | 18 W | 2000 J | 0% |
| 3 W | 100 s | 20 W | 2000 J | 0% |
| 4 W | 100 s | 21 W | 2100 J | -5% |

The first two cases have identical power, but opposite energy conclusions.
At 18 W, the exact equal-energy runtime is 2000/18 = 1000/9 s, about 111.1 s.
This is a threshold for these assumed means, not a disk spin-down timeout.
If power changes with runtime, its mean must be recomputed.

Energy saving is (E_baseline - E_candidate) / E_baseline.
The denominator is whole-system baseline energy, not disk energy.
Negative saving means an increase. Finite-precision display is separate from
the exact rational strings in results.json. No confidence interval is appropriate
for these deterministic invented inputs; real measurements need repeat runs,
measurement uncertainty and an explicitly comparable workload.

## Reproduce offline

Use Python 3 with only its standard library. Keep these four files together:
[model.py](model.py), [test_model.py](test_model.py), [results.json](results.json)
and this README.

```sh
python3 -B model.py --check
python3 -B -m unittest -v test_model.py
python3 -B -O -m unittest -v test_model.py
```

Running model.py without --check regenerates results.json. Reuse and modification
of these four Hesela-authored files is permitted under CC0-1.0.
The linked research paper retains its own copyright.
