In this section
- Grid Engine — Site Geometry Page render · globalgrid2050 / grid_engine/202609060238-site-geometry/index.html lines 1–283
- Grid Engine — Power Factor Page render · globalgrid2050 / grid_engine/202609060309-power-factor/index.html lines 1–285
Grid Engine — Site Geometry Page
A web page in GlobalGrid2050 using data from the ventus-grid-engine repository. Published at https://globalgrid2050.com/grid_engine/202609060238-site-geometry/.
renderglobalgrid2050 / grid_engine/202609060238-site-geometry/index.html · lines 1–283 of 283 · version 2026-09-06 02:38 · Entry point · pattern parsePoly (shared by 3 files)
- What it does
- It draws its content. Defines 7 functions or classes, including el, num, fig, refuse, bind. Side effects: changes the web page (DOM).
- Inputs & outputs
- In: form fields (user input). Out: web page.
- Downstream impact
- Used directly by 3 files: Homepage V090 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v090.html); Homepage V091 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v091.html); Homepage V093 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v093.html). It is itself an entry point, published at https://globalgrid2050.com/grid_engine/202609060238-site-geometry/.
- What it achieves
- It parses poly (`parsePoly`) and is built from the num step (`num`) and the fig step (`fig`). Site Geometry Workbench — Ventus Grid Engine. It responds to input events.
- Why it matters
- Loaded by the Homepage V090 page at https://globalgrid2050.com/homepage_versions/homepage_v090.html and 2 other pages.
- Application
- globalgrid2050 · grid_engine/202609060238-site-geometry · page
- Uses
- V9 Geodesy (link), Geo Area (link), GlobalGrid2050 — Grid Engine Page (link), Papers — Published Fault Level Page (link)
- Used by
- linked from Homepage V090 (link), linked from Homepage V091 (link), linked from Homepage V093 (link), mentioned in Standalone (comment link)
- Produces
- el, num, fig, refuse, bind, parsePoly, render
- Defines here
- el, num, fig, refuse, bind, parsePoly, render
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 grid_engine/202609060238-site-geometry/index.html:1-283 · blob 750ae0192e9c7f628a2f535c52599076f5a55ab4 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: production_core
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Site Geometry Workbench — Ventus Grid Engine</title>
<style>
:root{--bg:#000;--panel:#0b0e14;--line:#2f343d;--soft:#222;--text:#fff;
--muted:#a6adbb;--accent:#00ffff;--ok:#00ff88;--warn:#ffae00;--no:#ff5c5c}
*{box-sizing:border-box;margin:0;padding:0;font-family:'Courier New',ui-monospace,monospace}
html,body{background:var(--bg);color:var(--text)}
body{font-size:14px;line-height:1.55;padding:0 0 48px}
.wrap{max-width:960px;margin:0 auto;padding:0 14px}
header{border-bottom:1px solid var(--soft);padding:18px 0 14px;margin-bottom:16px}
h1{font-size:17px;letter-spacing:2px;color:var(--accent)}
.sub{color:var(--muted);font-size:11px;margin-top:6px}
.stamp{color:#7f8996;font-size:10px;margin-top:8px;overflow-wrap:anywhere}
.status{border:1px solid var(--line);background:var(--panel);padding:9px 11px;
margin-bottom:16px;font-size:11px}
.status.live{border-color:#167d4d;color:var(--ok)}
.status.dead{border-color:#7d1616;color:var(--no)}
section{border:1px solid var(--soft);background:var(--panel);margin-bottom:16px}
h2{font-size:12px;letter-spacing:1.4px;color:var(--accent);padding:11px 13px;
border-bottom:1px solid var(--soft)}
.body{padding:13px}
.lede{color:var(--muted);font-size:11.5px;line-height:1.65;margin-bottom:13px}
label{display:block;color:var(--muted);font-size:10px;letter-spacing:.6px;
text-transform:uppercase;margin:0 0 5px}
.field{margin-bottom:13px}
input[type=number],input[type=text]{width:100%;background:#000;border:1px solid var(--line);
color:var(--text);padding:11px 10px;font-size:16px;font-weight:700}
input:focus{outline:none;border-color:var(--accent)}
input[type=range]{width:100%;accent-color:var(--accent);height:32px}
.rangerow{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.rangeval{color:var(--accent);font-weight:700;font-size:15px;white-space:nowrap}
.out{border:1px solid var(--line);background:#06080b;padding:11px;margin-top:11px}
.figure{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.figure .n{font-size:26px;font-weight:700;color:var(--ok);line-height:1.1}
.figure .n.over{color:var(--no)}
.figure .u{font-size:12px;color:var(--muted)}
.figure .q{font-size:10px;color:#7f8996;text-transform:uppercase;letter-spacing:.8px;
flex:1 0 100%;margin-bottom:3px}
.basis{color:#8e98a5;font-size:10.5px;line-height:1.65;margin-top:9px;
border-top:1px dashed #252a31;padding-top:8px}
.scroller{overflow-x:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse;font-size:11px}
th{color:var(--accent);text-align:left;padding:7px 6px;border-bottom:1px solid var(--line);
font-size:10px;letter-spacing:.5px}
td{padding:7px 6px;border-bottom:1px solid #1a1e25;color:var(--muted)}
td.n{color:var(--text);font-weight:700;text-align:right;white-space:nowrap}
.refuse{border:1px solid #5c2020;background:#120708}
.refuse h2{color:#ff8f8f;border-bottom-color:#5c2020}
.refuse dt{color:#ff8f8f;font-size:11px;font-weight:700;margin-top:11px}
.refuse dt:first-child{margin-top:0}
.refuse dd{color:#c9a9a9;font-size:10.5px;line-height:1.65;margin-top:3px}
footer{color:#69727d;font-size:10.5px;line-height:1.9;padding-top:14px;
border-top:1px solid var(--soft);margin-top:20px}
/* Touch targets. Measured at 393px on 2026-09-06: footer links were 11.3px
tall, below the 24px WCAG 2.2 minimum. Inline links keep their flow but are
given real height through padding and line-height. */
footer a,.basis a{color:#66ccff;display:inline-block;padding:5px 2px;line-height:1.5}
.nav{margin-top:14px;font-size:11px}
.nav a{color:#66ccff;display:inline-block;padding:8px 10px 8px 0}
</style>
</head>
<body>
<div class="wrap">
<header>
<h1>SITE GEOMETRY WORKBENCH</h1>
<p class="sub">Distance, bearing, area and perimeter on the one geodesy the estate agrees on</p>
<p class="stamp">Generation 202609060238 · engine v9-geodesy.js, geo-area.js at 7d40365</p>
</header>
<div class="status" id="engine-status">Loading the engine module…</div>
<section>
<h2>1 · TWO POINTS</h2>
<div class="body">
<p class="lede">Great-circle distance and initial bearing, in (longitude, latitude) order — the
order the estate standardised on after mixing it up cost a day. The radius is
6378.137 km, the equatorial figure the Atlas uses; the estate also carries a UK
figure and a mean figure, and which one is correct depends on the question.</p>
<div class="field">
<label for="lon1">From longitude</label>
<input type="number" id="lon1" value="-1.4" min="-180" max="180" step="0.0001" inputmode="decimal">
</div>
<div class="field">
<label for="lat1">From latitude</label>
<input type="number" id="lat1" value="52.5" min="-90" max="90" step="0.0001" inputmode="decimal">
</div>
<div class="field">
<label for="lon2">To longitude</label>
<input type="number" id="lon2" value="-0.9" min="-180" max="180" step="0.0001" inputmode="decimal">
</div>
<div class="field">
<label for="lat2">To latitude</label>
<input type="number" id="lat2" value="53.1" min="-90" max="90" step="0.0001" inputmode="decimal">
</div>
<div class="out" id="out-distance"></div>
</div>
</section>
<section>
<h2>2 · A SITE BOUNDARY</h2>
<div class="body">
<p class="lede">Paste a closed boundary as <code>lon,lat</code> pairs separated by semicolons.
Area and perimeter are computed on the sphere, not on a flat projection — at UK
latitudes a planar approximation of a large site is wrong by enough to matter to a
land agreement.</p>
<div class="field">
<label for="poly">Boundary (lon,lat; lon,lat; …)</label>
<input type="text" id="poly" value="-1.40,52.50; -1.39,52.50; -1.39,52.51; -1.40,52.51" inputmode="text">
</div>
<div class="out" id="out-area"></div>
<div class="scroller"><table id="geo-table"><thead><tr><th>Measure</th><th style="text-align:right">Value</th></tr></thead><tbody></tbody></table></div>
<p class="basis">A circle-cap area is given alongside for comparison: it is the area within a
radius on the sphere, which is what a "within X km" search actually covers and is
noticeably larger than πr² once the radius is big.</p>
</div>
</section>
<section class="refuse">
<h2>WHAT THIS WORKBENCH WILL NOT COMPUTE</h2>
<div class="body">
<p class="lede" style="color:#c9a9a9">These are not features missing from a later
version. The engine proof asserts that no function of these names exists, so
their absence is a tested property rather than an oversight.</p>
<dl id="refusals"></dl>
</div>
</section>
<footer>
<p>Every figure above is computed by
<a href="https://ventusltd.github.io/ventus-grid-engine/engine/v9-geodesy.js">v9-geodesy.js</a> and <a href="https://ventusltd.github.io/ventus-grid-engine/engine/geo-area.js">geo-area.js</a>
in the Ventus Grid Engine, imported at runtime and proven by 23 checks.
This page holds no copy of the mathematics: if the engine cannot be reached it
shows no numbers rather than a stale answer.</p>
<p class="nav">
<a href="../">All workbenches</a>
<a href="/papers/202609060203-electrification/">Electrification paper</a>
<a href="/papers/202609060045-published-fault-level/">Fault-level paper</a>
<a href="/">GlobalGrid2050</a></p>
<p style="margin-top:6px">Scenario arithmetic is not evidence of connection headroom.
A national load factor cannot establish utilisation at any particular transformer.</p>
</footer>
</div>
<script type="module">
const ENGINE_MODULES = ["https://ventusltd.github.io/ventus-grid-engine/engine/v9-geodesy.js","https://ventusltd.github.io/ventus-grid-engine/engine/geo-area.js"];
const ENGINE_SCHEMAS = ["gridatlas.module.geodesy.v1",null];
const statusEl = document.getElementById('engine-status');
let E = null;
const el = id => document.getElementById(id);
const num = id => Number(el(id).value);
function fig(target, r, decimals = 1, over = false) {
el(target).innerHTML =
'<div class="figure">' +
'<span class="q">' + r.quantity.replace(/_/g, ' ') + '</span>' +
'<span class="n' + (over ? ' over' : '') + '">' +
r.value.toLocaleString('en-GB', { minimumFractionDigits: decimals, maximumFractionDigits: decimals }) +
'</span><span class="u">' + r.unit + '</span></div>' +
'<p class="basis">' + r.basis + '</p>';
}
function refuse(target, message) {
el(target).innerHTML = '<p class="basis" style="color:#ffae00;border:0;padding:0;margin:0">'
+ 'Engine refused this input: ' + message + '</p>';
}
function bind() { ['lon1','lat1','lon2','lat2','poly'].forEach(id => el(id).addEventListener('input', render)); }
function parsePoly(raw) {
return raw.split(';').map(s => s.trim()).filter(Boolean).map(pair => {
const [a, b] = pair.split(',').map(Number);
if (!Number.isFinite(a) || !Number.isFinite(b)) throw new Error('cannot read point "' + pair + '"');
return [a, b];
});
}
function render() {
try {
const km = E.distanceKm(num('lon1'), num('lat1'), num('lon2'), num('lat2'));
const brg = E.initialBearingDeg(num('lon1'), num('lat1'), num('lon2'), num('lat2'));
el('out-distance').innerHTML =
'<div class="figure"><span class="q">great-circle distance</span><span class="n">' +
km.toFixed(3) + '</span><span class="u">km · bearing ' + brg.toFixed(1) + '°</span></div>' +
'<p class="basis">Computed on a sphere of radius ' + E.EARTH_RADIUS_KM +
' km in (longitude, latitude) order. A straight line between two points is a measurement; ' +
'it is not a route and it is not a cable length.</p>';
} catch (err) { refuse('out-distance', err.message); }
const tb = document.querySelector('#geo-table tbody');
try {
const pts = parsePoly(el('poly').value);
if (pts.length < 3) throw new Error('a boundary needs at least three points');
// polygonAreaKm2 and circleCapAreaKm2 return a whole set of units, not a
// bare number: { areaKm2, areaM2, areaHa, areaAc, areaMi2, perimKm,
// pitches }. Reading them as numbers threw, and the page said so rather
// than showing a stale figure.
const area = E.polygonAreaKm2(pts);
const perimKm = E.polylinePerimeterKm(pts, true);
const cap1 = E.circleCapAreaKm2(1);
const cap50 = E.circleCapAreaKm2(50);
el('out-area').innerHTML =
'<div class="figure"><span class="q">site area</span><span class="n">' +
area.areaHa.toFixed(2) + '</span><span class="u">hectares · ' +
area.areaAc.toFixed(1) + ' acres · ' + area.areaKm2.toFixed(5) + ' km²</span></div>' +
'<p class="basis">Spherical area of a closed boundary of ' + pts.length + ' points, on a ' +
'sphere rather than a flat projection. At UK latitudes a planar approximation of a large ' +
'site is wrong by enough to matter to a land agreement.</p>';
tb.innerHTML = [
['Boundary points', pts.length],
['Area', area.areaKm2.toFixed(6) + ' km²'],
['Area', area.areaHa.toFixed(3) + ' ha'],
['Area', area.areaAc.toFixed(2) + ' acres'],
['Area, in football pitches', area.pitches.toFixed(1)],
['Perimeter (closed)', perimKm.toFixed(4) + ' km'],
['Within 1 km — spherical cap', cap1.areaKm2.toFixed(5) + ' km²'],
['Within 1 km — flat πr², for comparison', Math.PI.toFixed(5) + ' km²'],
['Within 50 km — spherical cap', cap50.areaKm2.toFixed(2) + ' km²'],
['Within 50 km — flat πr², for comparison', (Math.PI * 2500).toFixed(2) + ' km²'],
['Difference at 50 km', ((Math.PI * 2500 - cap50.areaKm2) / cap50.areaKm2 * 100).toFixed(3) + '%']
].map(r => '<tr><td>' + r[0] + '</td><td class="n">' + r[1] + '</td></tr>').join('');
} catch (err) { refuse('out-area', err.message); tb.innerHTML = ''; }
}
try {
const loaded = [];
for (const url of ENGINE_MODULES) loaded.push(await import(url));
// Some engine modules predate the schema convention and declare none. A spec
// says so by passing null, and the check is skipped rather than faked -- an
// asserted schema that does not exist would fail every load for a module that
// is perfectly good.
loaded.forEach((m, i) => {
const expected = ENGINE_SCHEMAS[i];
if (expected && m.schema !== expected) {
throw new Error('unexpected schema ' + m.schema + ' from ' + ENGINE_MODULES[i]);
}
});
// Merge the modules into one namespace. A name collision would silently
// shadow one module's function with another's, so it is refused loudly.
E = {};
const NOT_COMPUTED = {};
// Refusals are not all shaped the same. The newer modules export
// NOT_COMPUTED as an object of named reasons; the older ones export a single
// string, or name their boundaries individually as NOT_A_CAPACITY,
// NO_HEADROOM, NEVER_SUMMED, CAVEAT and so on. Spreading a string into an
// object would render one character per letter, so each shape is handled.
const REFUSAL_NAME = /^(NOT_|NO_|NEVER_|CAVEAT|IMPEDANCE_)/;
for (const m of loaded) {
for (const [k, v] of Object.entries(m)) {
if (k === 'schema' || k === 'requires') continue;
if (k === 'NOT_COMPUTED') {
if (typeof v === 'string') NOT_COMPUTED.notComputed = v;
else Object.assign(NOT_COMPUTED, v);
continue;
}
if (REFUSAL_NAME.test(k) && typeof v === 'string') {
NOT_COMPUTED[k.toLowerCase().replace(/_(.)/g, (_, c) => c.toUpperCase())] = v;
continue;
}
if (k in E) throw new Error('two engine modules both export "' + k + '"');
E[k] = v;
}
}
E.NOT_COMPUTED = NOT_COMPUTED;
statusEl.className = 'status live';
statusEl.textContent = 'ENGINE LIVE — ' +
ENGINE_SCHEMAS.map((sc, i) => sc || ENGINE_MODULES[i].split('/').pop()).join(' + ') +
' · every figure below is computed by the engine module' + (loaded.length > 1 ? 's' : '') + ', not by this page.';
el('refusals').innerHTML = Object.entries(E.NOT_COMPUTED).map(([k, v]) =>
'<dt>' + k.replace(/([A-Z])/g, ' $1').toUpperCase() + '</dt><dd>' + v + '</dd>').join('');
bind();
render();
} catch (err) {
statusEl.className = 'status dead';
statusEl.textContent = 'ENGINE UNREACHABLE — ' + err.message +
'. Nothing on this page is computed; there is deliberately no local copy to fall back to.';
document.querySelectorAll('.out').forEach(o => {
o.innerHTML = '<p class="basis" style="color:#ff8f8f;border:0;padding:0;margin:0">'
+ 'No figure: the engine did not load.</p>'; });
}
</script>
</body>
</html>Grid Engine — Power Factor Page
A web page in GlobalGrid2050 covering transformers and uses data from the ventus-grid-engine repository. Published at https://globalgrid2050.com/grid_engine/202609060309-power-factor/.
renderglobalgrid2050 / grid_engine/202609060309-power-factor/index.html · lines 1–285 of 285 · version 2026-09-06 03:09 · Entry point · pattern refuse (shared by 54 files)
- What it does
- It draws transformers. Defines 6 functions or classes, including el, num, fig, refuse, bind. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain terms in the code: transformers.
- Inputs & outputs
- In: form fields (user input). Out: web page.
- Downstream impact
- Used directly by 3 files: Homepage V090 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v090.html); Homepage V091 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v091.html); Homepage V093 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v093.html). It is itself an entry point, published at https://globalgrid2050.com/grid_engine/202609060309-power-factor/.
- What it achieves
- It is built from the num step (`num`), the fig step (`fig`) and the refuse step (`refuse`). Power Factor Workbench — Ventus Grid Engine. It responds to input events.
- Why it matters
- Loaded by the Homepage V090 page at https://globalgrid2050.com/homepage_versions/homepage_v090.html and 2 other pages.
- Application
- globalgrid2050 · grid_engine/202609060309-power-factor · page
- Uses
- Power Factor (link), GlobalGrid2050 — Grid Engine Page (link), Papers — Published Fault Level Page (link)
- Used by
- linked from Homepage V090 (link), linked from Homepage V091 (link), linked from Homepage V093 (link)
- Produces
- el, num, fig, refuse, bind, render
- Defines here
- el, num, fig, refuse, bind, render
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 grid_engine/202609060309-power-factor/index.html:1-285 · blob e95ab4d50c88c1804381c98a48e451b21eee2456 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: production_core
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Power Factor Workbench — Ventus Grid Engine</title>
<style>
:root{--bg:#000;--panel:#0b0e14;--line:#2f343d;--soft:#222;--text:#fff;
--muted:#a6adbb;--accent:#00ffff;--ok:#00ff88;--warn:#ffae00;--no:#ff5c5c}
*{box-sizing:border-box;margin:0;padding:0;font-family:'Courier New',ui-monospace,monospace}
html,body{background:var(--bg);color:var(--text)}
body{font-size:14px;line-height:1.55;padding:0 0 48px}
.wrap{max-width:960px;margin:0 auto;padding:0 14px}
header{border-bottom:1px solid var(--soft);padding:18px 0 14px;margin-bottom:16px}
h1{font-size:17px;letter-spacing:2px;color:var(--accent)}
.sub{color:var(--muted);font-size:11px;margin-top:6px}
.stamp{color:#7f8996;font-size:10px;margin-top:8px;overflow-wrap:anywhere}
.status{border:1px solid var(--line);background:var(--panel);padding:9px 11px;
margin-bottom:16px;font-size:11px}
.status.live{border-color:#167d4d;color:var(--ok)}
.status.dead{border-color:#7d1616;color:var(--no)}
section{border:1px solid var(--soft);background:var(--panel);margin-bottom:16px}
h2{font-size:12px;letter-spacing:1.4px;color:var(--accent);padding:11px 13px;
border-bottom:1px solid var(--soft)}
.body{padding:13px}
.lede{color:var(--muted);font-size:11.5px;line-height:1.65;margin-bottom:13px}
label{display:block;color:var(--muted);font-size:10px;letter-spacing:.6px;
text-transform:uppercase;margin:0 0 5px}
.field{margin-bottom:13px}
input[type=number],input[type=text]{width:100%;background:#000;border:1px solid var(--line);
color:var(--text);padding:11px 10px;font-size:16px;font-weight:700}
input:focus{outline:none;border-color:var(--accent)}
input[type=range]{width:100%;accent-color:var(--accent);height:32px}
.rangerow{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.rangeval{color:var(--accent);font-weight:700;font-size:15px;white-space:nowrap}
.out{border:1px solid var(--line);background:#06080b;padding:11px;margin-top:11px}
.figure{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.figure .n{font-size:26px;font-weight:700;color:var(--ok);line-height:1.1}
.figure .n.over{color:var(--no)}
.figure .u{font-size:12px;color:var(--muted)}
.figure .q{font-size:10px;color:#7f8996;text-transform:uppercase;letter-spacing:.8px;
flex:1 0 100%;margin-bottom:3px}
.basis{color:#8e98a5;font-size:10.5px;line-height:1.65;margin-top:9px;
border-top:1px dashed #252a31;padding-top:8px}
.scroller{overflow-x:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse;font-size:11px}
th{color:var(--accent);text-align:left;padding:7px 6px;border-bottom:1px solid var(--line);
font-size:10px;letter-spacing:.5px}
td{padding:7px 6px;border-bottom:1px solid #1a1e25;color:var(--muted)}
td.n{color:var(--text);font-weight:700;text-align:right;white-space:nowrap}
.refuse{border:1px solid #5c2020;background:#120708}
.refuse h2{color:#ff8f8f;border-bottom-color:#5c2020}
.refuse dt{color:#ff8f8f;font-size:11px;font-weight:700;margin-top:11px}
.refuse dt:first-child{margin-top:0}
.refuse dd{color:#c9a9a9;font-size:10.5px;line-height:1.65;margin-top:3px}
footer{color:#69727d;font-size:10.5px;line-height:1.9;padding-top:14px;
border-top:1px solid var(--soft);margin-top:20px}
/* Touch targets. Measured at 393px on 2026-09-06: footer links were 11.3px
tall, below the 24px WCAG 2.2 minimum. Inline links keep their flow but are
given real height through padding and line-height. */
footer a,.basis a{color:#66ccff;display:inline-block;padding:5px 2px;line-height:1.5}
.nav{margin-top:14px;font-size:11px}
.nav a{color:#66ccff;display:inline-block;padding:8px 10px 8px 0}
</style>
</head>
<body>
<div class="wrap">
<header>
<h1>POWER FACTOR WORKBENCH</h1>
<p class="sub">Capacity released without building anything</p>
<p class="stamp">Generation 202609060309 · engine power-factor.js at d1b459c</p>
</header>
<div class="status" id="engine-status">Loading the engine module…</div>
<section>
<h2>1 · THE LOAD AS THE PLANT SEES IT</h2>
<div class="body">
<p class="lede">A load does not present kilowatts to a transformer, it presents kilovolt-amperes.
Reactive power does no work, but it is carried by the same conductors and occupies
the same rating as the real power beside it. That is why a site can be well inside
its kW and outside its agreed capacity.</p>
<div class="field">
<label for="kw">Real power (kW)</label>
<input type="number" id="kw" value="1000" min="1" max="500000" step="1" inputmode="decimal">
</div>
<div class="field">
<div class="rangerow"><label for="pf0">Present power factor</label>
<span class="rangeval" id="pf0-val">0.85</span></div>
<input type="range" id="pf0" min="0.5" max="1" step="0.01" value="0.85">
</div>
<div class="out" id="out-now"></div>
</div>
</section>
<section>
<h2>2 · THE CORRECTION, AND WHAT IT GIVES BACK</h2>
<div class="body">
<p class="lede">Correction supplies the reactive power locally instead of drawing it across the
network. The site consumes exactly the same energy afterwards and occupies less of
its connection. <strong>Do not aim at unity:</strong> the last few percent costs
disproportionately, and a fixed bank sized for full load will over-correct at part
load — at which point the site can be charged for exporting reactive power instead.</p>
<div class="field">
<div class="rangerow"><label for="pf1">Target power factor</label>
<span class="rangeval" id="pf1-val">0.98</span></div>
<input type="range" id="pf1" min="0.6" max="1" step="0.01" value="0.98">
</div>
<div class="out" id="out-correction"></div>
<div class="scroller"><table id="pf-table"><thead><tr><th>Measure</th><th style="text-align:right">Before</th><th style="text-align:right">After</th></tr></thead><tbody></tbody></table></div>
</div>
</section>
<section>
<h2>3 · AGAINST YOUR AGREED CAPACITY</h2>
<div class="body">
<p class="lede">The figure in your connection agreement, which is commercial and is yours to
type in — nothing here infers it. Watch what happens to the same load at the two
power factors above.</p>
<div class="field">
<label for="agreed">Agreed capacity (kVA)</label>
<input type="number" id="agreed" value="1100" min="1" max="500000" step="1" inputmode="decimal">
</div>
<div class="out" id="out-agreed"></div>
<p class="basis">A ratio of two numbers you supplied. It is not a connection assessment: the
binding constraint may be the upstream circuit, the fault level at the busbar, or a
position in a queue, none of which appear in this arithmetic.</p>
</div>
</section>
<section class="refuse">
<h2>WHAT THIS WORKBENCH WILL NOT COMPUTE</h2>
<div class="body">
<p class="lede" style="color:#c9a9a9">These are not features missing from a later
version. The engine proof asserts that no function of these names exists, so
their absence is a tested property rather than an oversight.</p>
<dl id="refusals"></dl>
</div>
</section>
<footer>
<p>Every figure above is computed by
<a href="https://ventusltd.github.io/ventus-grid-engine/engine/power-factor.js">power-factor.js</a>
in the Ventus Grid Engine, imported at runtime and proven by 33 checks.
This page holds no copy of the mathematics: if the engine cannot be reached it
shows no numbers rather than a stale answer.</p>
<p class="nav">
<a href="../">All workbenches</a>
<a href="/papers/202609060203-electrification/">Electrification paper</a>
<a href="/papers/202609060045-published-fault-level/">Fault-level paper</a>
<a href="/">GlobalGrid2050</a></p>
<p style="margin-top:6px">Scenario arithmetic is not evidence of connection headroom.
A national load factor cannot establish utilisation at any particular transformer.</p>
</footer>
</div>
<script type="module">
const ENGINE_MODULES = ["https://ventusltd.github.io/ventus-grid-engine/engine/power-factor.js"];
const ENGINE_SCHEMAS = ["ventus-grid-engine.power-factor.v1"];
const statusEl = document.getElementById('engine-status');
let E = null;
const el = id => document.getElementById(id);
const num = id => Number(el(id).value);
function fig(target, r, decimals = 1, over = false) {
el(target).innerHTML =
'<div class="figure">' +
'<span class="q">' + r.quantity.replace(/_/g, ' ') + '</span>' +
'<span class="n' + (over ? ' over' : '') + '">' +
r.value.toLocaleString('en-GB', { minimumFractionDigits: decimals, maximumFractionDigits: decimals }) +
'</span><span class="u">' + r.unit + '</span></div>' +
'<p class="basis">' + r.basis + '</p>';
}
function refuse(target, message) {
el(target).innerHTML = '<p class="basis" style="color:#ffae00;border:0;padding:0;margin:0">'
+ 'Engine refused this input: ' + message + '</p>';
}
function bind() { ['kw','pf0','pf1','agreed'].forEach(id => el(id).addEventListener('input', render)); }
function render() {
el('pf0-val').textContent = num('pf0').toFixed(2);
el('pf1-val').textContent = num('pf1').toFixed(2);
const kw = num('kw'), pf0 = num('pf0'), pf1 = num('pf1');
try {
const s = E.apparentPowerKva({ kw, powerFactor: pf0 });
const q = E.reactivePowerKvar({ kw, powerFactor: pf0 });
el('out-now').innerHTML =
'<div class="figure"><span class="q">as the plant sees it</span><span class="n">' +
s.value.toFixed(1) + '</span><span class="u">kVA · ' + q.value.toFixed(1) + ' kVAr reactive</span></div>' +
'<p class="basis">' + q.basis + '</p>';
} catch (err) { refuse('out-now', err.message); }
const tb = document.querySelector('#pf-table tbody');
try {
const c = E.correctionKvar({ kw, fromPowerFactor: pf0, toPowerFactor: pf1 });
el('out-correction').innerHTML =
'<div class="figure"><span class="q">correction required</span><span class="n">' +
c.value.toFixed(1) + '</span><span class="u">kVAr · releases ' + c.capacityReleasedKva.toFixed(1) +
' kVA (' + c.capacityReleasedPercent.toFixed(1) + '%)</span></div>' +
'<p class="basis">' + c.basis + '</p>';
tb.innerHTML = [
['Power factor', pf0.toFixed(2), pf1.toFixed(2)],
['Real power', kw.toFixed(0) + ' kW', kw.toFixed(0) + ' kW'],
['Reactive power', c.reactiveBeforeKvar.toFixed(1) + ' kVAr', c.reactiveAfterKvar.toFixed(1) + ' kVAr'],
['Apparent power', c.apparentBeforeKva.toFixed(1) + ' kVA', c.apparentAfterKva.toFixed(1) + ' kVA']
].map(r => '<tr><td>' + r[0] + '</td><td class="n">' + r[1] + '</td><td class="n" style="color:#00ff88">' + r[2] + '</td></tr>').join('');
} catch (err) {
refuse('out-correction', err.message);
tb.innerHTML = '';
}
try {
const before = E.againstAgreedCapacity({ kw, powerFactor: pf0, agreedKva: num('agreed') });
let after = null;
try { after = E.againstAgreedCapacity({ kw, powerFactor: pf1, agreedKva: num('agreed') }); } catch (e) {}
el('out-agreed').innerHTML =
'<div class="figure"><span class="q">at ' + pf0.toFixed(2) + '</span><span class="n' +
(before.exceeds ? ' over' : '') + '">' + before.percent.toFixed(1) + '%</span>' +
(after ? '<span class="u">→ at ' + pf1.toFixed(2) + ': ' + after.percent.toFixed(1) + '%' +
(before.exceeds && !after.exceeds ? ' — now inside it' : '') + '</span>' : '') +
'</div><p class="basis">' + before.basis + '</p>';
} catch (err) { refuse('out-agreed', err.message); }
}
try {
const loaded = [];
for (const url of ENGINE_MODULES) loaded.push(await import(url));
// Some engine modules predate the schema convention and declare none. A spec
// says so by passing null, and the check is skipped rather than faked -- an
// asserted schema that does not exist would fail every load for a module that
// is perfectly good.
loaded.forEach((m, i) => {
const expected = ENGINE_SCHEMAS[i];
if (expected && m.schema !== expected) {
throw new Error('unexpected schema ' + m.schema + ' from ' + ENGINE_MODULES[i]);
}
});
// Merge the modules into one namespace. A name collision would silently
// shadow one module's function with another's, so it is refused loudly.
E = {};
const NOT_COMPUTED = {};
// Refusals are not all shaped the same. The newer modules export
// NOT_COMPUTED as an object of named reasons; the older ones export a single
// string, or name their boundaries individually as NOT_A_CAPACITY,
// NO_HEADROOM, NEVER_SUMMED, CAVEAT and so on. Spreading a string into an
// object would render one character per letter, so each shape is handled.
const REFUSAL_NAME = /^(NOT_|NO_|NEVER_|CAVEAT|IMPEDANCE_)/;
for (const m of loaded) {
for (const [k, v] of Object.entries(m)) {
if (k === 'schema' || k === 'requires') continue;
if (k === 'NOT_COMPUTED') {
if (typeof v === 'string') NOT_COMPUTED.notComputed = v;
else Object.assign(NOT_COMPUTED, v);
continue;
}
if (REFUSAL_NAME.test(k) && typeof v === 'string') {
NOT_COMPUTED[k.toLowerCase().replace(/_(.)/g, (_, c) => c.toUpperCase())] = v;
continue;
}
if (k in E) throw new Error('two engine modules both export "' + k + '"');
E[k] = v;
}
}
E.NOT_COMPUTED = NOT_COMPUTED;
statusEl.className = 'status live';
statusEl.textContent = 'ENGINE LIVE — ' +
ENGINE_SCHEMAS.map((sc, i) => sc || ENGINE_MODULES[i].split('/').pop()).join(' + ') +
' · every figure below is computed by the engine module' + (loaded.length > 1 ? 's' : '') + ', not by this page.';
el('refusals').innerHTML = Object.entries(E.NOT_COMPUTED).map(([k, v]) =>
'<dt>' + k.replace(/([A-Z])/g, ' $1').toUpperCase() + '</dt><dd>' + v + '</dd>').join('');
bind();
render();
} catch (err) {
statusEl.className = 'status dead';
statusEl.textContent = 'ENGINE UNREACHABLE — ' + err.message +
'. Nothing on this page is computed; there is deliberately no local copy to fall back to.';
document.querySelectorAll('.out').forEach(o => {
o.innerHTML = '<p class="basis" style="color:#ff8f8f;border:0;padding:0;margin:0">'
+ 'No figure: the engine did not load.</p>'; });
}
</script>
</body>
</html>