How the replay works
There is none here, and nothing is installed. The relays you are stepping through are running in your browser, from the same machine files and the same PureScript simulation that run in Python beside pandapower in the demo. Only pandapower's power-flow answers were recorded, from the demo, and this page replays them.
The demo is a Python program: protection relays written in PureScript, compiled by Pythia to Python, running beside pandapower. A static website cannot run a Python process or a numerical library. We do not expect everyone who is curious to install and build the full project, so we made this.
It is not a canned demo, and it is not all running in your browser either. The Python side is canned: pandapower's answers were recorded. The PureScript side runs here for real: the analysis, the protection simulation and the relays themselves.
The same PureScript source is compiled twice: by Pythia (purepy) to Python, for the demo, and by purs, the standard compiler, to JavaScript, for this page. Both run the same protection simulation, Grid.Protection.protect, from the same two relay machine files.
The simulation never calls pandapower itself. It asks a solver: an interface in the source with a few operations, describe the network and solve its power flow among them. In the demo the solver is pandapower. In the replay it is a recording (Grid.Transcript.replaying) that answers each question with the answer pandapower gave when it was asked the same question.
check/record_stepper.py runs every run this page offers through the demo's own generated Python, against pandapower, and writes down every question the simulation asks and every answer it gets. The space is fixed in one place in the source (Grid.Stepper), which the recorder, the page and the check all read:
That is 2,624 runs, and they are what the choices above the replay offer. A question many runs ask, such as the intact network at a load factor, is kept once: 3,064 recorded answers in all, in one file per load factor, 9.2 MB as written or about 1.6 MB gzipped. The page loads only the file for the load factor it shows, so a first visit is about 140 KB gzipped, the page's code included.
For every one of the 2,624 runs, the page's own compiled JavaScript replays the recording and must give the answer the demo gave in Python, as text, byte for byte. It also checks that the page's two relay files are the demo's, unchanged. check/stepper-replay.mjs, part of make check.
An overcurrent relay with trip, reclose and lockout, and an under-voltage relay that sheds load: two Glassbox files. The replay and the demo read the same two.
Glassbox generates a table of each machine's behaviour. Node and Python each generate it again, and both must match the committed copy byte for byte. The vectors cover the default settings only, and the page's own bundle is not run against them: the replay check holds it.
This page is driven in a headless browser, served by a plain static file server with no API: the run on the page must be the demo's, event by event.
Python and JavaScript agreeing says the source means the same on both. It does not say the model is right; what the model is not is on the front page.
The choices above cover exactly what was recorded, but the page's address can ask for more: two lines out, say. The replay looks for the answer in its recording, does not find it, and says so in words: which power flow it needed, and that the demo can answer it.
Anything outside the recorded choices: a load factor of your own, two lines out, a relay setting of your own, the N-1 sweep over all 41 lines. Each needs pandapower, asked live, and that is the demo.
Run the demo yourselfBack to the replay
Grid Explorer, a Hylograph exhibit. The front page. Source on GitHub. Pythia on GitHub.