In this section
- Substation Intelligence Body electrical · gridatlas / atlas/parts/202609012350-substation-intelligence-body.js lines 1–314
- Single-Line Diagram (SLD) Sandbox Arrival Identity geodesy · gridatlas / atlas/parts/202609040229-sld-sandbox-arrival-identity.js lines 1–386
Substation Intelligence Body
A JavaScript file in the parts folder of GridAtlas that fetches transformers, substations, 400kV and 132kV, using haversine.
electricalgridatlas / atlas/parts/202609012350-substation-intelligence-body.js · lines 1–314 of 314 · version 2026-09-01 23:50 · Not reached from any entry point (candidate for review) · pattern unitCount (shared by 8 files)
- What it does
- It fetches transformers, substations, 400kV and 132kV. Defines normalise, ready, eligible, unitCount. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: transformers, substations, 400kV, 132kV, 275kV, 66kV.
- Inputs & outputs
- Voltage levels named: 400kV, 275kV, 132kV, 66kV, 33kV, 11kV.
- What it achieves
- It is built from the normalise step (`normalise`), the ready step (`ready`) and the eligible step (`eligible`). PART 2 - the network, as its operator publishes it. Its code works with 400 kV and 132 kV.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · atlas/parts · script
- Uses
- none found
- Used by
- none found
- Produces
- normalise, ready, eligible, unitCount
- Defines here
- normalise, ready, eligible, unitCount
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/parts/202609012350-substation-intelligence-body.js:1-314 · blob f971dd1d34439de43633871e94d4c91c19b66b93 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/* ══════════════════════════════════════════════════════════════════════
PART 2 - the network, as its operator publishes it
══════════════════════════════════════════════════════════════════════ */
(() => {
'use strict';
const GENERATION = '202609012045';
/* Pinned to a commit and hashed. The reasoning, the table and the
digest arithmetic are in the pinned-products module beside this file;
what matters here is that `main` was the ref and the schema string was
the whole defence, and a schema string is blind to values. */
const PINS = (window.__GRIDATLAS_MODULES__ || {}).pinnedProducts || null;
const PRODUCT_ID = 'connection-points.v3';
const PRODUCT = PINS ? PINS.url(PRODUCT_ID) : null;
const REQUIRED_SCHEMA = 'data-grid-gb.connection-points.v3';
/* Appendix D publishes eight current metrics and they are NOT
interchangeable, so one is quoted and named rather than any of them
being called "the fault level".
Codex, 202609011852: an earlier version of this comment and of the
card said the RMS break current is "the one switchgear is rated
against". That overclaims. Switchgear carries several relevant
ratings - making capacity, short-time withstand, peak withstand -
and this is ONE published breaker-duty metric among the eight. */
const QUOTED_METRIC = 'three_phase_rms_break_current_ka';
const QUOTED_METRIC_LABEL = 'three-phase RMS break current';
const DEG = Math.PI / 180;
const state = {
schema: 'gridatlas.substation-intelligence.v2',
generation: GENERATION,
product: PRODUCT,
loaded: false,
points: 0,
located: 0,
product_schema: null,
quoted_metric: QUOTED_METRIC,
failures: []
};
window.__GRIDATLAS_NETWORK__ = state;
/* ONE geodesy, and it is the module's.
--------------------------------------------------------------
This carried its own haversine using 2*R*asin(sqrt(a)) while the
estate canonical form is R*2*atan2(sqrt(a), sqrt(1-a)). They
agree algebraically and differ in the last place, and the
difference was invisible for as long as this half of the
cartridge was a monolith the all-versions scan could not read.
202609012350 extracted it, the scan found it immediately, and
the answer is not to retype the right form here but to stop
having a second implementation at all. */
const GEODESY = (window.__GRIDATLAS_MODULES__ || {}).geodesy;
if (!GEODESY) throw new Error("substation-intelligence requires the geodesy module");
const distanceKm = GEODESY.distanceKm;
const NOISE = /\b(SUBSTATION|SUB STATION|SUBSTN|GRID|SUPPLY|POINT|GSP|NATIONAL|POWER|STATION|WIND|FARM|WINDFARM|OFFSHORE|ONSHORE|EXTENSION|400KV|275KV|132KV|66KV|33KV|11KV|NGET|SSE|SP|SHE)\b/g;
function normalise(name) {
return String(name || '').toUpperCase()
.replace(/[^A-Z0-9 ]/g, ' ').replace(NOISE, ' ')
.split(/\s+/).filter(Boolean).join(' ');
}
const byName = new Map();
const located = [];
/* Every point, not only the ones that survived the name join. `byName`
keeps the first of a colliding key, so counting from it would report a
smaller network than the operator publishes. */
const published = [];
const ready = (async () => {
try {
if (!PRODUCT) throw new Error('the pinned-products module is not composed, '
+ 'so this cartridge has no pinned ref to read and will not guess one');
const response = await fetch(PRODUCT, { cache: 'no-cache' });
if (!response.ok) throw new Error('HTTP ' + response.status);
const text = await response.text();
const seal = await PINS.verify(PRODUCT_ID, text);
state.product_pin = seal;
if (seal.state === 'MISMATCH') {
state.failures.push(seal.detail
+ '; refusing to answer from bytes this composition has not seen');
return false;
}
const product = JSON.parse(text);
state.product_schema = product?.schema || null;
if (product?.schema !== REQUIRED_SCHEMA) {
state.failures.push('schema is ' + String(product?.schema)
+ ', this cartridge answers only ' + REQUIRED_SCHEMA);
return false;
}
for (const point of product.connection_points || []) {
const key = normalise(point.name);
if (key && !byName.has(key)) byName.set(key, point);
published.push(point);
if (point.location) located.push(point);
}
state.points = (product.connection_points || []).length;
state.located = located.length;
state.counts = product.counts || null;
state.join = product.join || null;
state.source = product.source || null;
state.loaded = true;
return true;
} catch (error) {
state.failures.push('network product: ' + String(error?.message || error));
return false;
}
})();
state.ready = ready;
state.byName = (name) => state.loaded
? (byName.get(normalise(name)) || null) : null;
/* The owner product's coordinates are NOT used for anything a reader
sees. Codex, 202609011852: WBUR's exact-name join binds a different
West Burton 96.42 km from the project, and exact text equality is not
exact identity. The Atlas measures on its own substation payload and
always has; this stays available for callers that want it, marked,
and the card is proven never to print a distance from here. */
state.location_join_is_unverified = true;
state.nearest = (lon, lat, options) => {
if (!state.loaded) return null;
const minimumKv = options?.minimumKv ?? 0;
const limit = options?.limit ?? 1;
const found = [];
for (const point of located) {
if (Math.max(...point.voltages_kv) < minimumKv) continue;
found.push({ point, km: distanceKm(lon, lat, point.location.lon, point.location.lat) });
}
found.sort((a, b) => a.km - b.km);
return limit === 1 ? (found[0] || null) : found.slice(0, limit);
};
/* One line a card can print, built only from what is published, or null
when nothing is. An empty sentence about a substation is worse than
silence. */
/* connectionKv is the voltage the connection is actually made at: the
declared point of connection's class, or the class of the substation
being measured to. Given one, the fault current is quoted at THAT
busbar group rather than across the site.
An outside review put the reason plainly: fault duty at a 400 kV
busbar and at a 132 kV busbar are different physical quantities
governing different switchgear, so a range spanning both is
meaningless to the engineer reading it - and the more correctly the
metric is named, the more readily the eye trusts it. */
/* WHAT A DISTANCE SEARCH COULD SEE, at the voltage it was asked for.
------------------------------------------------------------------
ETYS names substations and does not locate them; the only geometry
this estate holds comes from OpenStreetMap through a GridAtlas
release. So a proportion of what the operator publishes is invisible
to any search by distance, and a card that says "nearest" without
saying that is asserting something it cannot know.
COMPUTED, never written down. The numbers move when the product moves
- Codex's join correction takes located from 502 to 489 - and a
sentence with a literal in it would go quietly false the day the pin
is bumped. This counts the payload that was actually fetched, using
exactly the predicate state.nearest uses to decide what is eligible,
so the denominator on the card is the denominator of the search. */
state.coverage = (minimumKv) => {
if (!state.loaded) return null;
const floor = Number(minimumKv) || 0;
const eligible = (point) => Array.isArray(point.voltages_kv)
&& point.voltages_kv.length
&& Math.max(...point.voltages_kv) >= floor;
const inBand = published.filter(eligible);
const seen = located.filter(eligible);
return {
minimum_kv: floor,
published: inBand.length,
located: seen.length,
unlocated: inBand.length - seen.length,
/* Named rather than computed by the reader, and never graded. */
basis: 'counted from the connection-points payload this session fetched'
};
};
state.summarise = (name, options) => {
const point = state.byName(name);
if (!point) return null;
const connectionKv = options && Number(options.connectionKv);
/* connection-points.v3 publishes `circuits` and `transformers` as
LANDINGS - one per node-end at the site - not as machines. A
transformer's two windings are both at the site by construction, so
almost every transformer is counted twice: Cowley publishes 10 for
its five machines, and 484 of the 525 sites that hold a transformer
are overstated, 2,944 landings against 1,550 units (1.90x).
This cartridge holds no node pairs, so it cannot deduplicate on its
own; the caller may pass `units` derived from the node/branch model
by the network-topology module, which does hold them. Where it does,
the machine count is stated. Where it does not, the published figure
is still shown but is named for what it is, because a landing tally
presented as a machine count is the defect, not the tally. */
/* Number(null) is 0, not NaN, so `Number(units && units.x)` reports a
finite ZERO the moment no units are passed - which is every call
that does not supply them. The proof caught it saying "0 circuits"
for a site publishing eight. Read the field only when there is one. */
const units = (options && options.units) || null;
const unitCount = (field) => {
if (!units) return null;
const value = Number(units[field]);
return Number.isFinite(value) ? value : null;
};
const transformerUnits = unitCount('transformers');
const circuitUnits = unitCount('circuits');
const parts = [];
if (circuitUnits !== null) {
parts.push(circuitUnits + (circuitUnits === 1 ? ' circuit' : ' circuits'));
} else if (point.circuits) {
parts.push(point.circuits + (point.circuits === 1 ? ' circuit' : ' circuits'));
}
if (transformerUnits !== null) {
parts.push(transformerUnits
+ (transformerUnits === 1 ? ' transformer' : ' transformers'));
} else if (point.transformers) {
parts.push(point.transformers + ' transformer winding connections at the site '
+ '(a transformer whose windings are both here is published at each of them, '
+ 'so this is not a count of machines)');
}
const rating = point.circuit_winter_rating_mva;
if (rating) {
/* The product does not split ratings by voltage, and a site with
several voltages will show a range no single circuit could span -
Blackhillock publishes 23 to 1,995 MVA. So it is marked site-wide
wherever it appears, rather than sitting beside a bus-specific
fault figure as though it shared its scope. */
parts.push('circuit winter ratings across the site '
+ rating.min.toLocaleString('en-GB')
+ '\u2013' + rating.max.toLocaleString('en-GB') + ' MVA');
}
/* Prefer the busbar group the connection is made at. Fall back to the
site-wide envelope only when the voltage is unknown or the product
does not publish that group, and say which was used either way. */
const byVoltage = point.fault_current_by_voltage || null;
let peak = point.fault_current?.peak || null;
let faultScope = 'site';
let faultKv = null;
if (Number.isFinite(connectionKv) && byVoltage) {
const key = Object.keys(byVoltage)
.find(k => Math.abs(Number(k) - connectionKv) < 0.5);
if (key && byVoltage[key]?.peak) {
peak = byVoltage[key].peak;
faultScope = 'bus';
faultKv = Number(key);
}
}
const metric = peak?.metrics?.[QUOTED_METRIC];
if (metric) {
parts.push(QUOTED_METRIC_LABEL + ' ' + metric.min.toFixed(1) + '\u2013'
+ metric.max.toFixed(1) + ' ' + metric.unit
+ (faultScope === 'bus'
? ' at the ' + faultKv + ' kV busbars'
: ' across every busbar at this site')
+ ' over ' + peak.scenarios + ' peak-demand rows'
+ (peak.locations?.length ? ' at ' + peak.locations.length
+ (peak.locations.length === 1 ? ' bus' : ' buses') : '')
+ (peak.winters?.length
? ' (' + peak.winters[0] + ' to ' + peak.winters[peak.winters.length - 1] + ')'
: ''));
}
if (point.reactive_compensation?.units) {
parts.push(point.reactive_compensation.units + ' reactive compensation units');
}
if (point.planned_changes) {
const years = point.planned_change_years || [];
parts.push(point.planned_changes + ' changes published for '
+ (years.length ? years[0] + '\u2013' + years[years.length - 1] : 'later years'));
}
if (!parts.length) return null;
/* Everything above is aggregated at SITE CODE, not selected for a
bus. Where a site carries more than one voltage the numbers span
them, so the reader is told that before reading any of them -
otherwise a sentence under a 400 kV point of connection reads as a
400 kV result. West Burton is exactly this case: WBUR1 is 132 kV
and WBUR4 is 400 kV, and its published fault range spans both. */
const voltages = point.voltages_kv || [];
/* Site-wide is now about what remains site-wide. Once the fault
current is quoted at a busbar group, the label must not claim the
whole sentence is site-wide - only the parts that still are. */
const siteWide = voltages.length > 1;
const busLocations = point.fault_current?.peak?.locations || [];
return {
site_code: point.site_code,
transmission_owner: point.transmission_owner,
voltages_kv: voltages,
site_wide: siteWide,
bus_locations: busLocations,
fault_scope: faultScope,
fault_kv: faultKv,
scope_label: faultScope === 'bus'
? ('Fault current is quoted at the ' + faultKv + ' kV busbars, the '
+ 'voltage this connection is made at. Circuit counts, ratings, '
+ 'transformers and planned changes remain site-wide across the '
+ voltages.slice().sort((a, b) => b - a).join('/') + ' kV buses here')
: (siteWide
? ('Site-wide published envelope across the '
+ voltages.slice().sort((a, b) => b - a).join('/') + ' kV buses at this site, '
+ 'not a value for any one bus')
: ('Published for this site, which carries one voltage: '
+ (voltages[0] || '?') + ' kV')),
sentence: parts.join(' \u00b7 '),
metric_named: QUOTED_METRIC_LABEL,
metrics_not_interchangeable: 'Appendix D publishes eight current '
+ 'metrics and they are not interchangeable; this is one published '
+ 'breaker-duty metric, and switchgear carries several relevant '
+ 'ratings besides it.',
attribution: 'NESO Electricity Ten Year Statement 2025, appendices B and D, '
+ 'via Ventusltd/data-grid-gb',
not_an_assessment: 'Published parameters. Not a statement about whether '
+ 'any project can connect here.'
};
};
})();Single-Line Diagram (SLD) Sandbox Arrival Identity
A JavaScript file in the parts folder of GridAtlas that maps grid substations, solar, transformers and 400kV, using haversine.
geodesygridatlas / atlas/parts/202609040229-sld-sandbox-arrival-identity.js · lines 1–386 of 5948 · version 2026-09-04 02:29 · Not reached from any entry point (candidate for review) · pattern retryIdentityOwnerThenArrival (shared by 8 files)
- What it does
- It maps grid substations, solar, transformers and 400kV. Defines 187 functions or classes, including coverage, isProjectTech, provisionalDeclaredConnection, resolveDeclaredConnection, nearestTransmission. Side effects: changes the web page (DOM); reads or writes files; makes network requests; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'sandbox'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: solar, transformers, 400kV, 750kV, 415kV, 275kV.
- Inputs & outputs
- In: GeoJSON file grid_substations.geojson; browser storage (getItem); DuckDB queries; form fields (user input). Out: browser storage (setItem); interactive map. Coordinate systems named: WGS84 / EPSG:4326. Voltage levels named: 750kV, 415kV, 400kV, 275kV, 220kV, 132kV, 66kV, 33kV.
- What it achieves
- It resolves declared connection (`resolveDeclaredConnection`), opens corridor sheet (`openCorridorSheet`) and runs grid point (`runGridAtPoint`). GridAtlas cartridge — neon substation links and the SLD layout sandbox. Its code works with 400 kV, 33 kV and 132 kV. It responds to click, keydown and touchstart events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · atlas/parts · script
- VEDIC
- MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
- VEDIC
- VOLTAGE (GG2050-VEDIC-000003): GridAtlas / Geodesy · Computer science / Data normalisation. voltage_properties → kilovolt_list
- VEDIC
- REPRESENT (GG2050-VEDIC-000002): GridAtlas / Geodesy · Computer science / Geometry processing. geojson_geometry → coordinate_pair_or_null
- Uses
- none found
- Used by
- none found
- Produces
- coverage, isProjectTech, provisionalDeclaredConnection, resolveDeclaredConnection, nearestTransmission, corridorBeside, module, corridorTargets, corridorAction, installCorridorSheet, close, openCorridorSheet
- Defines here
- coverage, isProjectTech, provisionalDeclaredConnection, resolveDeclaredConnection, nearestTransmission, corridorBeside, module, corridorTargets
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/parts/202609040229-sld-sandbox-arrival-identity.js:1-386 · blob 2c1486ea5aef879022fc222d4363b779d22e165b · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, storage · domain stage: experimental · users: none · canonical: duplicate_candidate
/**
* GridAtlas cartridge — neon substation links and the SLD layout sandbox.
*
* Assembled under the generation named in the header above; this part
* states no generation of its own, because a second identity inside the
* same file is one that can disagree with the first. Slot: replace-script for
* 202608292126-pre-snapped-config-adapter.js.
*
* WHAT IT DOES
* ------------
* Select a solar, battery or onshore wind project and the map draws animated
* neon lines from it to the nearest substations at 33 kV and above. The same
* distances are written onto the project card the engine has just opened,
* marked BETA, with the reasons a distance is not a connection stated on the
* card itself rather than hidden in a tooltip.
*
* WHY IT REPLACES THE CONFIG ADAPTER RATHER THAN ADDING A SCRIPT
* -------------------------------------------------------------
* The composer in atlas/index.html supports exactly one slot, `replace-script`.
* There is no append slot, and inventing one would mean changing the composer,
* which is a larger contract change than this feature is worth. So this
* cartridge carries the pre-snapped config adapter's behaviour VERBATIM -- same
* layer ids, same closure assertion, same failure mode, same public state
* object -- and adds the link layer beside it. The immutable shell is not
* touched, and `__GRIDATLAS_PRE_SNAPPED_CONFIG__` still reports exactly what it
* reported before, so anything asserting on it keeps working.
*
* HOW IT HOOKS IN WITHOUT SHELL MUTATION
* --------------------------------------
* Two decorators, both of things the engine has already published by the time
* this script runs:
*
* window.initVentusMap wrapped for the pre-snap config, as before.
* maplibregl.Map wrapped to capture the instance, because the engine
* keeps `map` in a closure and returns nothing. The
* engine constructs its map inside initVentusMap, which
* runs after this file, so the constructor is still
* ours to wrap.
*
* THE MEASUREMENT
* ---------------
* Haversine on R = 6378.137 km, the same constant as ventus-corev8engine.js,
* pipelinenews and Ventusltd/grid-distance-maths, so a distance read here
* equals the same distance read there. Substations are mapped as points AND as
* polygons; a polygon is reduced to its ring mean, because its first vertex is
* a corner rather than the site.
*
* Scope is 33 kV and above. 11 kV is rare for utility-scale export and where it
* occurs is often a private network behind the meter, so it is not a screening
* signal. `voltage` is written `33000`, `33000;11000` for two voltages, and
* `33000:11000` for a transformer ratio -- a 33/11 primary still carries 33 kV.
*
* WHAT A LINE IS NOT
* ------------------
* A straight line to mapped geometry. Not a cable route, not a connection
* length, no wayleave, crossing, terrain or consent content. A mapped
* substation does not confirm capacity, voltage suitability or connection
* rights, and fault level and thermal headroom cannot be inferred from distance
* at all -- they need DNO network data such as source impedance and a
* connection study, alongside right of way, wayleaves and easements, land
* control and consent. The card says all of that on screen.
*/
(() => {
'use strict';
const GENERATION = '202609012045';
/* ══════════════════════════════════════════════════════════════════════
PART 1 — the pre-snapped config adapter, carried forward unchanged.
══════════════════════════════════════════════════════════════════════ */
const PRE_SNAPPED_LAYER_IDS = new Set(['400', '275', '220', '132', '66']);
const originalInit = window.initVentusMap;
if (typeof originalInit !== 'function') {
throw new Error('V8 engine init function is unavailable before map-ready adapter');
}
const state = {
schema: 'gridatlas.pre-snapped-config-adapter.v1',
generation: '202608292126',
applied: false,
changed_layer_ids: [],
preserved_preload_flags: true,
failures: []
};
window.__GRIDATLAS_PRE_SNAPPED_CONFIG__ = state;
window.initVentusMap = function gridAtlasMapReadyInit(options) {
try {
const changed = [];
const config = options.config.map(group => ({
...group,
layers: group.layers.map(layer => {
if (!PRE_SNAPPED_LAYER_IDS.has(String(layer.id))) return layer;
if (layer.snap !== true) {
throw new Error(`expected V8 snap=true for topology layer ${layer.id}`);
}
changed.push(String(layer.id));
return { ...layer, snap: false };
})
}));
const expected = [...PRE_SNAPPED_LAYER_IDS].sort();
if (JSON.stringify([...changed].sort()) !== JSON.stringify(expected)) {
throw new Error(`pre-snapped layer closure mismatch: ${JSON.stringify(changed)}`);
}
state.applied = true;
state.changed_layer_ids = changed;
return originalInit({ ...options, config });
} catch (error) {
state.failures.push(String(error?.message || error));
throw error;
}
};
/* ══════════════════════════════════════════════════════════════════════
PART 2 — neon substation links.
══════════════════════════════════════════════════════════════════════ */
/* ONE geodesy, and it is the module's.
----------------------------------------------------------------------
This file used to declare R_ATLAS = 6378.137 and its own distanceKm,
four hundred lines from a second geodesy section, while the assembled
cartridge ALSO carried the geodesy module in front of it. Two radii and
two haversines in one served file, agreeing only because nobody had
changed one of them yet - and on 1 Sep 2026 the all-versions proof
found that they had in fact stopped agreeing in the last bit.
The Grid Finding Scope already did this correctly: it calls its module
and computes nothing itself. Geodesy was the exception. It is not now.
A missing module is a hard failure at load, not a fallback: a fallback
would silently restore exactly the duplication this removes. */
const GEODESY = (window.__GRIDATLAS_MODULES__ || {}).geodesy;
if (!GEODESY) throw new Error('sld-sandbox requires the geodesy module');
const R_ATLAS = GEODESY.EARTH_RADIUS_KM;
const DEG = Math.PI / 180;
const MIN_KV = 33;
const LINK_COUNT = 5; // how many substations to reach for
const MAX_LINK_KM = 40; // beyond this, silence is more honest
const SUBS_URL = 'data/grid_substations.geojson';
const SUBS_LAYER_ID = 'l-subs'; // engine convention: layer `l-<id>`, source `src-<id>`
// Project technologies this fires for. Onshore only: an offshore turbine's
// export route is nothing like a straight line to the nearest onshore
// substation, so drawing one would be a picture of a lie.
/* Every technology the register actually uses, and then some.
----------------------------------------------------------------------
This set was solar, bess and two spellings of wind, and it silently
rejected the rest. Counted against the shipped register: 2,399 onshore
wind projects and 109 offshore, so 2,508 of 7,680 — a third of the
register — had a MAP button that did nothing at all. Not an error, not a
message, nothing: the deep link tested membership and returned.
The register writes `wind_onshore`. The engine has had a `wind_onshore`
layer the whole time. Only this list disagreed with both.
So it no longer decides alone. The list below is the fast path, and
anything the ENGINE has a layer control for is accepted too — the engine
owns the layers, so the engine's vocabulary is the authority and this
stops being a place a technology can be forgotten. */
const PROJECT_TECHS = new Set([
'solar', 'solar_operational', 'solar_roof',
'bess', 'bess_operational',
'wind', 'wind_onshore', 'wind_onshore_operational',
'wind_offshore', 'wind_offshore_operational',
// The rest of the engine's own generation and storage dashboard, read off
// the live page rather than guessed. Note wind_onshore is NOT among the
// engine's layer ids -- it has `wind` and `wind_onshore_operational` --
// yet the register writes wind_onshore for 2,399 projects. Asking the
// engine alone would still have missed every one of them, which is why the
// explicit entry above is not redundant with the lookup below.
'biomass', 'hydro', 'hydrogen', 'tidal', 'geothermal',
'flywheel', 'caes', 'act',
/* `other` is what the register writes for a category it has no
bucket for. Over the 11,069-row REPD product this Atlas's search
lane reads, 25 DESNZ categories normalise to 14 ids and `other` was
the only one missing here - 4 projects, 2 Unknown and 2 Air Source
Heat Pumps. Not many; not zero; and written again the next time the
register gains a category. */
'other'
]);
/* Which technologies measure, and what each measurement is OF, is owned by
the technology-coverage module rather than by this file. It is assembled
into this cartridge ahead of this part, so it is here by the time any of
this runs; the fallback below exists only so a proof can load this part
alone, and it reproduces the module's answer rather than a different one.
Offshore NO LONGER WITHHOLDS. It used to open a card and draw nothing, on
reasoning about export cables and landfalls that was right about routes
and wrong about whether to measure at all. An offshore project's export
cable does land at an onshore substation, so the distance is a
measurement of something real. What changed is the answer; what did not
change is a single word of the route reasoning, which the module now
prints beside the number instead of instead of it. */
const coverage = (() => {
try {
const module = window.__GRIDATLAS_MODULES__?.technologyCoverage;
if (module && typeof module.policy === 'function') return module;
} catch (_) { /* fall through to the local reproduction */ }
const OFF = new Set(['wind_offshore', 'wind_offshore_operational']);
return {
policy: (tech) => ({ technology: tech || null, measure: true,
offshore: OFF.has(String(tech || '')),
sample: 'nearest of the mapped substations at or above the voltage '
+ 'floor that this search could see',
notes: [] }),
namedOffshore: () => false
};
})();
const OFFSHORE_TECHS = new Set(['wind_offshore', 'wind_offshore_operational']);
function isProjectTech(tech) {
if (!tech) return false;
if (PROJECT_TECHS.has(tech)) return true;
// Ask the engine. If it has a control for this layer, it is a technology
// this map knows about, whatever this cartridge was written knowing.
try {
return Boolean(document.querySelector(
'input[type=checkbox][data-layer-id="' + String(tech).replace(/"/g, '') + '"]'));
} catch (error) {
return false;
}
}
// SCADA on a dark map, not arcade neon. These are the muted siblings of the
// engine's own layer colours: enough saturation to read as live, low enough
// not to shout over the basemap or the grid layers underneath.
const TECH_COLOUR = {
solar: '#d8c96a', solar_operational: '#d8c96a', solar_roof: '#d8c96a',
bess: '#d9963c', bess_operational: '#d9963c',
wind: '#6fb582', wind_onshore: '#6fb582', wind_onshore_operational: '#6fb582',
// Offshore reads cooler than onshore: it is the one technology here whose
// links are deliberately not drawn, and it should not look like the others.
wind_offshore: '#5f9fb5', wind_offshore_operational: '#5f9fb5',
biomass: '#b58f6f', hydro: '#6f9fd8', hydrogen: '#a98fd8',
tidal: '#5fb5a8', geothermal: '#b57f6f',
flywheel: '#9f9fb5', caes: '#9f9fb5', act: '#9f9fb5'
};
const SUBSTATION_COLOUR = '#5fbdc2'; // teal, the substation end of a link
/* ── the 400 kV public record ────────────────────────────────────────
The nearest-substations list is a measurement and nothing more. But
the DCO-scale schemes each carry a PUBLIC declared point of connection
at 400 kV - usually through a new customer substation consented within
the scheme itself - and this card used to say nothing about it while
listing closer 33 and 132 kV points, which read as connecting them to
the wrong network. The rule holds: bind to the public record or say
nothing. Every entry below is sourced from Development Consent Orders,
Planning Inspectorate documents, or public project statements; the
table binds a register identity to a NAMED substation in the served
payload, and the distance shown is measured, never asserted. */
const DECLARED_COLOUR = '#d8b64a'; // gold: declared, and the far end exists today
/* Pink: declared, and the thing at the far end has not been built. One
Earth's point of connection is a National Grid substation that does not
exist yet; Thorpe Marsh's is under construction. Drawing those in the
same gold as a connection into a live substation would say something
untrue about the network, so they get their own colour and the card
says which it is. The distinction is taken from the public record, not
from the map: an unbuilt substation can be absent from OSM, or present
because someone mapped the consented site. */
const DECLARED_UNBUILT_COLOUR = '#d87aa8';
/* The table itself, and the three functions that bind it to the payload,
moved to the declared-connections module at generation 202609012128.
The body keeps the colours (rendering) and the state; the record is
read from the module, which a proof can open on its own and a cut
hashes on its own. A missing module is a hard failure at load, for
the same reason as geodesy: a fallback would quietly restore a second
copy of the table. */
const DECLARED = (window.__GRIDATLAS_MODULES__ || {}).declaredConnections;
if (!DECLARED) throw new Error('sld-sandbox requires the declared-connections module');
let currentRepdRef = null;
let currentDeclared = null;
let currentNearest400 = null;
/* The coverage policy for the CURRENT selection. It carries no arithmetic
and changes no result - it decides only which sentences go under the
distances. The measurement itself is coordinates, a candidate set and a
distance, and reads no technology at all. */
let currentPolicy = null;
/* The capacity Pipeline News sent, kept where the network card can
reach it. Without this the powerflow answer would have to invent a
figure, and an invented megawatt is exactly the kind of number that
gets quoted back as the project's own. */
let currentCapacityMw = null;
/* What the Order says is known the moment the identity is known: the
substation, the voltage class, the route, the consented works and the
citation need no payload, no fetch and no map. On a phone that is the
difference between a card that answers and a card that waits. The
distance is the one part that must be measured, so it is the one part
marked pending until it has been. */
function provisionalDeclaredConnection(repdRef) {
return DECLARED.provisional(repdRef);
}
function resolveDeclaredConnection(repdRef, origin, subs) {
return DECLARED.resolve(repdRef, origin, subs);
}
function nearestTransmission(origin, subs) {
return DECLARED.nearestTransmission(origin, subs);
}
/* EVERY SUPERLATIVE CARRIES ITS SAMPLE.
--------------------------------------------------------------------
"Nearest 400 kV substation" is nearest among what this search could
see, and two different things limit that. The search runs over the
substation features the map has loaded, so the first number is how
many of them were actually eligible - counted by the measurement
itself, not assumed. And the operator's own published list is only
partly located: ETYS names substations and does not place them, so
the geometry comes from OpenStreetMap through a GridAtlas release and
a fraction of the network is invisible to any search by distance.
Both numbers are COMPUTED at render time from what was fetched. A
literal would go quietly false the day the pinned product moves -
Codex's join correction alone takes located points from 502 to 489 -
and a stale denominator under the word "nearest" is worse than none.
It states the sample. It does not grade the result. */
/* A straight line is not a route, and the card said nothing about it.
--------------------------------------------------------------------
ADDITIVE. The straight-line distance is unchanged, still first, still
the measurement; the corridor figure sits beside it and is labelled an
estimate every time it appears.
Only for a CABLE question. The factor is calibrated on cable circuits,
which follow the highway network; overhead line crosses open country
and measures 1.13. The module publishes that number and deliberately
offers no forOverhead(), so this cannot quietly become the answer to a
question it was not measured on.
Under about a kilometre the module withholds the estimate rather than
scaling, and the card says why: at that separation the straight line
between two site centroids is not measuring route factor at all. */
function corridorBeside(km) {
const module = (() => {
try { return window.__GRIDATLAS_MODULES__?.corridorEstimate || null; }
catch (_) { return null; }
})();
if (!module) return '';
const estimate = module.forCable(km);
if (!estimate) return '';
const basis = module.basis;
if (estimate.withheld) {
return ` <span class="neon-caveat">No corridor estimate at this `
+ `separation: ${escapeHtml(estimate.withheld)}.</span>`;
}
return ` · ~${estimate.km.toFixed(1)} km corridor estimate `
+ `(×${estimate.factor}, ${basis.within_15_pct}% of GB transmission `
+ `cable circuits within 15% of published length, `
+ `${basis.distinct_site_pairs} distinct site pairs). `
+ `<span class="neon-caveat">${escapeHtml(module.caveat)} `
+ `${escapeHtml(module.not_for_overhead)}</span>`;
}
/* A 44 px action, and a sheet that is the corridor figures in full.
--------------------------------------------------------------------
The card line beside each distance is one sentence. A reader who wants
the basis - what the factor was calibrated on, how wrong it typically
is, and what it is not for - should not have to take that from a
sentence, and on a phone there is no room to print it inline.
44 px because that is the smallest target a thumb hits reliably; the
estate's own layers toggle was widened to the same at 202609030116.
The sheet is opened three ways and all of them end in one function:
the button, a right-click on the map (the engine binds no contextmenu
- measured, zero occurrences in the shell, in index.html and in every
composed part), and a long press.
THE LONG PRESS DEFERS TO EVERYTHING. It arms on touchstart, and it is
cancelled by a movement of more than 10 px, by a second finger, by
touchend, and by an SLD drag already being in progress - the sandbox
binds its own touchstart for dragging the array, its handle and its
route pins, so this must never fire during one. A pan is a movement;
a pinch is a second finger; both cancel before the 500 ms is up. */
const CORRIDOR_SHEET = 'gridatlas-corridor-sheet';
let corridorSheetInstalled = false;
function corridorTargets() {
const rows = [];
if (currentDeclared && currentDeclared.kind !== 'circuit'