In this section
- Declared Connections render · gridatlas / atlas/modules/202609012128-declared-connections.js lines 1–258
- Sizing Arithmetic render · gridatlas / atlas/modules/202609012205-sizing-arithmetic.js lines 1–442
Declared Connections
A JavaScript file in the atlas folder of GridAtlas that works with nearest transmission (`nearestTransmission`) (units: kV, MVA, MW), covering substations, 400kV, solar and 132kV.
rendergridatlas / atlas/modules/202609012128-declared-connections.js · lines 1–258 of 258 · version 2026-09-01 21:28 · pattern worksAt (shared by 6 files)
- What it does
- It lists and searches substations, 400kV, solar and 132kV. Defines worksAt, provisional, resolve, nearestTransmission. Side effects: changes the web page (DOM).
- 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: substations, 400kV, solar, 132kV, 33kV.
- Inputs & outputs
- Voltage levels named: 400kV, 132kV, 33kV.
- Downstream impact
- Used directly by 6 files: Grid Vicinity (gridatlas); Document Context Test (gridatlas); Document Context (gridatlas); Standalone (stars); and 2 more. Reached from 389 other entry points, including Code Generator — Index Page (code-generator, https://ventusltd.github.io/code-generator/); Generate (code-generator, https://ventusltd.github.io/code-generator/); 404 (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/404.html).
- What it achieves
- It is built from the works at helper (`worksAt`), the provisional step (`provisional`) and the resolve step (`resolve`). The 400kV public record: what each DCO-scale scheme has DECLARED as its point of connection, taken from Development Consent Orders, Planning Inspectorate documents and public project statements. Its code works with 400 kV, 132 kV and 33 kV.
- Why it matters
- Loaded by the Genome page in Ventus Grid Engine at https://ventusltd.github.io/ventus-grid-engine/genome/. Also imported by 4 files, including Grid Vicinity, Document Context and Standalone, from Stars and Ventus Grid Engine. Checked by Document Context Test.
- Application
- gridatlas · atlas/modules · script
- Uses
- none found
- Used by
- named by URL in Grid Vicinity (estate URL), referenced by Document Context Test (new URL import.meta.url), named by URL in Document Context (estate URL), named by URL in Standalone (estate URL), named by URL in Build Graph (estate URL), named by URL in Ventus Grid Engine — Genome Page (estate URL)
- Produces
- worksAt, provisional, resolve, nearestTransmission
- Defines here
- worksAt, provisional, resolve, nearestTransmission
- 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/202609012128-declared-connections.js:1-258 · blob 75b53270f4335ae8c26fb22b90a6ad100b934141 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/**
* Module: declared-connections
*
* The 400 kV public record: what each DCO-scale scheme has DECLARED as its
* point of connection, taken from Development Consent Orders, Planning
* Inspectorate documents and public project statements. The table binds a
* register identity (REPD ref) to a NAMED substation, and the functions
* here bind that name to the served payload and measure the distance -
* measured, never asserted.
*
* The rule this exists to keep: bind to the public record or say nothing.
* A nearest-substations list is a measurement; it was listing closer 33 and
* 132 kV points under schemes whose Order names a 400 kV connection, which
* read as connecting them to the wrong network. This table is the answer,
* and it is data with three small functions, so it lives in a module where
* a proof can read every record and a cut can hash it on its own.
*
* WHAT IT WILL NOT DO
* It does not say whether a connection is available, likely or adequate. A
* declared point of connection is a fact about a consent, not a judgement
* about the network. `poc_status` distinguishes a far end that exists from
* one not yet built or under construction, because drawing both the same
* would say something untrue.
*
* Extracted from the sld-sandbox body at generation 202609012128 (UTC),
* record for record; the parity proof reads the previously served bytes
* and asserts the table is unchanged.
*
* Pure. No DOM, no network, no state. Depends on: geodesy.
*/
(() => {
'use strict';
const NS = (window.__GRIDATLAS_MODULES__ = window.__GRIDATLAS_MODULES__ || {});
if (NS.declaredConnections) return;
const geodesy = NS.geodesy;
if (!geodesy) throw new Error('declared-connections requires the geodesy module');
const distanceKm = geodesy.distanceKm;
const RECORDS = Object.freeze({
'10914': { works: "an up to 400 kV substation collating the satellite sites at 132 kV and site generation at 33 kV (Work No. 4A)",
poc_works: "reuse of an ex-generation bay: busbars, a 400 kV 3-phase 4000 A breaker, metering and protection (Work No. 5)",
substation: 'Cottam Substation',
via: 'a new 400 kV scheme substation consented within the DCO',
source: 'Cottam Solar Project Order 2024, granted 5 Sep 2024 (EN010133)' },
'10915': { works: "an up to 400 kV substation collating the satellite sites at 132 kV and site generation at 33 kV (Work No. 4A)",
poc_works: "reuse of an ex-generation bay: busbars, a 400 kV 3-phase 4000 A breaker, metering and protection (Work No. 5)",
substation: 'Cottam Substation',
via: 'a new 400 kV scheme substation consented within the DCO',
source: 'Cottam Solar Project Order 2024, granted 5 Sep 2024 (EN010133)' },
'10916': { works: "an up to 400 kV customer substation at West Burton 3 with reactive power units; up to 132 kV site substations at WB1 and WB2 (Works 3A-3C)",
poc_works: "a new GIS bay by extension of main busbar 4 and reserve busbar 3/4 gas zones (Work No. 4)",
substation: 'West Burton Substation',
via: 'a new 400 kV customer substation at West Burton 3 and a 400 kV cable to the former generator bay',
source: 'West Burton Solar Project Order, granted 24 Jan 2025 (EN010132)' },
'10917': { works: "an up to 400 kV customer substation at West Burton 3 with reactive power units; up to 132 kV site substations at WB1 and WB2 (Works 3A-3C)",
poc_works: "a new GIS bay by extension of main busbar 4 and reserve busbar 3/4 gas zones (Work No. 4)",
substation: 'West Burton Substation',
via: 'a new 400 kV customer substation at West Burton 3 and a 400 kV cable to the former generator bay',
source: 'West Burton Solar Project Order, granted 24 Jan 2025 (EN010132)' },
'9809': { works: "a scheme substation with reactive power units and a 400 kV harmonic filter compound (Work No. 3)",
poc_works: "one new 400 kV generation bay at Cottam (Work No. 4C)",
substation: 'Cottam Substation',
via: 'a new 400 kV scheme substation and a 7.5 km 400 kV underground cable',
source: 'Gate Burton Energy Park Order, granted 2024 (EN010131)' },
'9810': { works: "a scheme substation with reactive power units and a 400 kV harmonic filter compound (Work No. 3)",
poc_works: "one new 400 kV generation bay at Cottam (Work No. 4C)",
substation: 'Cottam Substation',
via: 'a new 400 kV scheme substation and a 7.5 km 400 kV underground cable',
source: 'Gate Burton Energy Park Order, granted 2024 (EN010131)' },
'12281': { works: "two scheme substations, each 2 x 400/33 kV 150/75/75 MVA transformers with 400 kV GIS (Works 3A-3B)",
poc_works: "the standard 400 kV bay kit at a free bay at Cottam (Work No. 5)",
substation: 'Cottam Substation',
via: 'an 18.5 km 400 kV underground cable to a free bay',
source: 'Tillbridge Solar Order 2025 (EN010142)' },
'12282': { works: "two scheme substations, each 2 x 400/33 kV 150/75/75 MVA transformers with 400 kV GIS (Works 3A-3B)",
poc_works: "the standard 400 kV bay kit at a free bay at Cottam (Work No. 5)",
substation: 'Cottam Substation',
via: 'an 18.5 km 400 kV underground cable to a free bay',
source: 'Tillbridge Solar Order 2025 (EN010142)' },
'14806': { poc_status: 'not_built',
poc_status_note: 'the point of connection is NGET\u2019s new substation beside the existing High Marnham, built as Great Grid Upgrade works; the line is drawn to the existing site',
substation: 'High Marnham Substation',
via: "NGET's new substation adjacent to the existing High Marnham (Great Grid Upgrade)",
source: 'One Earth Solar Farm DCO, consented (EN010159)' },
'14807': { poc_status: 'not_built',
poc_status_note: 'the point of connection is NGET\u2019s new substation beside the existing High Marnham, built as Great Grid Upgrade works; the line is drawn to the existing site',
substation: 'High Marnham Substation',
via: "NGET's new substation adjacent to the existing High Marnham (Great Grid Upgrade)",
source: 'One Earth Solar Farm DCO, consented (EN010159)' },
'13599': { works: "up to four 33-400 kV transformers (160 t, up to 15 x 9.5 x 10.5 m each) in a compound of up to 40,000 m2 (ES Ch.2 s2.8)",
poc_works: "a National Grid-delivered extension of Bicker Fen, AIS or GIS, sited for multiple customers (s2.13)",
substation: 'Bicker Fen Substation',
via: 'a 400 kV cable and a consented extension of Bicker Fen shared with Heckington Fen',
source: 'Beacon Fen Energy Park DCO, granted Aug 2026 (EN010151)' },
'13600': { works: "up to four 33-400 kV transformers (160 t, up to 15 x 9.5 x 10.5 m each) in a compound of up to 40,000 m2 (ES Ch.2 s2.8)",
poc_works: "a National Grid-delivered extension of Bicker Fen, AIS or GIS, sited for multiple customers (s2.13)",
substation: 'Bicker Fen Substation',
via: 'a 400 kV cable and a consented extension of Bicker Fen shared with Heckington Fen',
source: 'Beacon Fen Energy Park DCO, granted Aug 2026 (EN010151)' },
'9806': { works: "transformers with bunding and blast walls, switchgear, and harmonic filtering reactive power compensation (Work No. 4)",
poc_works: "a new generation bay plus an AIS-or-GIS extension and a cable sealing end compound at Bicker Fen (Works 6A-6C)",
substation: 'Bicker Fen Substation',
via: 'the consented Bicker Fen extension shared with Beacon Fen',
source: 'Heckington Fen Solar Park DCO, granted (EN010123)' },
'9807': { works: "transformers with bunding and blast walls, switchgear, and harmonic filtering reactive power compensation (Work No. 4)",
poc_works: "a new generation bay plus an AIS-or-GIS extension and a cable sealing end compound at Bicker Fen (Works 6A-6C)",
substation: 'Bicker Fen Substation',
via: 'the consented Bicker Fen extension shared with Beacon Fen',
source: 'Heckington Fen Solar Park DCO, granted (EN010123)' },
'13644': { poc_status: 'under_construction',
poc_status_note: 'a new 400 kV four-bay substation is under construction at Thorpe Marsh',
substation: 'Thorpe Marsh Substation',
via: 'a new 400 kV four-bay substation under construction at Thorpe Marsh',
source: 'public planning and contractor records; construction under way' },
'19801': { poc_status: 'under_construction',
poc_status_note: 'a new 400 kV four-bay substation is under construction at Thorpe Marsh',
substation: 'Thorpe Marsh Substation',
via: 'a new 400 kV four-bay substation under construction at Thorpe Marsh',
source: 'public planning and contractor records; construction under way' },
/* Little Crow is the counter-archetype and belongs here precisely
because it is NOT a 400 kV story: no customer transmission
substation, no long cable, and a point of connection that is a
circuit crossing the site rather than a substation to draw a line
to. Stating that plainly is worth more than drawing nothing. */
'6557': { poc_kind: 'circuit', poc_status: 'existing',
circuit: 'the Keadby \u2013 Broughton \u2013 Teed \u2013 Scawby Brook overhead 132 kV line circuit (Northern Powergrid)',
via: 'a looped connection into an existing 132 kV circuit within the site, with 99.9 MW of export capacity secured',
kv: 132,
source: 'Little Crow Solar Park Grid Network Constraints Report, EN010101, November 2020' },
'7175': { poc_kind: 'circuit', poc_status: 'existing',
circuit: 'the Keadby \u2013 Broughton \u2013 Teed \u2013 Scawby Brook overhead 132 kV line circuit (Northern Powergrid)',
via: 'a looped connection into an existing 132 kV circuit within the site, with 99.9 MW of export capacity secured',
kv: 132,
source: 'Little Crow Solar Park Grid Network Constraints Report, EN010101, November 2020' },
'11928': { substation: 'West Burton Substation',
via: 'a 400 kV grid connection at the former power station site (West Burton C); financial close July 2026',
source: 'public project records' }
});
/* Public works at named substations, shown wherever the name is - the
"customer and NG substations that do not exist yet" half of the logic.
Descriptions of the network, never advice about a scheme. */
const SUBSTATION_WORKS = Object.freeze({
'thorpe marsh substation':
'A new 400 kV four-bay substation is under construction here (public record).',
'high marnham substation':
'NGET is building a new substation adjacent to the existing one (Great Grid Upgrade, public record).',
'bicker fen substation':
'A consented extension here will connect Beacon Fen and Heckington Fen (public record).'
});
const worksAt = (name) => SUBSTATION_WORKS[String(name || '').toLowerCase()] || 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. The distance is the one
part that must be measured, so it is the one part marked pending. */
function provisional(repdRef) {
const declared = RECORDS[String(repdRef || '')];
if (!declared) return null;
if (declared.poc_kind === 'circuit') {
// Nothing to measure to and nothing to draw: say what is declared.
return { poc: declared.circuit, kv: declared.kv || null, at: null,
km: null, pending: false, kind: 'circuit',
poc_status: declared.poc_status || 'existing',
via: declared.via, source: declared.source, works: null,
customer_works: declared.works || null, poc_works: declared.poc_works || null };
}
return {
poc: declared.substation, kv: 400, at: null, km: null, pending: true,
kind: 'substation', poc_status: declared.poc_status || 'existing',
poc_status_note: declared.poc_status_note || null,
via: declared.via, source: declared.source,
works: worksAt(declared.substation),
customer_works: declared.works || null,
poc_works: declared.poc_works || null
};
}
/* Bind the declared name to the served payload. Only a substation of the
declared class (>= 400 kV) with exactly that name counts; a 132 kV site
that happens to share the name is not the point of connection. */
function resolve(repdRef, origin, subs) {
const declared = RECORDS[String(repdRef || '')];
if (!declared) return null;
if (declared.poc_kind === 'circuit') return provisional(repdRef);
const wanted = declared.substation.toLowerCase();
const works = SUBSTATION_WORKS[wanted] || null;
const match = (Array.isArray(subs) ? subs : [])
.filter(s => String(s.name).toLowerCase() === wanted
&& Array.isArray(s.kv) && s.kv[0] >= 400)
.sort((a, b) => b.kv[0] - a.kv[0])[0] || null;
if (!match) {
return { poc: declared.substation, kv: 400, at: null, km: null,
kind: 'substation', poc_status: declared.poc_status || 'existing',
poc_status_note: declared.poc_status_note || null,
via: declared.via, source: declared.source, works,
customer_works: declared.works || null,
poc_works: declared.poc_works || null };
}
return { poc: match.name, kv: Math.round(match.kv[0]), at: match.at,
km: distanceKm(origin[0], origin[1], match.at[0], match.at[1]),
kind: 'substation', poc_status: declared.poc_status || 'existing',
poc_status_note: declared.poc_status_note || null,
via: declared.via, source: declared.source, works,
customer_works: declared.works || null,
poc_works: declared.poc_works || null };
}
/* The nearest transmission (>= 400 kV) substation in the payload, and
separately the nearest one WITH A NAME: an unnamed OSM node can win on
raw distance and the reader still wants an identity. Two measurements,
no judgement about either. */
function nearestTransmission(origin, subs) {
let best = null;
let bestNamed = null;
/* The size of the sample this superlative is drawn from. Counted here
rather than recounted by a caller, because the predicate below is
what decides eligibility and a second implementation of it would
drift from this one. */
let considered = 0;
for (const s of (Array.isArray(subs) ? subs : [])) {
if (!(Array.isArray(s.kv) && s.kv[0] >= 400)) continue;
considered += 1;
const km = distanceKm(origin[0], origin[1], s.at[0], s.at[1]);
if (!best || km < best.km) {
best = { name: s.name || 'Unnamed substation', km, at: s.at };
}
if (s.name && (!bestNamed || km < bestNamed.km)) {
bestNamed = { name: s.name, km, at: s.at };
}
}
if (best) {
best.considered = considered;
best.works = worksAt(best.name);
if (bestNamed && bestNamed.name !== best.name) {
best.named = bestNamed;
best.named.works = worksAt(bestNamed.name);
}
}
return best;
}
NS.declaredConnections = Object.freeze({
schema: 'gridatlas.module.declared-connections.v1',
records: RECORDS,
substationWorks: SUBSTATION_WORKS,
count: Object.keys(RECORDS).length,
isDeclared: (repdRef) => Object.prototype.hasOwnProperty.call(RECORDS, String(repdRef || '')),
worksAt,
provisional,
resolve,
nearestTransmission
});
})();Sizing Arithmetic
A JavaScript module in the atlas folder of GridAtlas that builds stats (`buildStats`) and applies development stage defaults (`applyDevelopmentStageDefaults`) and mounting bifacial (`applyMountingBifacial`) (units: MW, MVA, MWh).
rendergridatlas / atlas/modules/202609012205-sizing-arithmetic.js · lines 1–442 of 573 · version 2026-09-01 22:05 · pattern screeningFinance (shared by 7 files)
- What it does
- Defines 12 functions or classes, including physicalInputs, buildStats, consistency, stringStats, centralStats. Side effects: changes the web page (DOM).
- 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, cables.
- Downstream impact
- Used directly by 2 files: Build Graph (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/genome/); Ventus Grid Engine — Genome Page (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/genome/). Reached from 1 other entry point, including Genome Workflow (ventus-grid-engine).
- What it achieves
- It builds stats (`buildStats`), applies development stage defaults (`applyDevelopmentStageDefaults`) and applies mounting bifacial (`applyMountingBifacial`). The screening arithmetic of the single-line diagram (SLD) sandbox: physical inputs to array statistics, the three named ratios (design, export, headroom), the string and central topologies with their corrected nameplates, the finance port of `gis-sld-v5-finance.js`. Its code works with 4.4 MVA, 352 kVA and 44.8 MW.
- Why it matters
- Loaded by the Genome page in Ventus Grid Engine at https://ventusltd.github.io/ventus-grid-engine/genome/. Also imported by Build Graph, from Ventus Grid Engine.
- Application
- gridatlas · atlas/modules · JavaScript module
- Uses
- none found
- Used by
- named by URL in Build Graph (estate URL), named by URL in Ventus Grid Engine — Genome Page (estate URL)
- Produces
- physicalInputs, buildStats, consistency, stringStats, centralStats, financeNumber, applyDevelopmentStageDefaults, applyMountingBifacial, screeningFinance, computeStats, fitToStatedCapacity, oneMore
- Defines here
- physicalInputs, buildStats, consistency, stringStats, centralStats, financeNumber, applyDevelopmentStageDefaults, applyMountingBifacial, screeningFinance, computeStats
- 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/202609012205-sizing-arithmetic.js:1-442 · blob 19cef31fbf8abdd7c1beb5106b56afe091be9916 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/**
* Module: sizing-arithmetic
*
* The screening arithmetic of the SLD sandbox: physical inputs to array
* statistics, the three named ratios (design, export, headroom), the
* string and central topologies with their corrected nameplates, the
* finance port of gis-sld-v5-finance.js, and the two-variable fit that
* lands a layout on the capacity the register states.
*
* Lifted out of the sld-sandbox body at generation 202609012205 (UTC),
* expression for expression. The body closed over its state object and
* its finance defaults; here both are parameters. Nothing else changed,
* and the parity proof evaluates the last inline copy beside this module
* on the same inputs and asserts identical values.
*
* WHAT IT WILL NOT DO
* It grades nothing. A ratio below one is stated with its meaning; an
* export set by the transformers is stated as the design fact it is. The
* finance figures are a screening model with the reference's own inputs
* and are labelled as such by the panel that shows them.
*
* Pure. No DOM, no network, no state of its own: fitToStatedCapacity
* mutates the state object it is handed, as the body's did, and says so.
*/
(() => {
const NS = window.__GRIDATLAS_MODULES__ = window.__GRIDATLAS_MODULES__ || {};
if (NS.sizingArithmetic) return;
function physicalInputs(inputs) {
const i = inputs;
if (i.mode === 'central') {
return {
mod_wp: i.mod_wp_c, mod_l: i.mod_l_c, mod_w: i.mod_w_c,
gcr: i.gcr_c, gross_factor: i.gross_factor_c,
};
}
return {
mod_wp: i.mod_wp, mod_l: i.mod_l, mod_w: i.mod_w,
gcr: i.gcr, gross_factor: i.gross_factor,
};
}
function buildStats(inputs, o) {
const p = physicalInputs(inputs);
const dcMwp = (o.module_count * p.mod_wp) / 1e6;
const acMw = o.ac_mw_direct != null ? o.ac_mw_direct
: (o.dc_ac_ratio > 0 ? dcMwp / o.dc_ac_ratio : 0);
const netModArea = o.module_count * p.mod_l * p.mod_w;
const netArrayArea = p.gcr > 0 ? netModArea / p.gcr : 0;
return {
total_blocks: o.total_blocks,
module_count: o.module_count,
dc_mwp: dcMwp,
ac_mw: acMw,
dc_ac_ratio: acMw > 0 ? dcMwp / acMw : o.dc_ac_ratio,
net_array_area_m2: netArrayArea,
gross_site_area_m2: netArrayArea * p.gross_factor,
block_ground_area_m2: o.total_blocks > 0 ? netArrayArea / o.total_blocks : 0,
production_substation_ac_mva: o.production_substation_ac_mva || 0,
ring_main_ac_mva: o.ring_main_ac_mva || 0,
warning: o.warning || 'Check skid rating, transformer rating, cable ratings, protection, losses and grid compliance.'
};
}
/* Three numbers that must agree, and did not.
----------------------------------------------------------------------
Measured on the shipped defaults, the panel produced three different
values for one quantity:
string stated DC/AC input 1.200
reported DC/AC 1.040
implied by the hardware 0.945
A DC/AC ratio below one is not a design choice, it is a contradiction: it
says the array is smaller than the inverters it feeds, which nobody
builds. And in central mode the reported ratio was 2.402 against an
inverter ratio of 1.200 — exactly double, because AC had correctly become
the LIMITING nameplate (the transformers) while the ratio was still being
read as though it were the inverter nameplate. Both numbers were right
about different things and both were called DC/AC.
There are three distinct quantities here and the panel now keeps them
apart by name:
DC the array, MWp
inverter AC the inverters can convert, MW
export the smaller of the inverters and the transformers, MVA
The DESIGN ratio is DC over inverter AC, which is the number the industry
means by DC/AC and the one a stated 1.2 refers to. The EXPORT ratio is DC
over the export limit, which is what determines clipping and curtailment.
Reporting one of them under the other's name is how a plant ends up
described as 2.4 when it was specified as 1.2.
Nothing here changes a layout. It changes what the numbers are called, and
says so out loud when they disagree with each other. */
/* There was an auto-reconciler here. It is deleted, not disabled.
----------------------------------------------------------------------
It computed a "consistent" strings-per-inverter count from the stated
DC/AC ratio and assigned it to sld.inputs.z_strings, on the reasoning that
the original's 18 gives a block DC/AC of 0.945 and that nobody builds an
array smaller than its own inverters. That reasoning was wrong: the
reference documents 28 string inverters at 352 kVA making 9,856 kVA ahead
of an 8.96 MVA skid, and the oversizing is the design.
The default was reverted, and the reconciler was left behind uncalled.
Flagged by the Codex source gate as a stop-ship, and it was right. Dead
code that ASSIGNS to a reference input is not inert: it is one future
handler away from silently rewriting the design this cartridge exists to
reproduce, and it would do so quietly, in a place nobody would look.
This is the same lesson as the dead .grid-cell grading CSS removed from
Pipeline News earlier tonight — a rule with no caller is one edit from
having one — and I repeated the mistake within hours of writing it down.
Deleted rather than commented out, for the same reason. */
function consistency(inputs, stats) {
const i = inputs;
const string = i.mode === 'string';
const inverterAcMw = string
? (stats.total_blocks * i.y_invs * i.string_inv_kva) / 1000
: stats.total_blocks * i.inv_ac_mw_c;
const skidAcMva = string
? stats.total_blocks * i.string_skid_mva
: (i.mv_per_ring_c * i.rings_c) * i.central_skid_mva_c;
const exportMva = Math.min(inverterAcMw, skidAcMva);
/* Three ratios, three names. They describe different pairs of things and
collapsing them is how a plant specified at 1.2 gets reported as 2.4.
design array DC MWp / inverter AC MW what "DC/AC" means
export array DC MWp / export MVA what drives clipping
headroom inverter AC MW / export MVA how hard the inverters are
pushed against their skids
The third is the one that says whether the inverters are oversized
against the transformers, and in this design they deliberately are. */
const designRatio = inverterAcMw > 0 ? stats.dc_mwp / inverterAcMw : null;
const exportRatio = exportMva > 0 ? stats.dc_mwp / exportMva : null;
const headroomRatio = exportMva > 0 ? inverterAcMw / exportMva : null;
const statedRatio = string ? Number(i.dc_ac_ratio) : (
i.inv_ac_mw_c > 0 ? i.inv_dc_mw_c / i.inv_ac_mw_c : null);
const notes = [];
/* Descriptive, not a verdict.
An earlier version of this called a design ratio below one a
contradiction that "nobody builds". That was wrong about this design:
the reference sandbox documents 28 string inverters at 352 kVA making
9,856 kVA ahead of an 8.96 MVA skid, and oversizing inverters against
the transformer is a deliberate choice, not an arithmetic fault. The
panel states the number and what it means; it does not grade it. */
if (Number.isFinite(designRatio) && designRatio < 1) {
notes.push('Array DC divided by inverter AC is ' + designRatio.toFixed(2)
+ ' from the module, string and inverter counts shown.');
}
// The stated ratio is an instruction. If the hardware does not honour it,
// the hardware is what will be built.
if (Number.isFinite(designRatio) && Number.isFinite(statedRatio)
&& statedRatio > 0 && Math.abs(designRatio - statedRatio) / statedRatio > 0.05) {
notes.push('Stated DC/AC ' + statedRatio.toFixed(2) + ', but the module '
+ 'and inverter counts give ' + designRatio.toFixed(2)
+ '. The model displays both and does not rewrite either input.');
}
// The transformers, not the inverters, set the export.
if (Number.isFinite(inverterAcMw) && Number.isFinite(skidAcMva)
&& inverterAcMw > skidAcMva * 1.001) {
// Stated as the design fact it is, with the ratio, not as a fault.
notes.push('Inverters total ' + inverterAcMw.toFixed(1) + ' MW against '
+ skidAcMva.toFixed(1) + ' MVA of skid transformer, a ratio of '
+ (headroomRatio || 0).toFixed(2) + '. Export is set by the '
+ 'lower nameplate in this screening model. The connection agreement '
+ 'and electrical design determine the applicable export constraint.');
}
return {
dc_mwp: stats.dc_mwp,
inverter_ac_mw: inverterAcMw,
skid_ac_mva: skidAcMva,
export_mva: exportMva,
design_dc_ac: designRatio,
export_dc_ac: exportRatio,
inverter_to_export: headroomRatio,
stated_dc_ac: Number.isFinite(statedRatio) ? statedRatio : null,
notes,
};
}
function stringStats(inputs) {
const i = inputs;
if (i.mod_wp <= 0 || i.mod_l <= 0 || i.mod_w <= 0 || i.x_mods <= 0) {
return buildStats(i, { total_blocks: 0, module_count: 0, dc_ac_ratio: i.dc_ac_ratio });
}
const total_blocks = i.b_cols * i.s_subs;
const module_count = total_blocks * i.y_invs * i.z_strings * i.x_mods;
const inverterAcMaxMva = (i.y_invs * i.string_inv_kva) / 1000;
const production = i.string_skid_mva;
let warning;
if (inverterAcMaxMva > production) {
warning = 'Inverter ACmax exceeds the skid transformer rating. Verify temperature rating, overload strategy and clipping assumptions.';
} else if (i.string_inv_kva > 500) {
warning = 'Large string inverter rating selected. Verify LV switchgear, transformer, cable loading and protection.';
}
return buildStats(i, {
total_blocks, module_count, dc_ac_ratio: i.dc_ac_ratio,
ac_mw_direct: total_blocks * production,
production_substation_ac_mva: production,
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