In this section
- Secondary Neon Engine geodesy · gridatlas / atlas/modules/202612020205-secondary-neon-engine.js lines 1148–1847
Secondary Neon Engine
A JavaScript file in the atlas folder of GridAtlas that maps connection points, GB transmission network, price decade rollup and grid substations, using haversine.
geodesygridatlas / atlas/modules/202612020205-secondary-neon-engine.js · lines 1148–1847 of 9008 · version 2026-12-02 02:05 (continued from section 555) · Not reached from any entry point (candidate for review) · pattern isInterconnectorArrival (shared by 3 files)
- What it does
- It maps connection points, GB transmission network, price decade rollup and grid substations. Defines 274 functions or classes, including distanceKm, distanceKm, representativePoint, voltagesKv, destinationPoint. 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 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: 750kV, 415kV, 400kV, 275kV, 220kV, 132kV.
- Inputs & outputs
- In: JSON file connection-points.v3.json; JSON file gb-transmission-network.v1.json; JSON file price-decade-rollup.json; GeoJSON file grid_substations.geojson; JSON file neso-connection-sites.lean.json; GeoJSON file interconnectors.geojson; browser storage (getItem); DuckDB queries. Out: browser storage (setItem); interactive map. Coordinate systems named: WGS84 / EPSG:4326. Voltage levels named: 750kV, 415kV, 400kV, 275kV, 220kV, 132kV, 110kV, 66kV.
- What it achieves
- It creates compute observer (`createComputeObserver`), describes compute receipt (`describeComputeReceipt`) and builds stats (`buildStats`). Receipt and distance owner: Ventusltd/ventus-grid-engine. Its code works with 400 kV, 132 kV and 33 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/modules · script
- VEDIC
- MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
- VEDIC
- REPRESENT (GG2050-VEDIC-000002): GridAtlas / Geodesy · Computer science / Geometry processing. geojson_geometry → coordinate_pair_or_null
- VEDIC
- VOLTAGE (GG2050-VEDIC-000003): GridAtlas / Geodesy · Computer science / Data normalisation. voltage_properties → kilovolt_list
- Uses
- none found
- Used by
- none found
- Produces
- distanceKm, distanceKm, representativePoint, voltagesKv, destinationPoint, initialBearingDeg, copy, finite, located, sameLocation, sameEntity, createComputeObserver
- Defines here
- centralStats, financeNumber, applyDevelopmentStageDefaults, applyMountingBifacial, screeningFinance, computeStats, fitToStatedCapacity, oneMore, bucketOf, policy, namedOffshore, widerFleetNames, widerFleetBuckets, measuredCount
- 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/modules/202612020205-secondary-neon-engine.js:1148-1847 · blob 26e5045a356c11088820207d3cbe95eb4b89374f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, storage · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
ring_main_ac_mva: production * i.s_subs,
warning
});
}
function centralStats(inputs) {
const i = inputs;
if (i.mod_wp_c <= 0 || i.mod_l_c <= 0 || i.mod_w_c <= 0 || i.x_mods_c <= 0) {
return buildStats(i, { total_blocks: 0, module_count: 0, dc_ac_ratio: 1.2 });
}
const strDcKwp = (i.x_mods_c * i.mod_wp_c) / 1000;
const reqStrings = strDcKwp > 0 ? Math.ceil((i.inv_dc_mw_c * 1000) / strDcKwp) : 0;
// total_blocks counts INVERTERS: inverters per MV skid, times skids per
// ring, times rings. The skids are the level above it.
const total_blocks = i.inv_per_mv_c * i.mv_per_ring_c * i.rings_c;
const skid_count = i.mv_per_ring_c * i.rings_c;
const module_count = reqStrings * i.x_mods_c * total_blocks;
/* Two nameplates, and they are not the same number.
--------------------------------------------------------------------
The inverters and the MV skid transformers they share are rated
separately, and the plant can export no more than the smaller of the
two. On the shipped defaults they are a factor of two apart: 24
inverters at 4.4 MW is 105.6 MW of inverter, sitting on 12 skids at
4.4 MVA, which is 52.8 MVA of transformer.
The figure shown was 211.2 MW -- neither of those, and larger than
both. `total_blocks` already contains `inv_per_mv_c`, and the AC line
multiplied by it a second time, so the count of inverters sharing a
skid entered the answer squared. It also multiplied a count of
inverters by a TRANSFORMER rating, which is not a quantity that
exists.
This is a deliberate divergence from the sandbox this was ported from.
gis-sld-v5-calculations.js line 147 computes the same expression, so
the fault is in the original and was carried across faithfully by a
port whose whole contract was to carry the arithmetic unchanged.
Reported by the Codex session auditing this estate in parallel;
confirmed here dimensionally and against those defaults. */
const inverter_ac_total = total_blocks * i.inv_ac_mw_c;
const skid_ac_total = skid_count * i.central_skid_mva_c;
const ac_mw_direct = Math.min(inverter_ac_total, skid_ac_total);
// A skid carries every inverter fed into it, so the comparison that
// matters is the whole MV block against its transformer, not one
// inverter against it. One-to-one it never fires; on the defaults the
// block is 8.8 MW on a 4.4 MVA skid and it should.
const block_ac_mw = i.inv_ac_mw_c * i.inv_per_mv_c;
let warning;
if (block_ac_mw > i.central_skid_mva_c) {
warning = `The ${i.inv_per_mv_c} inverters on each MV skid total `
+ `${block_ac_mw.toFixed(2)} MW against a skid rated `
+ `${i.central_skid_mva_c} MVA. Export is limited by the transformer, `
+ `not the inverters. Verify thermal rating, overload strategy and `
+ `the export limit in the connection agreement.`;
} else if (i.inv_ac_mw_c > 10) {
warning = 'Large central inverter or power block selected. Verify transformer, MV switchgear, harmonics, thermal loading, protection and grid code compliance.';
}
return buildStats(i, {
total_blocks, module_count,
dc_ac_ratio: i.inv_ac_mw_c > 0 ? i.inv_dc_mw_c / i.inv_ac_mw_c : 1.2,
ac_mw_direct,
// One skid's rating. The label on the control is "Skid MVA", so it is
// the skid, and multiplying it by the inverters on that skid described
// no piece of equipment.
production_substation_ac_mva: i.central_skid_mva_c,
ring_main_ac_mva: i.central_skid_mva_c * i.mv_per_ring_c,
central_inverter_ac_total: inverter_ac_total,
central_skid_ac_total: skid_ac_total,
warning
});
}
const DEVELOPMENT_STAGES = Object.freeze({
'0.003': 'Land Option Signed',
'0.015': 'Grid Connection Application Accepted',
'0.035': 'Planning Application Submitted',
'0.055': 'Planning Permission Granted',
'0.070': 'Grid Connection Terms Reviewed and Agreed',
'0.080': 'Buyer or Revenue Agreement Reviewed (Power Purchase Agreement (PPA) / Offtaker)',
'0.100': 'Construction Contract Signed and Finance Committed (Financial Close)',
});
const financeNumber = value => {
const number = Number(value);
return Number.isFinite(number) ? number : 0;
};
const DEVELOPMENT_SUCCESS = Object.freeze({
'0.003': 10,
'0.015': 15,
'0.035': 30,
'0.055': 55,
'0.070': 70,
'0.080': 80,
'0.100': 95,
});
const BIFACIAL_BY_GCR = Object.freeze({
'0.35': 8,
'0.45': 5,
'0.75': 2,
});
/* The original stage selector is not only a label: its change handler sets
development cost to the selected GBP/Wp value and success probability to
a stage-specific percentage. Keep that linked behavior explicit so a
stage change cannot leave the old stage's costs behind. */
function applyDevelopmentStageDefaults(financeInputs, stageValue) {
const stage = String(stageValue);
if (!Object.prototype.hasOwnProperty.call(DEVELOPMENT_STAGES, stage)) return false;
financeInputs.dev_stage = stage;
financeInputs.dev_cost_mw = financeNumber(stage);
financeInputs.dev_success = DEVELOPMENT_SUCCESS[stage];
return true;
}
/* Original Mounting & GCR presets also set the financial bifacial gain.
Apply the exact three preset mappings to the active topology only. A
free-form GCR value does not invent a gain. */
function applyMountingBifacial(financeByMode, mode, gcrValue) {
const values = (financeByMode || {})[mode];
if (!values) return false;
const key = String(Number(gcrValue));
if (!Object.prototype.hasOwnProperty.call(BIFACIAL_BY_GCR, key)) return false;
values.bifacial = BIFACIAL_BY_GCR[key];
return true;
}
/* Direct port of gis-sld-v5-finance.js computeFinance(). The original
executable fixture is the authority, not this comment. The one deliberate
divergence is inherited from the corrected electrical port: annual OPEX
uses the corrected central inverter nameplate, so the inv_per_mv > 1 case
must match the fixture's explicit corrected surplus rather than repeat the
original AC double-count. Every unaffected output remains exact. */
function screeningFinance(financeInputs, stats, context) {
const f = financeInputs || (context && context.defaults) || {};
const dcMwp = financeNumber(stats?.dc_mwp);
// The reference's OPEX input is GBP/MWac/year. In string mode its AC
// quantity is skid-limited export. In central mode, once the known square
// is removed, it is inverter count x inverter MWac. Do not silently swap
// that to transformer-limited export: those are separately named values.
const centralInverterAc = (stats?.mode || (context && context.fallbackMode)) === 'central'
? financeNumber(stats?.consistency?.inverter_ac_mw) : 0;
const acMw = centralInverterAc > 0 ? centralInverterAc : financeNumber(stats?.ac_mw);
const price = financeNumber(f.price);
const other = financeNumber(f.other);
const yieldVal = financeNumber(f.yield);
const bifacial = financeNumber(f.bifacial);
const baseLoss = financeNumber(f.losses);
const deg = financeNumber(f.deg);
const opexRate = financeNumber(f.opex);
const epcEx = financeNumber(f.epc_ex);
const floodRate = financeNumber(f.flood_rate);
const floodAdder = f.flood ? floodRate : 0;
const modules = financeNumber(f.modules);
const otherCapex = financeNumber(f.other_capex);
const fixedCapex = financeNumber(f.fixed_capex);
const cont = financeNumber(f.cont);
const lossExtras = financeNumber(f.loss_dc_string) + financeNumber(f.loss_lv_dc)
+ financeNumber(f.loss_lv_ac) + financeNumber(f.loss_tx) + financeNumber(f.loss_other);
const totalLoss = baseLoss + lossExtras;
const bessMw = financeNumber(f.bess_mw);
const bessMwh = financeNumber(f.bess_mwh);
const bessCapexRate = financeNumber(f.bess_capex);
const bessCycles = financeNumber(f.bess_cycles);
const bessRevenuePerMwh = financeNumber(f.bess_spread);
const bessEffPercent = financeNumber(f.bess_eff);
const safeLoss = Math.min(Math.max(totalLoss, 0), 100);
const safeBessEff = Math.min(Math.max(bessEffPercent / 100, 0), 1);
const effectiveYield = yieldVal * (1 + bifacial / 100);
const year1Gen = dcMwp * effectiveYield * (1 - safeLoss / 100);
let gen25 = 0;
let gen35 = 0;
for (let year = 1; year <= 35; year += 1) {
const generation = year1Gen * Math.pow(1 - deg / 100, year - 1);
if (year <= 25) gen25 += generation;
gen35 += generation;
}
const annualSolarRevenue = year1Gen * (price + other);
const bessAnnualValue = bessMwh * bessCycles * bessRevenuePerMwh * safeBessEff;
const annualRevenue = annualSolarRevenue + bessAnnualValue;
const revenue25 = gen25 * (price + other) + bessAnnualValue * 25;
const revenue35 = gen35 * (price + other) + bessAnnualValue * 35;
const annualOpex = acMw * opexRate;
const baseCapexWp = epcEx + modules + otherCapex + floodAdder;
const baseCapex = dcMwp * 1_000_000 * baseCapexWp;
const contingency = baseCapex * (cont / 100);
const bessCapex = bessMwh * bessCapexRate;
const totalCapex = baseCapex + contingency + fixedCapex + bessCapex;
const capexPerWp = dcMwp > 0 ? totalCapex / (dcMwp * 1_000_000) : 0;
const surplus25 = revenue25 - annualOpex * 25 - totalCapex;
const surplus35 = revenue35 - annualOpex * 35 - totalCapex;
const devCostPerMw = financeNumber(f.dev_cost_mw);
const devModulePerMwp = financeNumber(f.dev_module_mwp);
const devEpcPerMw = financeNumber(f.dev_epc_mw);
const devOwnerPerMw = financeNumber(f.dev_owner_mw);
const devGridPerMw = financeNumber(f.dev_grid_mw);
const devExitPerMwp = financeNumber(f.dev_exit_mwp);
const devNpvPerMwp = financeNumber(f.dev_npv_mwp);
const devSuccessPct = financeNumber(f.dev_success);
const devYears = financeNumber(f.dev_years);
const devStage = DEVELOPMENT_STAGES[String(f.dev_stage)] || 'Manual';
const wpCapacity = dcMwp * 1_000_000;
const devCapitalAtRisk = wpCapacity * devCostPerMw;
const devModuleCost = wpCapacity * devModulePerMwp;
const devEpcCost = wpCapacity * devEpcPerMw;
const devOwnerCost = wpCapacity * devOwnerPerMw;
const devGridCost = wpCapacity * devGridPerMw;
const devTotalBuildCost = devCapitalAtRisk + devModuleCost + devEpcCost
+ devOwnerCost + devGridCost;
const devExitValue = wpCapacity * devExitPerMwp;
const devOperatingNpv = wpCapacity * devNpvPerMwp;
const devGrossMargin = devExitValue - devTotalBuildCost;
const devRiskAdjustedValue = devGrossMargin * (devSuccessPct / 100);
const devReturnMultiple = devCapitalAtRisk > 0 ? devGrossMargin / devCapitalAtRisk : 0;
return {
annualRevenue, revenue25, revenue35, totalCapex, capexPerWp, surplus25, surplus35,
devStage, devCostPerMw, devModulePerMwp, devEpcPerMw, devOwnerPerMw,
devGridPerMw, devExitPerMwp, devNpvPerMwp, devSuccessPct, devYears,
devCapitalAtRisk, devModuleCost, devEpcCost, devOwnerCost, devGridCost,
devTotalBuildCost, devExitValue, devOperatingNpv, devGrossMargin,
devRiskAdjustedValue, devReturnMultiple, price, other, yieldVal, bifacial,
baseLoss, deg, opexRate, epcEx, floodActive: Boolean(f.flood), floodRate,
modules, otherCapex, fixedCapex, cont, totalLoss, bessMw, bessMwh,
bessCapexRate, bessCycles, bessSpread: bessRevenuePerMwh,
bessEff: bessEffPercent, epcIncModules: epcEx + modules,
};
}
function computeStats(inputs, financeByMode, defaults) {
const stats = inputs.mode === 'string'
? stringStats(inputs) : centralStats(inputs);
// Same object, so nothing can read a capacity without the check that says
// whether the capacities agree with each other.
stats.mode = inputs.mode;
stats.consistency = consistency(inputs, stats);
stats.finance = screeningFinance((financeByMode || {})[inputs.mode], stats,
{ fallbackMode: inputs.mode, defaults });
return stats;
}
/**
* Size the array so its capacity lands on the figure the register states.
*
* WHAT IS ADJUSTED, AND WHAT IS NOT
* Two integer topology counts move -- circuits and skids per circuit in
* string mode, rings and MV skids per ring in central mode. Everything a
* supplier fixes stays where the user put it:
* module rating, string length, inverter and skid ratings. That keeps the
* result buildable rather than a number reverse-engineered into nonsense.
*
* Blocks are integers, so an exact hit is usually impossible. The residual
* is reported rather than hidden, because a layout that quietly lands 7%
* off the stated capacity is worse than one that says so.
*
* WHICH CAPACITY IS BEING MATCHED
* That is the caller's declared basis, never a guess. REPD's figure is
* nominally MWelec, but it is reported inconsistently: some schemes state
* DC, some AC, and the register does not carry the distinction reliably.
* Matching AC when the figure was DC oversizes the connection by the DC/AC
* ratio, which is exactly the error that matters for export limitation.
*/
/* Fit on two variables, because one cannot reach a small project.
----------------------------------------------------------------------
Reported: the numbers do not change when the headline capacity changes.
Measured, and they do not:
string 5, 10, 20, 30, 40, 49.9 and 50 MW all produced 44.80 MW
central 5, 10 and 20 MW all produced 17.60 MW
The fit moved ONE variable. In string mode that is b_cols, and because
total_blocks is b_cols x s_subs with s_subs pinned at five, one step of
b_cols is five blocks — 44.8 MW at the default skid rating. Nothing below
that is reachable, so a 30 MW solar farm was drawn as a 44.8 MW one, an
overstatement of half as much again, and every target under 50 MW
collapsed onto the same layout. The register starts at 1 MW.
A block is 8.96 MW in string mode and a skid is 4.4 MVA in central. Those
are the real quanta, and they are reachable as soon as the inner variable
is allowed to move too. So the search is over both, and it prefers the
candidate that stays closest to the shape the user already had — a fit
that reaches the right capacity by rearranging the whole plant is a worse
answer than one that reaches it by adding a column.
Bounds are physical rather than generous: a ring main carries a handful of
skids, not four hundred, so the inner variable stops at twelve. */
const FIT_OUTER_MAX = 120;
const FIT_INNER_MAX = 12;
function fitToStatedCapacity(sld, computeSldStats) {
sld.fitResidualPct = null;
sld.fitQuantumMw = null;
const target = Number(sld.targetMw);
if (!Number.isFinite(target) || target <= 0) return;
if (sld.targetBasis !== 'ac' && sld.targetBasis !== 'dc') return;
const string = sld.inputs.mode === 'string';
const outerKey = string ? 'b_cols' : 'rings_c';
const innerKey = string ? 's_subs' : 'mv_per_ring_c';
const outer0 = sld.inputs[outerKey];
const inner0 = sld.inputs[innerKey];
let best = null;
for (let inner = 1; inner <= FIT_INNER_MAX; inner += 1) {
sld.inputs[innerKey] = inner;
for (let outer = 1; outer <= FIT_OUTER_MAX; outer += 1) {
sld.inputs[outerKey] = outer;
const s = computeSldStats();
const got = sld.targetBasis === 'ac' ? s.ac_mw : s.dc_mwp;
if (!Number.isFinite(got) || got <= 0) continue;
const error = Math.abs(got - target);
// Ties, and near-ties, go to the layout closest to the one already on
// screen. Without this the fit rearranges the plant for a rounding
// difference and the drawing jumps for no reason the user can see.
const drift = Math.abs(inner - inner0) + Math.abs(outer - outer0) / 100;
if (!best
|| error < best.error - 1e-9
|| (Math.abs(error - best.error) <= 1e-9 && drift < best.drift)) {
best = { outer, inner, error, got, drift };
}
}
}
if (!best) {
sld.inputs[outerKey] = outer0;
sld.inputs[innerKey] = inner0;
return;
}
sld.inputs[outerKey] = best.outer;
sld.inputs[innerKey] = best.inner;
sld.fitResidualPct = ((best.got - target) / target) * 100;
// What one more block would have added. A residual means nothing without
// it: 10% off a plant whose smallest step is 9 MW is exact, and 10% off
// one whose step is 0.5 MW is a miss.
const oneMore = (() => {
sld.inputs[outerKey] = best.outer + 1;
const s = computeSldStats();
sld.inputs[outerKey] = best.outer;
const got = sld.targetBasis === 'ac' ? s.ac_mw : s.dc_mwp;
return Number.isFinite(got) ? Math.abs(got - best.got) : null;
})();
sld.fitQuantumMw = oneMore;
}
NS.sizingArithmetic = Object.freeze({
generation: '202609012205',
DEVELOPMENT_STAGES,
DEVELOPMENT_SUCCESS,
BIFACIAL_BY_GCR,
FIT_OUTER_MAX,
FIT_INNER_MAX,
financeNumber,
physicalInputs,
buildStats,
consistency,
stringStats,
centralStats,
applyDevelopmentStageDefaults,
applyMountingBifacial,
screeningFinance,
computeStats,
fitToStatedCapacity
});
})();
/* ══════════════════════════════════════════════════════════════════════
technology-coverage - which technologies the measurement runs for, and
what each measurement is a measurement OF
══════════════════════════════════════════════════════════════════════
WHAT WAS MEASURED BEFORE THIS MODULE WAS WRITTEN.
The request was to extend the nearest-substation computation to the twenty
wider-fleet REPD technologies, on the report that it ran only for the
spine. Driven in Chrome against the live composition (v9.88, generation
202609030234) on the wider fleet's own MAP link:
?repd_ref=8795 ... &technology=biomass Caledon Green, Landfill Gas
?repd_ref=626 ... &technology=biomass Pitsea Tipp, Landfill Gas
Both arrived, flew, opened the card, ticked the Subs control and DREW THE
LINKS. Caledon Green measured 1.74 km at 132 kV, 2.98 km at 275 kV and
5.70 km at 33 kV; Pitsea Tipp named Coryton South Substation at 7.70 km
and printed its 400 kV scope sentence with the denominator in it. So the
wider fleet was ALREADY computing, and a change that claimed to enable it
would have been a change that did nothing while saying it did something.
There IS a four-member technology allow-list in this estate:
const allowedTechnologies = new Set(['solar','bess','wind_onshore','wind_offshore']);
It lives at line 805 of the IMMUTABLE SHELL, atlas/releases/
202608300453-atlas-v9/ventus-corev8engine.js, inside the shell's own
focusCanonicalProjectDeepLink(). It rejects every value the wider fleet
can send, because those four are exactly the four types the wider fleet is
DEFINED as excluding. Its rejection is caught, and its only effects are a
console line and a flyTo the arrival lane in this cartridge has already
performed - which is why the measurement runs anyway. The shell is carried
forward verbatim by contract and this module does not reach into it.
WHAT THIS MODULE ACTUALLY CHANGES.
One thing: OFFSHORE WIND NOW MEASURES. It used to open a card and withhold
the distance, on the reasoning that a turbine in the North Sea does not
reach the nearest onshore substation by a straight line. The reasoning
about routes was right and is kept in full below; the conclusion was
over-cautious. An offshore project's export cable does land at an onshore
substation, so the distance to the nearest mapped substation is a real
measurement of a real thing, provided the card says what it measured.
WHAT "NEAREST" CANNOT BE MADE TO MEAN HERE, MEASURED RATHER THAN ASSUMED.
The coordinator asked for an onshore-only filter, so that "nearest onshore
substation" would mean onshore. The pinned substation product cannot carry
one. Counted over all 5,800 features of
atlas/releases/202608300453-atlas-v9/data/grid_substations.geojson
the only properties present are voltage (5,800), name (4,460), operator
(3,264), brand (1,310), source (684), type (72), capacity (15) and colour
(3). The OSM `location` tag - the field that would say offshore, platform
or underwater - is present on ZERO of them.
That leaves the name, and the name does not separate them either. Fourteen
features carry "offshore" in their name; read against their coordinates, at
least four are ONSHORE substations serving an offshore wind farm, which is
precisely what an offshore project should be measured to - Hornsea
(-0.2598, 53.6582) and Hornsea Two (-0.2604, 53.6568) at 400/220 kV,
Thanet's explicitly-named onshore substation (1.3459, 51.3089), and the
European Offshore Wind Deployment Centre (-2.0650, 57.2158). The rest are
genuinely platforms at sea: Neart na Gaoithe North and South, Sheringham
Shoal 1 and 2, Humber Gateway, Westermost Rough, Rampion, Burbo Bank 2.
So a name filter would drop Hornsea - a landfall connection - from the very
search it was supposed to sharpen. No onshore filter is applied, and this
module says so on the card instead of pretending to one. An offshore
project is measured against the SAME 5,800 features, at the SAME >=33 kV
floor, by the SAME straight line as every other technology, and the card
carries two extra sentences: that the line crosses water and is not the
export cable, and that the set searched contains substations that are
themselves offshore - named where one is returned, so the reader can see
which. A stated limit, rather than a hidden one. A filter whose predicate
is wrong four times in fourteen is worse than no filter, because it looks
like precision.
WHAT DOES NOT CHANGE, AND MUST NOT.
- The straight line stays. It is the measurement, it is first, and the
corridor-estimate module still sits beside it saying how far off a
built route typically is. Nothing here replaces it.
- Every superlative keeps carrying its sample. This module supplies the
sample LABEL for each policy so the card cannot print "nearest"
without printing what it searched.
- The coordinate denominator stays. The operator publishes connection
points and only a fraction carry coordinates; that count is computed
at render time by nearestScope() and is not restated here, because a
literal would go quietly false the day the pinned product moves.
- Nothing here grades anything. No verdict word appears anywhere in this
module, not even to disown one: the sandbox proof greps the served
bytes for them and cannot tell a comment from a card, which is the
right way round. A distance and a voltage, stated, and the things a
distance cannot answer named rather than implied.
THE ROSTER IS BY NAME ON PURPOSE.
The Atlas never receives a raw REPD technology. Pipeline News' MAP link
sends `technology=<t>`, the COLOUR BUCKET - so twenty raw types arrive as
nine bucket values, and "Landfill Gas" reaches this cartridge as
"biomass". Every one of the twenty is listed below against its bucket, so
a proof can assert coverage by REPD name rather than by bucket, and so
anyone reading this can see that the twenty are accounted for rather than
assumed.
══════════════════════════════════════════════════════════════════════ */
(function installTechnologyCoverage() {
'use strict';
const SCHEMA = 'gridatlas.technology-coverage.v1';
/* The twenty wider-fleet REPD technologies, each against the bucket the
MAP link actually sends. Counts are the live wider-fleet payload,
202609030009, 1,104 rows - carried so a drift in either side is visible
rather than silent. Every one of the 1,104 rows carries a usable
coordinate pair; none is withheld for want of a location. */
const WIDER_FLEET = Object.freeze([
Object.freeze({ repd: 'Landfill Gas', bucket: 'biomass', rows: 275 }),
Object.freeze({ repd: 'Anaerobic Digestion', bucket: 'biomass', rows: 253 }),
Object.freeze({ repd: 'Biomass (dedicated)', bucket: 'biomass', rows: 159 }),
Object.freeze({ repd: 'EfW Incineration', bucket: 'biomass', rows: 122 }),
Object.freeze({ repd: 'Small Hydro', bucket: 'hydro', rows: 108 }),
Object.freeze({ repd: 'Hydrogen', bucket: 'hydrogen', rows: 60 }),
Object.freeze({ repd: 'Advanced Conversion Technologies', bucket: 'act', rows: 37 }),
Object.freeze({ repd: 'Large Hydro', bucket: 'hydro', rows: 28 }),
Object.freeze({ repd: 'Pumped Storage Hydroelectricity', bucket: 'hydro', rows: 15 }),
Object.freeze({ repd: 'Tidal Stream', bucket: 'tidal', rows: 14 }),
Object.freeze({ repd: 'Sewage Sludge Digestion', bucket: 'biomass', rows: 12 }),
Object.freeze({ repd: 'Geothermal', bucket: 'geothermal', rows: 5 }),
Object.freeze({ repd: 'Shoreline Wave', bucket: 'tidal', rows: 4 }),
Object.freeze({ repd: 'Liquid Air Energy Storage', bucket: 'caes', rows: 2 }),
Object.freeze({ repd: 'Biomass (co-firing)', bucket: 'biomass', rows: 2 }),
Object.freeze({ repd: 'Hot Dry Rocks (HDR)', bucket: 'geothermal', rows: 2 }),
Object.freeze({ repd: 'Compressed Air Energy Storage', bucket: 'caes', rows: 2 }),
Object.freeze({ repd: 'Fuel Cell (Hydrogen)', bucket: 'hydrogen', rows: 2 }),
Object.freeze({ repd: 'Flywheels', bucket: 'flywheel', rows: 1 }),
Object.freeze({ repd: 'Unknown', bucket: 'other', rows: 1 })
]);
/* The spine, for completeness: the four the wider fleet is defined as
excluding, and the four the shell's allow-list accepts. */
const SPINE = Object.freeze(['solar', 'bess', 'wind_onshore', 'wind_offshore']);
/* Offshore wind, in every spelling the register and the engine use. This
is no longer a withholding set - it selects a DIFFERENT NOTE, not a
different answer. */
const OFFSHORE_TECHS = Object.freeze([
'wind_offshore', 'wind_offshore_operational'
]);
const OFFSHORE = new Set(OFFSHORE_TECHS);
/* Named as offshore in the substation product. Used only to LABEL a
returned row, never to remove one - see the header for the four onshore
substations this pattern also matches, which is exactly why it does not
filter. */
const OFFSHORE_NAMED = /\boffshore\b/i;
const ONSHORE_NAMED = /\bonshore\b/i;
const PRODUCT = Object.freeze({
features: 5800,
with_location_tag: 0,
offshore_in_name: 14,
of_those_onshore: 4,
source: 'atlas/releases/202608300453-atlas-v9/data/grid_substations.geojson'
});
/* The sentence the card prints under an offshore project's distances. It
keeps every word of the old withholding note that was ABOUT ROUTES,
because none of that reasoning was wrong; it drops only the conclusion
that therefore nothing should be measured. */
const OFFSHORE_NOTE =
'This is a straight line from the project to the nearest mapped '
+ 'substation, and for an offshore project that line crosses water. It is '
+ 'not the export cable and not its length. An offshore project reaches an '
+ 'offshore substation, an export cable and a landfall before anything '
+ 'onshore, and the route inland is then chosen for consent and ground '
+ 'conditions rather than for distance, so the built length is longer than '
+ 'this by an amount no distance can tell you.';
const OFFSHORE_SET_NOTE =
'The set searched is the same 5,800 mapped substations used for every '
+ 'other technology. It carries no field saying which of them are onshore: '
+ 'the OSM location tag is absent from all 5,800, and of the 14 whose name '
+ 'contains "offshore" at least 4 are onshore substations serving an '
+ 'offshore wind farm. No onshore filter is applied, because one built on '
+ 'the name would drop those 4 - including Hornsea at 400/220 kV, which is '
+ 'a landfall connection. Where a result is itself named as an offshore '
+ 'substation it is marked below.';
/* The label under which a measurement is made. The card must never print
the word "nearest" without one of these beside it. */
const SAMPLE = Object.freeze({
mapped_substations: 'nearest of the mapped substations at or above the '
+ 'voltage floor that this search could see'
});
function bucketOf(tech) {
return String(tech == null ? '' : tech).trim();
}
/**
* What the measurement is, for one technology id.
*
* There is no `measure: false` branch. Every technology the register or
* the wider fleet can send is measured; what differs is the note that
* goes with it. A technology this module has never heard of is measured
* too - the arrival lane already continues past an unknown id, and
* refusing arithmetic over two coordinates because a string was
* unfamiliar is how 109 offshore projects got nothing at all.
*/
function policy(tech) {
const id = bucketOf(tech);
const offshore = OFFSHORE.has(id);
return Object.freeze({
technology: id || null,
measure: true,
offshore,
sample: SAMPLE.mapped_substations,
/* Both notes, in order, for offshore; nothing extra for the rest.
The generic straight-line-is-not-a-route caveat is the card's own
and is printed for every technology either way. */
notes: Object.freeze(offshore ? [OFFSHORE_NOTE, OFFSHORE_SET_NOTE] : [])
});
}
/**
* Is this substation NAME one of the ones the product calls offshore?
* Labelling only. A true here marks a row; it never removes one.
*/
function namedOffshore(name) {
const text = String(name == null ? '' : name);
return OFFSHORE_NAMED.test(text) && !ONSHORE_NAMED.test(text);
}
/** The roster, by REPD name, for a proof to assert against. */
function widerFleetNames() {
return WIDER_FLEET.map(entry => entry.repd);
}
/** The bucket values the wider fleet's MAP link can actually send. */
function widerFleetBuckets() {
return [...new Set(WIDER_FLEET.map(entry => entry.bucket))].sort();
}
/** Every wider-fleet technology measures. Stated as a function so a proof
cannot pass by reading a literal that stopped being true. */
function measuredCount() {
return WIDER_FLEET.filter(entry => policy(entry.bucket).measure).length;
}
const NS = (window.__GRIDATLAS_MODULES__ = window.__GRIDATLAS_MODULES__ || {});
NS.technologyCoverage = Object.freeze({
schema: SCHEMA,
wider_fleet: WIDER_FLEET,
spine: SPINE,
offshore_techs: OFFSHORE_TECHS,
product: PRODUCT,
offshore_note: OFFSHORE_NOTE,
offshore_set_note: OFFSHORE_SET_NOTE,
sample: SAMPLE,
policy,
namedOffshore,
widerFleetNames,
widerFleetBuckets,
measuredCount,
/* Said once, here, so no caller has to phrase it and none can soften it. */
not_a_connection: 'A distance to a mapped substation is not a connection, '
+ 'a capacity, a queue position or an offer, for any technology on this '
+ 'list.',
shell_allow_list_note: 'The four-member technology allow-list in the '
+ 'immutable shell rejects every wider-fleet value and is caught; the '
+ 'arrival lane in this cartridge has already flown and carded by then, '
+ 'so it costs a console line and nothing else. The shell is carried '
+ 'forward verbatim and is not edited here.'
});
})();
/**
* 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
* ------------------