In this section
- Layers Panel render · galaxies-wafers / layers-panel.mjs lines 701–914
- Solar energy-data · globalgrid2050 / automation/news/dc_context/solar.py lines 1–251
- Test Solar DC Context test · globalgrid2050 / automation/news/tests/test_solar_dc_context.py lines 1–173
- Model transform · globalgrid2050 / cartridges/202609052155-solar-radiation/model.mjs lines 1–2
- Model Test test · globalgrid2050 / cartridges/202609052155-solar-radiation/model.test.mjs lines 1–2
- Solar energy-data · globalgrid2050 / cartridges/202609052155-solar-radiation/solar.mjs lines 1–3
- Model transform · globalgrid2050 / cartridges/202609052157-solar-scenario/model.mjs lines 1–2
- Model Test test · globalgrid2050 / cartridges/202609052157-solar-scenario/model.test.mjs lines 1–1
- Scenario render · globalgrid2050 / cartridges/202609052157-solar-scenario/scenario.mjs lines 1–2
- Model transform · globalgrid2050 / cartridges/202609052200-solar-periods/model.mjs lines 1–2
- Model Test test · globalgrid2050 / cartridges/202609052200-solar-periods/model.test.mjs lines 1–2
- Retro render · globalgrid2050 / cartridges/202609052200-solar-periods/retro.css lines 1–10
- Solar energy-data · globalgrid2050 / cartridges/202609052200-solar-periods/solar.mjs lines 1–4
Layers Panel
A JavaScript module in Galaxies Wafers covering cables and uses data from the ventus-grid-engine repository. Served with the page at https://ventusltd.github.io/galaxies-wafers/.
rendergalaxies-wafers / layers-panel.mjs · lines 701–914 of 914 (continued from section 53) · Entry point · pattern hydrateTiled (shared by 2 files)
- What it does
- It draws cables. Defines 46 functions or classes, including tileIndexPath, $, fmt, freshState, node. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'panel'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: cables, 11kV.
- Inputs & outputs
- In: data source: ventus-grid-engine data; JSON file index.json. Out: canvas drawing. Voltage levels named: 11kV.
- Downstream impact
- Used directly by 1 file: Galaxies Wafers — Index Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/). Reached from 242 other entry points, including 404 (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/404.html); Galaxies Wafers — Iterations Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/); Galaxies Wafers — Proof Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/proof/). It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/.
- What it achieves
- It builds rows (`buildRows`), paints row (`paintRow`) and paints meter (`paintMeter`). Layers over the wafer, in Grid Atlas's grammar. Its code works with 11 kV. It responds to click and change events.
- Why it matters
- Loaded by the Galaxies Wafers page at https://ventusltd.github.io/galaxies-wafers/.
- Application
- galaxies-wafers · / · JavaScript module
- Uses
- Galaxies Wafers — Lib (import)
- Used by
- loaded by Galaxies Wafers — Index Page (script src)
- Produces
- TILE_OVER, MAX_FETCH, FETCH_TIMEOUT_MS, THIN_STEP, FEATURE_CAP, TILE_SPAN_BANDS, LOADER
- Defines here
- lit, segDist2, pickAt, valueNode, inspect, tileScheme, questions, answer, paint
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 layers-panel.mjs:701-914 · blob 9c5a3ede31cabc7433137da554c7066cb79832c2 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: unknown
ctx.lineJoin = 'round'; ctx.lineCap = 'round';
let keys = 0;
/* routes first, under the points: casing pass then colour pass */
for (const [l, c] of units) {
if (!c.rtFeat.length) continue;
const V = c.verts, B = c.box, S = c.rtStart;
ctx.beginPath();
for (let r = 0; r < c.rtFeat.length; r++) {
if (B[r * 4 + 2] < wx0 || B[r * 4] > wx1 || B[r * 4 + 3] < wy0 || B[r * 4 + 1] > wy1) continue;
const a = S[r], e = S[r + 1] - 1;
ctx.moveTo(V[a * 2] * z + ox, oy - V[a * 2 + 1] * z);
for (let j = a + step; j < e; j += step) ctx.lineTo(V[j * 2] * z + ox, oy - V[j * 2 + 1] * z);
if (e > a) ctx.lineTo(V[e * 2] * z + ox, oy - V[e * 2 + 1] * z);
}
ctx.globalAlpha = 0.85; ctx.strokeStyle = '#000'; ctx.lineWidth = lw + 2.5; ctx.stroke();
ctx.globalAlpha = op; ctx.strokeStyle = l.colour; ctx.lineWidth = lw; ctx.stroke();
}
/* points and route stops: glow, casing, fill; one path each per unit, culled */
const glow = az >= 13.5;
for (const [l, c] of units) {
const glowPath = glow ? new Path2D() : null, casePath = new Path2D(), fillPath = new Path2D();
let shown = 0;
const lit = (X, Y) => {
if (X < -pad || Y < -pad || X > cw + pad || Y > ch + pad) return;
shown++;
if (glow) { glowPath.moveTo(X + rad * 2.4, Y); glowPath.arc(X, Y, rad * 2.4, 0, 6.2832); }
casePath.moveTo(X + rad + cas, Y); casePath.arc(X, Y, rad + cas, 0, 6.2832);
fillPath.moveTo(X + rad, Y); fillPath.arc(X, Y, rad, 0, 6.2832);
};
const P = c.pts;
for (let i = 0; i < c.ptFeat.length; i += step) lit(P[i * 2] * z + ox, oy - P[i * 2 + 1] * z);
const V = c.verts, B = c.box, S = c.rtStart;
for (let r = 0; r < c.rtFeat.length; r++) {
if (B[r * 4 + 2] < wx0 || B[r * 4] > wx1 || B[r * 4 + 3] < wy0 || B[r * 4 + 1] > wy1) continue;
for (let j = S[r]; j < S[r + 1]; j += step) lit(V[j * 2] * z + ox, oy - V[j * 2 + 1] * z);
}
keys += shown;
if (!shown) continue;
if (glow) { ctx.globalAlpha = 0.15; ctx.fillStyle = l.colour; ctx.fill(glowPath); }
ctx.globalAlpha = 1; ctx.fillStyle = '#000'; ctx.fill(casePath);
ctx.globalAlpha = op; ctx.fillStyle = l.colour; ctx.fill(fillPath);
}
ctx.globalAlpha = 1;
LOADER.keysDrawn = keys;
LOADER.rasters++;
if (picked) {
const g = picked.feature.geometry;
ctx.strokeStyle = picked.layer.colour; ctx.lineWidth = 1.4;
const pk = g.type === 'Point' ? [g.key] : g.keys;
const P = placeAll(pk);
for (let i = 0; i < pk.length; i++) {
ctx.beginPath(); ctx.arc(P[i * 2] * z + ox, oy - P[i * 2 + 1] * z, rad + cas + 5, 0, 6.2832); ctx.stroke();
}
}
}
window.__wafer?.onDraw.add(drawOverlay);
/* ── tap to inspect ──────────────────────────────────────────────────────── */
function segDist2(px, py, ax, ay, bx, by) {
const dx = bx - ax, dy = by - ay, L = dx * dx + dy * dy;
const t = L ? Math.max(0, Math.min(1, ((px - ax) * dx + (py - ay) * dy) / L)) : 0;
const qx = ax + t * dx - px, qy = ay + t * dy - py;
return qx * qx + qy * qy;
}
function pickAt(cx, cy) {
const v = liveView();
if (!v || !v.zoom) return null;
const z = v.zoom, ox = v.w / 2 - v.x * z, oy = v.h / 2 + v.y * z;
let best = null, bestD = PICK_REACH * PICK_REACH;
for (const [l, c, doc] of drawUnits(v)) {
for (let i = 0; i < c.ptFeat.length; i++) {
const X = c.pts[i * 2] * z + ox, Y = oy - c.pts[i * 2 + 1] * z;
const d = (X - cx) ** 2 + (Y - cy) ** 2;
if (d < bestD) { bestD = d; best = { layer: l, feature: doc.features[c.ptFeat[i]] }; }
}
const V = c.verts, S = c.rtStart;
for (let r = 0; r < c.rtFeat.length; r++) {
const a = S[r], e = S[r + 1];
let px = V[a * 2] * z + ox, py = oy - V[a * 2 + 1] * z;
let d = (px - cx) ** 2 + (py - cy) ** 2;
for (let j = a + 1; j < e; j++) {
const qx = V[j * 2] * z + ox, qy = oy - V[j * 2 + 1] * z;
d = Math.min(d, segDist2(cx, cy, px, py, qx, qy));
px = qx; py = qy;
}
if (d < bestD) { bestD = d; best = { layer: l, feature: doc.features[c.rtFeat[r]] }; }
}
}
return best;
}
function valueNode(val) {
const dd = node('dd');
if (val !== null && typeof val === 'object' && !Array.isArray(val) && typeof val.meaning === 'string') {
const rest = Object.entries(val).filter(([k]) => k !== 'meaning')
.map(([k, x]) => (Array.isArray(x) ? x.join(', ') : (x !== null && typeof x === 'object' ? JSON.stringify(x) : String(x))));
dd.append(node('div', rest.join(' · ')), node('div', val.meaning, 'lmeaning'));
return dd;
}
dd.textContent = val !== null && typeof val === 'object' ? JSON.stringify(val) : String(val);
return dd;
}
function inspect(hit) {
picked = hit;
const box = $('layersInspect');
box.replaceChildren();
if (!hit) { box.hidden = true; drawOverlay(); return; }
const { layer: l, feature: f } = hit;
const close = node('button', '✕');
close.id = 'layersInspectClose'; close.type = 'button'; close.setAttribute('aria-label', 'close');
close.addEventListener('click', () => inspect(null));
const h = node('h3', l.label); h.style.color = l.colour;
const g = f.geometry;
const where = node('div', g.type === 'Point' ? `line ${g.key}` : `lines ${g.keys.join(' → ')}`, 'lnote');
const dl = node('dl');
for (const [k, val] of Object.entries(f.properties || {})) dl.append(node('dt', k), valueNode(val));
const ev = node('div', 'evidence: ' + (l.evidence ?? 'none recorded'), 'lnote');
box.append(close, h, where, dl, ev);
box.hidden = false;
$('layersBody').hidden = false;
drawOverlay();
}
/* The tap belongs to the code card in app.mjs (iterations/31-code-card-everywhere/
layers-panel.mjs). What lies under a finger is answered here and nothing else.
The root's old listener opened #layersBody under the finger, and that same
tap's click could then tick a checkbox (iterations/21-dark-pixels notes). */
let tileSchemePromise = null;
function tileScheme() {
const id = tileSet ? Object.keys(tileSet.layers)[0] : null;
if (!id) return Promise.resolve(null);
tileSchemePromise ||= fetchJSON(tileSet.layers[id])
.then(ix => ix.scheme?.S ? { S: ix.scheme.S, law: ix.scheme.law, layer: id, path: tileSet.layers[id].replace(/^\.\//, '') } : null)
.catch(e => { tileSchemePromise = null; throw e; });
return tileSchemePromise;
}
window.__layers = Object.freeze({ pickAt, inspect, tileScheme });
/* ── Questions and machine detail ────────────────────────────────────────────
After iterations/22-fast-zoom/questions.mjs, answered for this root page.
Counts are read at run time from the manifest and the live wafer; function
names and files are cited from this directory's own source. */
function questions(big) {
const dl = $('qlist'), machine = $('machine');
if (!dl || !machine) return;
const answer = (q, a) => { dl.append(node('dt', q), node('dd', a)); };
const sld = manifest.layers.filter(l => /sld/i.test(l.id));
dl.replaceChildren();
answer('1 · How does this help draw a system or a single-line diagram?',
'The page itself draws no busbar, feeder, transformer, cable route, protection or earthing: it is the surface such code is found on. ' +
(sld.length
? `Of ${fmt(manifest.layers.length)} layers in layers/manifest.json, ${sld.length} carry "sld" in their id (name-match inference): ` +
sld.map(l => `${l.id} (${fmt(l.features)} features)`).join(', ') + '. '
: `None of the ${fmt(manifest.layers.length)} layers in layers/manifest.json carries "sld" in its id. `) +
'Tap a line of an engine module and its code card names the element that module feeds (for example engine/voltage-drop.js, voltageDropVolts: cable route), ' +
'from the card\'s module-to-element table checked against the fetched source at its commit; other code reads "none yet".');
answer('2 · What is this code used for?',
'Reading the estate\'s numbered code at speed. app.mjs: render(), blitCache(), rasterCache(), visibleRange() (moving-frame cache and radius-band culling, from iterations/22-fast-zoom); ' +
'cardTap(), openLine(), openRoute(), openArea(), runPanel() (code cards and the local digit edit, from iterations/31-code-card-everywhere); setGround() (dark ground, from iterations/21-dark-pixels). ' +
'layers-panel.mjs: fetchJSON(), makeRoom(), updateTiles(), buildCache(), drawOverlay(), drawDark(), pickAt(). ' +
'Called by: the browser opening this root page; no page under iterations/ imports ../../app.mjs or ../../layers-panel.mjs (searched in the source).');
answer('3 · Where does it lead next?',
'From a line: its code card\'s "leads to" row, the family\'s recorded uses and the register\'s depends_on for its block (name-match inference by the modular star build). ' +
'From the page as a whole: not established, because it carries no electrical element of its own to connect onward.');
const paint = () => {
const w = window.__wafer?.stats;
const L = window.__waferLayers?.stats;
machine.textContent = 'Machine detail · inputs: wheel deltaY and pointer positions (CSS px); layer files of permanent line keys (dimensionless); the ground toggle (lit or dark) · ' +
`outputs: ${w ? `${fmt(w.drawn)} of ${fmt(w.total)} points in the last wafer draw, ${fmt(w.rasters)} cache rasters` : 'waiting for the wafer'}; ` +
(L ? `${fmt(L.held)} of ${fmt(L.cap)} features in memory, ${fmt(L.bandsInMemory)} bands, ${fmt(L.keysDrawn)} keys in the last overlay frame, ${fmt(L.evictions)} released · ` : '') +
`ground: ${window.__wafer?.dark ? 'dark, only charted keys lit' : 'lit (default)'} · ` +
`refusals: REFUSED above ${fmt(FEATURE_CAP)} features in memory, FAIL with its HTTP status or a ${FETCH_TIMEOUT_MS / 1000} s timeout, EMPTY with the layer's reason; ` +
`layers over ${fmt(TILE_OVER)} features (${big.length ? big.map(l => l.id).join(', ') : 'none today'}) by radius band only · ` +
`moving frames keep every ${THIN_STEP}th layer vertex; at most ${MAX_FETCH} layer fetches at once · source: this directory's app.mjs and layers-panel.mjs`;
};
paint();
setInterval(() => { if ($('questions')?.open) paint(); }, 500);
}
/* Read-only numbers for the Questions panel and for tests. */
window.__waferLayers = Object.freeze({
get stats() {
let bands = 0;
if (manifest) for (const s of state.values()) if (s.tiles) bands += s.tiles.bands.filter(b => b.loaded && b.m.features).length;
return Object.freeze({ held: manifest ? heldFeatures() : 0, cap: FEATURE_CAP, bandsInMemory: bands, evictions: LOADER.evictions,
keysDrawn: LOADER.keysDrawn, fetches: LOADER.fetches, overlayRasters: LOADER.rasters, overlayCarried: LOADER.carried, active: queue.active, queued: queue.waiting.length });
}
});
(async () => {
try {
const m = await fetchJSON(ROOT + 'layers/manifest.json');
urlCache.delete(ROOT + 'layers/manifest.json');
manifest = m;
const big = manifest.layers.filter(l => (Number(l.features) || 0) > TILE_OVER);
tileSet = { tile_over: TILE_OVER, layers: Object.fromEntries(big.map(l => [l.id, tileIndexPath(l.id)])) };
for (const l of manifest.layers) state.set(l.id, freshState());
buildRows();
$('layersRule').textContent =
`tiles: a layer over ${fmt(TILE_OVER)} features (today ${big.length ? big.map(l => l.id).join(', ') : 'none'}) loads by radius band from layers/tiles/<id>/index.json ` +
`(band = isqrt(key) ÷ S, S read from that index), only bands on screen, from the zoom where the screen spans ${TILE_SPAN_BANDS} bands; ` +
`at the ceiling hidden layers, then bands off screen, are released`;
questions(big);
paintMeter();
for (const l of manifest.layers) if (l.preload) toggle(l, true);
readLayersFromURL();
} catch (e) {
$('layersList').replaceChildren(node('div', `Layers unavailable: ${e.message}. The wafer itself is unaffected.`, 'lnote'));
}
})();Solar
A Python command-line tool in the dc context folder of GlobalGrid2050 that reads solar, using SHA-256.
energy-dataglobalgrid2050 / automation/news/dc_context/solar.py · lines 1–251 of 251 · Entry point · pattern verify_source_bytes (shared by 2 files)
- What it does
- It loads solar. Defines 12 functions or classes, including _require, _object, _text, _id, _time. Uses libraries __future__, argparse, copy, datetime, hashlib. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'dc'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Inputs & outputs
- In: command-line arguments.
- Downstream impact
- Used directly by 3 files: Test Solar DC Context (globalgrid2050); Build Transition Context (globalgrid2050); Test Transition Context (globalgrid2050). Reached from 2 other entry points, including GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (globalgrid2050); GlobalGrid2050 Project Signals Acid Workflow (globalgrid2050).
- What it achieves
- It verifies source bytes (`verify_source_bytes`) and is built from the dumps step (`dumps`) and the build step (`build`). Offline `solar/storage/procurement` context, preserving source scope and bounds. It accepts `--input`, `--as-of` and `--output`.
- Why it matters
- Imported by Build Transition Context. Checked by 2 tests, including Test Solar DC Context.
- Application
- globalgrid2050 · automation/news/dc_context · Python CLI
- Uses
- Contracts (import), __future__, argparse, copy, datetime, hashlib, json, pathlib, re
- Used by
- imported by Test Solar DC Context (import), imported by Build Transition Context (import), imported by Test Transition Context (import)
- Produces
- dumps, verify_source_bytes, build, main
- Defines here
- _require, _object, _text, _id, _time, _day, dumps, verify_source_bytes, _source, _context, build, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/news/dc_context/solar.py:1-251 · blob 2542cc25db28f6308090fb485a6d0ad409d9ac50 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
"""Offline solar/storage/procurement context, preserving source scope and bounds.
No fetch, extraction, site matching, financial aggregation or verification claim.
The shared FIGURES contract owns numerical validation; this adapter binds those
claims to source receipts and explicit context. See SOLAR.md for the interface.
"""
from __future__ import annotations
import argparse
from copy import deepcopy
from datetime import date, datetime
import hashlib
import json
from pathlib import Path
import re
from urllib.parse import urlsplit
from automation.news.filings.contracts import validate_claim
INPUT_SCHEMA = "globalgrid2050.solar-dc-context-input.v1"
SCHEMA = "globalgrid2050.solar-dc-context.v1"
_ID = re.compile(r"[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}\Z")
_HOSTS = {
"www.epa.gov": "ISSUER_PRESENTATION_GOVERNMENT_HOSTED",
"www.googlecloudpresscorner.com": "ISSUER_RELEASE",
"www.sma-uk.com": "SUPPLIER_CASE_STUDY",
}
_SOURCE_KEYS = {"id", "document_id", "url", "publisher", "title", "authority",
"published_date", "retrieved_at", "http_status", "bytes", "sha256",
"access_state", "output_policy"}
_CONTEXT_KEYS = {"id", "name", "country", "entity", "source_id", "section", "page",
"relationship", "source_state", "source_as_of", "numeric_claims",
"figures_omitted_reason", "scope_note"}
_ENTITY_KEYS = {"id", "scope", "consolidation_group_id", "identity_evidence_url"}
_KINDS = {
"solar_procurement": {"generation_power", "generation_energy", "energy_procurement"},
"storage_procurement": {"storage_power", "storage_energy"},
"portfolio_storage_access": {"storage_power", "storage_energy"},
"onsite_solar_ppa": {"generation_power", "generation_energy", "energy_procurement"},
"procurement_finance": {"finance"},
}
_ACTIONS = {
"solar_procurement": "Check delivery, named supply assets and allocation; contracted generation is not data-centre demand.",
"storage_procurement": "Check delivery, shared rights and duration separately; MW does not establish MWh or site allocation.",
"portfolio_storage_access": "Identify contracted storage assets and allocations; portfolio access does not establish onsite batteries.",
"onsite_solar_ppa": "Check current operation and reconcile source capacity labels before using a numeric site rating.",
"procurement_finance": "Retain funding stage and entity scope; do not allocate group funding to individual sites.",
}
def _require(ok, message):
if not ok:
raise ValueError(message)
def _object(value, keys, field):
_require(isinstance(value, dict) and set(value) == keys, field + ": unexpected fields")
def _text(value, field, limit=500):
_require(isinstance(value, str) and 0 < len(value) <= limit and value == value.strip()
and not any(ord(c) < 32 or ord(c) == 127 or 0xD800 <= ord(c) <= 0xDFFF or c in "<>"
for c in value), field + ": invalid plain text")
def _id(value, field):
_require(isinstance(value, str) and bool(_ID.fullmatch(value)), field + ": invalid identifier")
def _time(value):
_require(isinstance(value, str) and bool(re.fullmatch(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z", value)),
"Explicit UTC timestamp required")
return datetime.fromisoformat(value.replace("Z", "+00:00"))
def _day(value):
_require(isinstance(value, str) and bool(re.fullmatch(r"\d{4}-\d{2}-\d{2}", value)), "Exact source day required")
return date.fromisoformat(value)
def dumps(value):
return json.dumps(value, sort_keys=True, ensure_ascii=False, indent=2, allow_nan=False) + "\n"
def verify_source_bytes(source, raw):
"""Verify an explicitly supplied response; never fetch or retain its body."""
_require(isinstance(raw, bytes) and 0 < len(raw) <= 4 * 1024 * 1024, "Bounded source bytes required")
_require(len(raw) == source["bytes"] and hashlib.sha256(raw).hexdigest() == source["sha256"],
"Source bytes do not match receipt")
def _source(source, clock):
_object(source, _SOURCE_KEYS, "source")
for key in ("id", "document_id"):
_id(source[key], key)
for key in ("publisher", "title"):
_text(source[key], key)
url = source["url"]
_text(url, "url", 2048)
parsed = urlsplit(url)
_require(url.isascii() and "\\" not in url and not any(c.isspace() for c in url)
and parsed.scheme == "https" and parsed.netloc in _HOSTS
and parsed.path.startswith("/") and not parsed.query and not parsed.fragment,
"Unsupported primary source URL")
_require(source["authority"] == _HOSTS[parsed.netloc], "Source authority/host mismatch")
_require(type(source["http_status"]) is int and source["http_status"] == 200, "Successful source receipt required")
_require(type(source["bytes"]) is int and 0 < source["bytes"] <= 4 * 1024 * 1024, "Invalid source byte count")
_require(isinstance(source["sha256"], str) and bool(re.fullmatch(r"[a-f0-9]{64}", source["sha256"])), "Invalid source digest")
_require(source["access_state"] == "OPEN_OBSERVED" and source["output_policy"] == "FACT_METADATA_ONLY",
"Unsupported source output policy")
retrieved = _time(source["retrieved_at"])
_require(retrieved <= clock, "Future source retrieval")
if source["published_date"] is not None:
_require(_day(source["published_date"]) <= retrieved.date(), "Future source publication")
def _context(context, source, clock):
_object(context, _CONTEXT_KEYS, "context")
for key in ("id", "source_id"):
_id(context[key], key)
for key in ("name", "scope_note"):
_text(context[key], key)
for key in ("page", "section", "figures_omitted_reason"):
if context[key] is not None:
_text(context[key], key)
_require(context["page"] is not None or context["section"] is not None, "Source locator required")
_require(context["country"] in ("GB", "US"), "Unsupported source geography")
relation = context["relationship"]
_require(isinstance(relation, str) and relation in _KINDS, "Unsupported relationship; proximity is not procurement")
state = context["source_state"]
_require(state in ("ANNOUNCED", "AGREEMENT_REPORTED", "COMMISSIONED_REPORTED", "COMMITTED", "DISBURSED"),
"Unsupported source state")
_require(relation == "procurement_finance" or state not in ("COMMITTED", "DISBURSED"), "Funding stage on electrical context")
_require(relation != "procurement_finance" or state in ("ANNOUNCED", "COMMITTED", "DISBURSED"), "Unsupported funding stage")
_text(context["source_as_of"], "source_as_of", 10)
_require(bool(re.fullmatch(r"\d{4}(?:-\d{2}(?:-\d{2})?)?", context["source_as_of"])), "Source date precision required")
parts = [int(x) for x in context["source_as_of"].split("-")]
source_day = date(*parts, *([1] * (3 - len(parts))))
_require(source_day <= _time(source["retrieved_at"]).date(), "Source context cannot be a future observation")
entity = context["entity"]
_object(entity, _ENTITY_KEYS, "entity")
_id(entity["id"], "entity.id")
_require(entity["scope"] in ("issuer", "consolidated_group", "project", "site", "campus", "phase"), "Unsupported entity scope")
_require(entity["identity_evidence_url"] == source["url"], "Entity identity must retain supporting source")
_require(entity["consolidation_group_id"] is None or entity["consolidation_group_id"] == entity["id"],
"No inferred corporate association")
_require((entity["scope"] == "consolidated_group") == (entity["consolidation_group_id"] == entity["id"]),
"Group identity mismatch")
if relation == "portfolio_storage_access":
_require(entity["scope"] in ("issuer", "consolidated_group", "project"), "Portfolio storage cannot become site storage")
if relation == "onsite_solar_ppa":
_require(entity["scope"] in ("site", "campus", "phase"), "Onsite relationship requires named site scope")
if relation == "procurement_finance":
_require(entity["scope"] == "consolidated_group", "Corporate finance must remain at evidenced parent-group scope")
figures = context["numeric_claims"]
_require(isinstance(figures, list) and len(figures) <= 20, "Bounded figures required")
_require(bool(figures) == (context["figures_omitted_reason"] is None), "Explain omitted figures; do not invent zero")
result = []
for wrapped in figures:
_object(wrapped, {"claim", "qualifier"}, "numeric claim")
_require(wrapped["qualifier"] in ("stated", "upper_bound", "approximate"), "Explicit numerical qualifier required")
claim = validate_claim(wrapped["claim"])
_require(claim["entity"] == entity, "Figure entity/scope mismatch")
_require(claim["quantity_kind"] in _KINDS[relation], "Figure kind does not match context")
_require(claim["assurance"] != "audited", "Current primary sources do not establish audited numerical assurance")
if state == "COMMISSIONED_REPORTED":
_require(claim["basis"] == "reported", "Commissioned context cannot use forecast figure")
if relation == "procurement_finance":
_require(claim["finance_stage"] == state.lower(), "Funding stage mismatch")
if claim["basis"] == "reported":
# Fresh retrieval must not turn a historical target into an actual.
for observed in (claim["as_of"], (claim["reporting_period"] or {}).get("end")):
if observed is not None:
components = [int(x) for x in observed.split("-")]
observed_day = date(*components, *([1] * (3 - len(components))))
_require(observed_day <= source_day, "Reported figure postdates source observation")
provenance = claim["provenance"]
for a, b in (("document_id", "document_id"), ("document_url", "url"), ("sha256", "sha256"),
("published_date", "published_date"), ("retrieved_at", "retrieved_at")):
_require(provenance[a] == source[b], "Figure/source receipt mismatch")
_require(provenance["page"] == context["page"] and provenance["section"] == context["section"], "Figure locator mismatch")
result.append({"claim": claim, "qualifier": wrapped["qualifier"]})
return sorted(result, key=lambda f: f["claim"]["claim_id"])
def build(bundle, *, as_of, source_bytes=None):
"""Produce provisional rows; optional response bytes verify hashes, not facts."""
_object(bundle, {"schema", "sources", "contexts"}, "bundle")
_require(bundle["schema"] == INPUT_SCHEMA, "Unsupported input schema")
clock = _time(as_of)
_require(isinstance(bundle["sources"], list) and 0 < len(bundle["sources"]) <= 100, "Bounded nonempty sources required")
_require(isinstance(bundle["contexts"], list) and 0 < len(bundle["contexts"]) <= 1000, "Bounded nonempty contexts required")
sources, documents = {}, set()
for source in bundle["sources"]:
_source(source, clock)
_require(source["id"] not in sources and source["document_id"] not in documents, "Duplicate source identity")
sources[source["id"]] = source
documents.add(source["document_id"])
if source_bytes is not None:
_require(isinstance(source_bytes, dict) and set(source_bytes) == set(sources), "Source byte coverage must be complete")
for key, source in sources.items():
verify_source_bytes(source, source_bytes[key])
records, ids, claims = [], set(), set()
for context in bundle["contexts"]:
_object(context, _CONTEXT_KEYS, "context")
_require(isinstance(context["source_id"], str) and context["source_id"] in sources, "Missing context source")
source = sources[context["source_id"]]
figures = _context(context, source, clock)
_require(context["id"] not in ids, "Duplicate context identity")
ids.add(context["id"])
for figure in figures:
claim_id = figure["claim"]["claim_id"]
_require(claim_id not in claims, "Duplicate numerical claim")
claims.add(claim_id)
record = deepcopy(context)
record.update(numeric_claims=figures, status="PROVISIONAL", source=deepcopy(source),
canonical_project_id=None, canonical_binding="UNLINKED",
current_delivery="UNKNOWN", current_site_supply_mw=None,
current_storage_energy_mwh=None, research_action=_ACTIONS[context["relationship"]],
source_document_age_days=None if source["published_date"] is None else
(clock.date() - _day(source["published_date"])).days)
records.append(record)
normalized = {"schema": INPUT_SCHEMA, "sources": sorted(deepcopy(bundle["sources"]), key=lambda s: s["id"]),
"contexts": sorted(deepcopy(bundle["contexts"]), key=lambda c: c["id"])}
return {"schema": SCHEMA, "as_of": as_of, "context_count": len(records), "numeric_claim_count": len(claims),
"input_sha256": hashlib.sha256(dumps(normalized).encode()).hexdigest(),
"source_byte_validation": "MATCHED_SUPPLIED_BYTES" if source_bytes is not None else "RECEIPTS_ONLY",
"coverage": "BOUNDED_PRIMARY_SOURCE_SLICE", "linked_project_count": 0,
"records": sorted(records, key=lambda r: r["id"]),
"limitations": ["Dated source claims are provisional; present delivery is unknown.",
"No canonical site crosswalk, proximity inference, quantity allocation or aggregation.",
"Receipt hashes identify observed bytes, not source truth or publication rights."]}
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--input", type=Path, required=True)
parser.add_argument("--as-of", required=True)
parser.add_argument("--output", type=Path)
args = parser.parse_args()
_require(args.input.stat().st_size <= 4 * 1024 * 1024, "Input exceeds bound")
result = dumps(build(json.loads(args.input.read_text(encoding="utf-8")), as_of=args.as_of))
if args.output:
with args.output.open("x", encoding="utf-8", newline="\n") as handle:
handle.write(result)
else:
print(result, end="")
if __name__ == "__main__":
main()Test Solar DC Context
A test in the tests folder of GlobalGrid2050 that checks Solar, using SHA-256. It is built from the bundle step (`bundle`) and the claim step (`claim`).
testglobalgrid2050 / automation/news/tests/test_solar_dc_context.py · lines 1–173 of 173 · Entry point · pattern test_cli_writes_new_artifact_and_refuses_overwrite (shared by 2 files)
- What it does
- It tests its inputs. Defines 10 functions or classes, including bundle, claim, test_real_receipt_slice_preserves_forecast_bounds_and_source_scope, test_deterministic_order_and_json, test_rejects_scope_unit_proximity_source_and_verification_tampering. Uses libraries copy, hashlib, json, pathlib, subprocess. Side effects: reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'dc'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Inputs & outputs
- In: JSON file solar-context.json; JSON file context.json.
- Downstream impact
- Used directly by 2 files: GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (globalgrid2050); GlobalGrid2050 Project Signals Acid Workflow (globalgrid2050).
- What it achieves
- Offline primary-source fixture and adversarial solar/DC scope tests.
- Why it matters
- Run by GlobalGrid2050 Pipeline Project Evidence Weekly Workflow and GlobalGrid2050 Project Signals Acid Workflow.
- Application
- globalgrid2050 · automation/news/tests · test
- Uses
- Solar (import), copy, hashlib, json, pathlib, subprocess, sys, pytest
- Used by
- run by GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (workflow run), run by GlobalGrid2050 Project Signals Acid Workflow (workflow run)
- Produces
- bundle, claim, test_real_receipt_slice_preserves_forecast_bounds_and_source_scope, test_deterministic_order_and_json, test_rejects_scope_unit_proximity_source_and_verification_tampering, test_all_supplied_source_bytes_required_and_checked, test_source_receipt_rejects_wrong_bytes, test_empty_coverage_is_not_success, test_parent_finance_stays_exact_and_stage_specific, test_cli_writes_new_artifact_and_refuses_overwrite
- Defines here
- bundle, claim, test_real_receipt_slice_preserves_forecast_bounds_and_source_scope, test_deterministic_order_and_json, test_rejects_scope_unit_proximity_source_and_verification_tampering, test_all_supplied_source_bytes_required_and_checked, test_source_receipt_rejects_wrong_bytes, test_empty_coverage_is_not_success, test_parent_finance_stays_exact_and_stage_specific, test_cli_writes_new_artifact_and_refuses_overwrite
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/news/tests/test_solar_dc_context.py:1-173 · blob 83a5714c7cfc3cd1544d77c32e2d7a9e413b6503 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
"""Offline primary-source fixture and adversarial solar/DC scope tests."""
from copy import deepcopy
import hashlib
import json
from pathlib import Path
import subprocess
import sys
import pytest
from automation.news.dc_context.solar import build, dumps, verify_source_bytes
FIXTURE = Path(__file__).resolve().parents[1] / "dc_context/fixtures/solar-context.json"
NOW = "2026-11-16T17:30:00Z"
@pytest.fixture
def bundle():
return json.loads(FIXTURE.read_text(encoding="utf-8"))
def claim(bundle, index=0):
return bundle["contexts"][index]["numeric_claims"][0]["claim"]
def test_real_receipt_slice_preserves_forecast_bounds_and_source_scope(bundle):
original = deepcopy(bundle)
output = build(bundle, as_of=NOW)
assert output["context_count"] == 4
assert output["numeric_claim_count"] == 2
assert output["linked_project_count"] == 0
assert output["source_byte_validation"] == "RECEIPTS_ONLY"
by_id = {r["id"]: r for r in output["records"]}
solar = by_id["solar:google-nevada-2021"]["numeric_claims"][0]
battery = by_id["storage:google-nevada-2021"]["numeric_claims"][0]
assert solar["claim"]["value"] == "350"
assert battery["claim"]["value"] == "280"
assert battery["qualifier"] == "upper_bound"
assert battery["claim"]["quantity_kind"] == "storage_power"
assert battery["claim"]["unit"] == "MW"
assert battery["claim"]["basis"] == "forecast"
assert battery["claim"]["as_of"] == "2024"
assert by_id["storage:google-uk-shell-2025"]["entity"]["scope"] == "issuer"
livingston = by_id["solar:sma-iron-mountain-livingston"]
assert livingston["numeric_claims"] == []
assert livingston["source_document_age_days"] is None
assert livingston["source_as_of"] == "2020-03"
assert "unresolved" in livingston["figures_omitted_reason"]
for row in output["records"]:
assert row["status"] == "PROVISIONAL"
assert row["current_delivery"] == "UNKNOWN"
assert row["canonical_project_id"] is None
assert row["current_site_supply_mw"] is None
assert row["current_storage_energy_mwh"] is None
assert bundle == original
output["records"][0]["source"]["title"] = "mutation"
assert bundle == original
def test_deterministic_order_and_json(bundle):
expected = dumps(build(bundle, as_of=NOW))
bundle["sources"].reverse()
bundle["contexts"].reverse()
assert dumps(build(bundle, as_of=NOW)) == expected
@pytest.mark.parametrize("mutation", [
lambda b: b.update(body="private hidden payload"),
lambda b: b["contexts"][0].update(canonical_project_id="repd:1018"),
lambda b: b["contexts"][0].update(relationship="nearby_solar"),
lambda b: b["contexts"][0].update(source_state="VERIFIED"),
lambda b: b["contexts"][0].update(source_id="missing"),
lambda b: b["contexts"][0].update(section=None, page=None),
lambda b: b["contexts"][0].update(name="<script>"),
lambda b: b["contexts"][0].update(source_as_of="2027-01-01"),
lambda b: b["contexts"][0].update(numeric_claims=[], figures_omitted_reason=None),
lambda b: b["contexts"][0].update(figures_omitted_reason="unknown"),
lambda b: b["contexts"][2]["entity"].update(scope="site"),
lambda b: b["contexts"][3]["entity"].update(scope="issuer"),
lambda b: b["sources"][0].update(http_status=403),
lambda b: b["sources"][0].update(http_status=True),
lambda b: b["sources"][0].update(bytes=0),
lambda b: b["sources"][0].update(retrieved_at="2026-12-01T00:00:00Z"),
lambda b: b["sources"][0].update(published_date="2027-01-01"),
lambda b: b["sources"][0].update(sha256="bad"),
lambda b: b["sources"][0].update(url="https://www.epa.gov.evil.example/document"),
lambda b: b["sources"][0].update(url="https://127.0.0.1/document"),
lambda b: b["sources"][0].update(authority="GOVERNMENT_VERIFIED"),
lambda b: b["sources"][0].update(output_policy="FULL_BODY"),
lambda b: b["sources"].append(deepcopy(b["sources"][0])),
lambda b: b["contexts"].append(deepcopy(b["contexts"][0])),
lambda b: claim(b).update(status="VERIFIED"),
lambda b: claim(b).update(value=350.0),
lambda b: claim(b).update(value="NaN"),
lambda b: claim(b).update(quantity_kind="it_load"),
lambda b: claim(b).update(basis="reported"),
lambda b: claim(b).update(assurance="audited"),
lambda b: claim(b)["entity"].update(scope="site"),
lambda b: claim(b)["provenance"].update(sha256="0" * 64),
lambda b: claim(b)["provenance"].update(section="Another scope"),
lambda b: claim(b, 1).update(unit="MWh"),
lambda b: b["contexts"][1]["numeric_claims"][0].update(qualifier=None),
lambda b: b["contexts"][1]["numeric_claims"][0].pop("qualifier"),
])
def test_rejects_scope_unit_proximity_source_and_verification_tampering(bundle, mutation):
mutation(bundle)
with pytest.raises(ValueError):
build(bundle, as_of=NOW)
def test_all_supplied_source_bytes_required_and_checked(bundle):
# Explicit synthetic bytes test the contract; not replacements for real receipts.
supplied = {}
for source in bundle["sources"]:
raw = ("SYNTHETIC SOURCE " + source["id"]).encode()
supplied[source["id"]] = raw
source.update(bytes=len(raw), sha256=hashlib.sha256(raw).hexdigest())
for context in bundle["contexts"]:
if context["source_id"] == source["id"]:
for figure in context["numeric_claims"]:
figure["claim"]["provenance"]["sha256"] = source["sha256"]
result = build(bundle, as_of=NOW, source_bytes=supplied)
assert result["source_byte_validation"] == "MATCHED_SUPPLIED_BYTES"
assert "SYNTHETIC SOURCE" not in dumps(result)
with pytest.raises(ValueError, match="coverage"):
build(bundle, as_of=NOW, source_bytes={})
supplied[next(iter(supplied))] += b"tamper"
with pytest.raises(ValueError, match="bytes"):
build(bundle, as_of=NOW, source_bytes=supplied)
def test_source_receipt_rejects_wrong_bytes(bundle):
with pytest.raises(ValueError, match="receipt"):
verify_source_bytes(bundle["sources"][0], b"not observed publisher bytes")
def test_empty_coverage_is_not_success(bundle):
bundle["contexts"] = []
with pytest.raises(ValueError, match="nonempty"):
build(bundle, as_of=NOW)
def test_parent_finance_stays_exact_and_stage_specific(bundle):
# Entirely synthetic finance example; no real financial claim is asserted.
context = bundle["contexts"][0]
context.update(relationship="procurement_finance", source_state="ANNOUNCED")
context["entity"].update(scope="consolidated_group", id="group:synthetic",
consolidation_group_id="group:synthetic")
c = claim(bundle)
c.update(quantity_kind="finance", metric="Synthetic planned procurement funding",
value="1.2300", scale="1e9", unit="currency", original_unit="billion USD",
currency="USD", finance_stage="announced", entity=deepcopy(context["entity"]))
result = build(bundle, as_of=NOW)
result_claim = next(r for r in result["records"] if r["id"] == context["id"])["numeric_claims"][0]["claim"]
assert result_claim["value"] == "1.2300"
assert result_claim["scale"] == "1e9"
assert result_claim["currency"] == "USD"
assert result_claim["finance_stage"] == "announced"
c["finance_stage"] = "disbursed"
with pytest.raises(ValueError, match="Funding stage"):
build(bundle, as_of=NOW)
def test_cli_writes_new_artifact_and_refuses_overwrite(tmp_path):
output = tmp_path / "context.json"
args = [sys.executable, "-m", "automation.news.dc_context.solar", "--input", str(FIXTURE),
"--as-of", NOW, "--output", str(output)]
completed = subprocess.run(args, capture_output=True, text=True)
assert completed.returncode == 0, completed.stderr
before = output.read_bytes()
assert json.loads(before)["context_count"] == 4
assert subprocess.run(args, capture_output=True).returncode != 0
assert output.read_bytes() == beforeModel
A JavaScript module in the cartridges folder of GlobalGrid2050 that works with solar energy (`solarEnergy`). It is built from the solar energy helper (`solarEnergy`).
transformglobalgrid2050 / cartridges/202609052155-solar-radiation/model.mjs · lines 1–2 of 2 · version 2026-09-05 21:55
- What it does
- It calculates its inputs. Defines solarEnergy.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Model (globalgrid2050). Reached from 33 other entry points, including Homepage V062 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v062.html); Homepage V063 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v063.html); Homepage V064 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v064.html).
- What it achieves
- Defines `solarEnergy`.
- Why it matters
- Imported by a file of the same name.
- Application
- globalgrid2050 · cartridges/202609052155-solar-radiation · JavaScript module
- Uses
- none found
- Used by
- imported by Model (import)
- Produces
- irradiance, solarEnergy
- Defines here
- solarEnergy
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052155-solar-radiation/model.mjs:1-2 · blob aca703fd502b994001c39fe9025688f4d9ed7b0c · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
export const irradiance=1361,radiusM=6371000;
export function solarEnergy(seconds){if(!Number.isFinite(seconds)||seconds<0)throw Error('Invalid duration');return irradiance*Math.PI*radiusM**2*seconds/3.6e9;}Model Test
A test in the cartridges folder of GlobalGrid2050 covering solar.
testglobalgrid2050 / cartridges/202609052155-solar-radiation/model.test.mjs · lines 1–2 of 2 · version 2026-09-05 21:55 · Entry point
- What it does
- It tests solar. Uses libraries node:test.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Open Energy Cartridge Workflow (globalgrid2050).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Run by GlobalGrid2050 Open Energy Cartridge Workflow.
- Application
- globalgrid2050 · cartridges/202609052155-solar-radiation · test
- Uses
- node:test
- Used by
- run by GlobalGrid2050 Open Energy Cartridge Workflow (workflow run)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052155-solar-radiation/model.test.mjs:1-2 · blob 64ad8c34d93bcd4e7f1667b4e98ca7272adbb8b3 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import test from 'node:test';import assert from 'node:assert/strict';import {solarEnergy} from './model.mjs';
test('incoming solar energy uses disk area, not four times surface area',()=>{assert.equal(solarEnergy(0),0);assert.ok(solarEnergy(1)>48e6&&solarEnergy(1)<49e6);assert.ok(Math.abs(solarEnergy(60)-60*solarEnergy(1))<1e-5);assert.throws(()=>solarEnergy(-1));});Solar
A JavaScript module in the cartridges folder of GlobalGrid2050 covering solar.
energy-dataglobalgrid2050 / cartridges/202609052155-solar-radiation/solar.mjs · lines 1–3 of 3 · version 2026-09-05 21:55 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 1 file: Homepage V061 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v061.html).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Loaded by the Homepage V061 page at https://globalgrid2050.com/homepage_versions/homepage_v061.html.
- Application
- globalgrid2050 · cartridges/202609052155-solar-radiation · JavaScript module
- Uses
- Runtime (import)
- Used by
- loaded by Homepage V061 (script src)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052155-solar-radiation/solar.mjs:1-3 · blob c6630ae23cd4daed5215cb3f01557173a730ac99 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import {animate,minute,row} from '../202609052154-minute-runtime/runtime.mjs';import {solarEnergy} from './model.mjs';
const root=document.getElementById('solar-radiation'),f=new Intl.NumberFormat('en-GB',{maximumFractionDigits:0});
if(root)animate(root,now=>{const ms=minute(now);row(root,'sun',f.format(solarEnergy(ms/1000))+' MWh',ms/60000);});Model
A JavaScript module in the cartridges folder of GlobalGrid2050. It is built from the scenario m wh helper (`scenarioMWh`).
transformglobalgrid2050 / cartridges/202609052157-solar-scenario/model.mjs · lines 1–2 of 2 · version 2026-09-05 21:57 · Not reached from any entry point (candidate for review)
- What it does
- It calculates its inputs. Defines scenarioMWh.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- What it achieves
- Defines `scenarioMWh`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · cartridges/202609052157-solar-scenario · JavaScript module
- Uses
- none found
- Used by
- none found
- Produces
- targetTW, scenarioMWh
- Defines here
- scenarioMWh
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052157-solar-scenario/model.mjs:1-2 · blob 2d304bb18573d00acec41ba50675d8c2dae8932d · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: unreached_review
export const targetTW=75;
export function scenarioMWh(seconds,capacityFactor){if(!Number.isFinite(seconds)||seconds<0||!Number.isFinite(capacityFactor)||capacityFactor<0||capacityFactor>1)throw Error('Invalid scenario');return targetTW*1e6*capacityFactor*seconds/3600;}Model Test
A test in the cartridges folder of GlobalGrid2050.
testglobalgrid2050 / cartridges/202609052157-solar-scenario/model.test.mjs · lines 1–1 of 1 · version 2026-09-05 21:57 · Entry point
- What it does
- It tests its inputs. Uses libraries node:test.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Open Energy Cartridge Workflow (globalgrid2050).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Run by GlobalGrid2050 Open Energy Cartridge Workflow.
- Application
- globalgrid2050 · cartridges/202609052157-solar-scenario · test
- Uses
- node:test
- Used by
- run by GlobalGrid2050 Open Energy Cartridge Workflow (workflow run)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052157-solar-scenario/model.test.mjs:1-1 · blob 6369f2c378c635df4c5df4c8349b20afb0dba0b1 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import test from 'node:test';import assert from 'node:assert/strict';import {scenarioMWh} from './model.mjs';test('75TW20% produces250000MWh per minute in the hypothetical scenario',()=>{assert.equal(scenarioMWh(60,.2),250000);assert.equal(scenarioMWh(0,.2),0);assert.equal(scenarioMWh(60,0),0);assert.throws(()=>scenarioMWh(60,2));});Scenario
A JavaScript module in the cartridges folder of GlobalGrid2050 covering solar.
renderglobalgrid2050 / cartridges/202609052157-solar-scenario/scenario.mjs · lines 1–2 of 2 · version 2026-09-05 21:57 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 33 files: Homepage V061 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v061.html); Homepage V062 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v062.html); Homepage V063 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v063.html); Homepage V064 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v064.html); and 29 more.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Loaded by the Homepage V061 page at https://globalgrid2050.com/homepage_versions/homepage_v061.html and 32 other pages.
- Application
- globalgrid2050 · cartridges/202609052157-solar-scenario · JavaScript module
- Uses
- Runtime (import)
- Used by
- loaded by Homepage V061 (script src), loaded by Homepage V062 (script src), loaded by Homepage V063 (script src), loaded by Homepage V064 (script src), loaded by Homepage V065 (script src), loaded by Homepage V066 (script src), loaded by Homepage V067 (script src), loaded by Homepage V068 (script src), and 25 more
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052157-solar-scenario/scenario.mjs:1-2 · blob 34426497567ef8a8abefcb46b963bb6fd0b3020e · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import {animate,minute,row} from '../202609052154-minute-runtime/runtime.mjs';import {scenarioMWh} from './model.mjs';const root=document.getElementById('solar-75tw'),f=new Intl.NumberFormat('en-GB',{maximumFractionDigits:0});
if(root)animate(root,now=>{const cf=Number(root.querySelector('input').value)/100,ms=minute(now);if(cf<.05||cf>.4||!Number.isFinite(cf))return;row(root,'pv',f.format(scenarioMWh(ms/1000,cf))+' MWh',ms/60000);root.querySelector('[data-assumption]').textContent='Assumed capacity factor '+(cf*100).toFixed(0)+'%. At this hypothetical fleet size: '+f.format(scenarioMWh(60,cf))+' MWh per average minute. … [line shortened here: 455 characters; full line on GitHub]Model
A JavaScript module in the cartridges folder of GlobalGrid2050 that works with solar.
transformglobalgrid2050 / cartridges/202609052200-solar-periods/model.mjs · lines 1–2 of 2 · version 2026-09-05 22:00
- What it does
- It calculates solar. Defines periods.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 1 file: Solar (globalgrid2050). Reached from 32 other entry points, including Homepage V062 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v062.html); Homepage V063 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v063.html); Homepage V064 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v064.html).
- What it achieves
- Defines `periods`.
- Why it matters
- Imported by Solar.
- Application
- globalgrid2050 · cartridges/202609052200-solar-periods · JavaScript module
- Uses
- Model (import)
- Used by
- imported by Solar (import)
- Produces
- periods
- Defines here
- periods
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052200-solar-periods/model.mjs:1-2 · blob bc4fff611c0e26e3a886cac7e530d8e4b28dd976 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import {solarEnergy} from '../202609052155-solar-radiation/model.mjs';
export function periods(now){if(!Number.isFinite(now)||now<0)throw new RangeError('Expected a nonnegative epoch time');return Object.fromEntries([['day',86400000],['hour',3600000],['minute',60000]].map(([key,ms])=>[key,solarEnergy((now%ms)/1000)]));}Model Test
A test in the cartridges folder of GlobalGrid2050 covering solar.
testglobalgrid2050 / cartridges/202609052200-solar-periods/model.test.mjs · lines 1–2 of 2 · version 2026-09-05 22:00 · Entry point
- What it does
- It tests solar. Uses libraries node:test.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Open Energy Cartridge Workflow (globalgrid2050).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Run by GlobalGrid2050 Open Energy Cartridge Workflow.
- Application
- globalgrid2050 · cartridges/202609052200-solar-periods · test
- Uses
- node:test
- Used by
- run by GlobalGrid2050 Open Energy Cartridge Workflow (workflow run)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052200-solar-periods/model.test.mjs:1-2 · blob f2e3918f869f5d4cfc4d61a5f664a2a0ddbab151 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import test from 'node:test';import assert from 'node:assert/strict';import {periods} from './model.mjs';import {solarEnergy} from '../202609052155-solar-radiation/model.mjs';
test('UTC periods reset independently and conserve rate',()=>{const r=periods(Date.UTC(2026,8,5,12,30,15));assert.equal(r.day,solarEnergy(45015));assert.equal(r.hour,solarEnergy(1815));assert.equal(r.minute,solarEnergy(15));assert.deepEqual(periods(Date.UTC(2026,8,6)),{day:0,hour:0,minute:0});assert.throws(()=>periods(NaN));});Retro
A style sheet in the cartridges folder of GlobalGrid2050 covering solar.
renderglobalgrid2050 / cartridges/202609052200-solar-periods/retro.css · lines 1–10 of 10 · version 2026-09-05 22:00 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 32 files: Homepage V062 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v062.html); Homepage V063 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v063.html); Homepage V064 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v064.html); Homepage V065 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v065.html); and 28 more.
- What it achieves
- Original terminal palette. Typography and solid grey progress fills remain inherited.
- Why it matters
- Loaded by the Homepage V062 page at https://globalgrid2050.com/homepage_versions/homepage_v062.html and 31 other pages.
- Application
- globalgrid2050 · cartridges/202609052200-solar-periods · style sheet
- Uses
- none found
- Used by
- loaded by Homepage V062 (stylesheet), loaded by Homepage V063 (stylesheet), loaded by Homepage V064 (stylesheet), loaded by Homepage V065 (stylesheet), loaded by Homepage V066 (stylesheet), loaded by Homepage V067 (stylesheet), loaded by Homepage V068 (stylesheet), loaded by Homepage V069 (stylesheet), and 24 more
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052200-solar-periods/retro.css:1-10 · blob 5bb32045e9adf191aaefb92071b72d8ddb84fbb6 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
/* Original terminal palette. Typography and solid grey progress fills remain inherited. */
body h1 { color: #83d8d0; }
body h2, body h3 { color: #e2bd79; }
#open-energy h2, #circuit-school h2 { color: #a8d59a; }
#nasa-ice h2, #nano-minute h2 { color: #9bbfea; }
#solar-radiation h2, #solar-75tw h2 { color: #e2bd79; }
.solar-periods { margin: 12px 0; }
.solar-periods div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 5px 0; border-bottom: 1px solid #303942; }
.solar-periods dt, .solar-periods dd { margin: 0; }
.solar-periods output { font-variant-numeric: tabular-nums; }Solar
A JavaScript module in the cartridges folder of GlobalGrid2050 covering solar.
energy-dataglobalgrid2050 / cartridges/202609052200-solar-periods/solar.mjs · lines 1–4 of 4 · version 2026-09-05 22:00 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
- Downstream impact
- Used directly by 32 files: Homepage V062 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v062.html); Homepage V063 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v063.html); Homepage V064 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v064.html); Homepage V065 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v065.html); and 28 more.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Loaded by the Homepage V062 page at https://globalgrid2050.com/homepage_versions/homepage_v062.html and 31 other pages.
- Application
- globalgrid2050 · cartridges/202609052200-solar-periods · JavaScript module
- Uses
- Runtime (import), Model (import)
- Used by
- loaded by Homepage V062 (script src), loaded by Homepage V063 (script src), loaded by Homepage V064 (script src), loaded by Homepage V065 (script src), loaded by Homepage V066 (script src), loaded by Homepage V067 (script src), loaded by Homepage V068 (script src), loaded by Homepage V069 (script src), and 24 more
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 cartridges/202609052200-solar-periods/solar.mjs:1-4 · blob 8e0b611d803981f723c8fa00fe7dfbda555a4417 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import {animate,minute,row} from '../202609052154-minute-runtime/runtime.mjs';
import {periods} from './model.mjs';
const root=document.getElementById('solar-radiation'),format=new Intl.NumberFormat('en-GB',{maximumFractionDigits:0});
if(root)animate(root,now=>{const values=periods(now);for(const key of ['day','hour','minute'])root.querySelector('[data-solar='+key+']').textContent=format.format(values[key])+' MWh';row(root,'sun',format.format(minute(now)/1000)+' / 60 seconds',minute(now)/60000);});