In this section
- Standalone geodesy · stars / library/standalone.mjs lines 1940–2639
Standalone
A JavaScript module in the library folder of Stars that maps Renewable Energy Planning Database (REPD) master and heavy emitters UK, using SHA-256, and uses data from the GridAtlas repository.
Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.
Evidence
- line 2 comment: // Generated by the modular star 2026-12-05T23:26:43.596Z. Each export is one family's earliest-seen copy, unchanged; the comment links its source.
geodesystars / library/standalone.mjs · lines 1940–2639 of 12585 (continued from section 1562) · Entry point · pattern segmentConductors (shared by 2 files)
- What it does
- It maps REPD master, heavy emitters UK, notice and substations. Defines 1111 functions or classes, including f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf. 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 terms in the code: substations, 750kV, 400kV, 275kV, 132kV, 66kV.
- Inputs & outputs
- In: data source: gridatlas data; JSON file repd_master.json; JSON file heavy_emitters_uk.json; JSON file notice.json; form fields (user input). Out: canvas drawing. Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326. Voltage levels named: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV, 1.5kV, 1500V.
- Downstream impact
- Used directly by 4 files: Code (stars, https://ventusltd.github.io/stars/code.html); Proof (stars); Modular Star Workflow (stars); Testcode — Code Record Page (globalgrid2050, https://globalgrid2050.com/testcode/202609141754/code-record/). Reached from 383 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 snaps coordinate (`snapCoordinate`), paints cursor (`paintCursor`) and sets plan (`setPlan`). Compiled library of self-contained JavaScript functions that appear in two or more places across Ventusltd code. Its code works with 33 kV, 132 kV and 275 kV. It responds to abort events.
- Why it matters
- Loaded by the Code page at https://ventusltd.github.io/stars/code.html and 1 other page. Run by Proof and Modular Star Workflow.
- Application
- stars · library · JavaScript module
- 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
- GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL), Declared Connections (estate URL)
- Used by
- named by URL in Code (estate URL), run by Proof (script call), run by Modular Star Workflow (workflow run), named by URL in Testcode — Code Record Page (estate URL)
- Produces
- f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf, f8775_parametersOf, f5168_escapeHTML, f8321_suppliedArrivalFields, f8850__anonymous_, f8786_crossing, f8788_legality, f8789_startNodes
- Defines here
- f133736_nearestAt, f133737_anchorFor, f134177_plan, num, f31947_parseCsv, f31948__anonymous_, f1342__anonymous_, f31857__anonymous_, f9094_invariant, f31954_classifyLegacy, f7434_normBearing, f32429_atlasUrlV9_5_1, f9100_invariant, f9234_canonicalItem, f7537_atlasHaversineKm, f32324_atlasUrl, f32342_atlasUrlV9_2, f32369_atlasUrlV9_3, f135050_geometry, f1599_normalise, f7688_zeroStats, f7689_buildStats, f146344_inside, f146473_segDist, f1579_validateAsset, f1601_arraysEqual, f1608_formatNumber, f1613_relationshipSummary, f1619_updateChart, f7792_sleepForPrintPack
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- stars@030ebc202d35959fecd162327892f671d1d9a0cc library/standalone.mjs:1940-2639 · blob fc3d8c8b93e14d4a56b8a26da47071d60bc5bc4d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, storage · domain stage: unknown · users: none · canonical: unknown
// Family #133736 · element #133736 · 40 places in 2 repositories · https://github.com/Ventusltd/star-electron-star/blob/241bcca9eb4045e9be5c058ec24f9f5bd26c7af4/pick.mjs#L112-L141
export const f133736_nearestAt = function nearestAt(ix, wx, wy, reach) {
const { start, items, cols, rows, size, minX, minY } = ix;
const cx = Math.min(cols - 1, Math.max(0, (wx - minX) / size | 0));
const cy = Math.min(rows - 1, Math.max(0, (wy - minY) / size | 0));
const maxRing = Math.ceil(reach / size);
let best = -1, bestD = reach * reach;
for (let ring = 0; ring <= maxRing; ring++) {
/* Everything in an earlier ring is closer than anything this ring can hold,
so a hit inside (ring - 1) * size is already the answer. */
if (best >= 0 && bestD < Math.pow((ring - 1) * size, 2)) break;
const x0 = cx - ring, x1 = cx + ring, y0 = cy - ring, y1 = cy + ring;
for (let gy = y0; gy <= y1; gy++) {
if (gy < 0 || gy >= rows) continue;
/* Only the perimeter of the ring is new; its interior was ring - 1. */
const edge = (gy === y0 || gy === y1);
for (let gx = x0; gx <= x1; gx += (edge ? 1 : (x1 - x0 || 1))) {
if (gx < 0 || gx >= cols) continue;
const c = gy * cols + gx;
for (let p = start[c], e = start[c + 1]; p < e; p++) {
const i = items[p];
const dx = ix.pos[i * 2] - wx, dy = ix.pos[i * 2 + 1] - wy;
const d = dx * dx + dy * dy;
if (d < bestD) { bestD = d; best = i; }
}
}
}
}
return best;
};
// Family #133737 · element #133737 · 40 places in 2 repositories · https://github.com/Ventusltd/star-electron-star/blob/241bcca9eb4045e9be5c058ec24f9f5bd26c7af4/read.mjs#L40-L47
export const f133737_anchorFor = function anchorFor(keys, key) {
let lo = 0, hi = keys.length - 1, ans = -1;
while (lo <= hi) {
const mid = (lo + hi) >> 1;
if (keys[mid] <= key) { ans = mid; lo = mid + 1; } else hi = mid - 1;
}
return ans;
};
// Family #134177 · element #134177 · 38 places in 2 repositories · https://github.com/Ventusltd/star-electron-star/blob/241bcca9eb4045e9be5c058ec24f9f5bd26c7af4/pilot-rules.js#L3-L50
export const f134177_plan = function plan(sentence, ctx) {
const t = sentence.replace(/Ω/g, ' ohm').toLowerCase(); const out = [];
const num = re => { const m = t.match(re); return m ? parseFloat(m[1]) : null; };
const appNames = (ctx && ctx.appNames) || []; const DIES = (ctx && ctx.dies) || [];
const appHit = appNames.find(n => t.includes(n)) || (t.includes('atlas') ? 'gridatlas' : null);
const dieHit = t.includes('substation') ? 'substation' : t.includes('sld') ? 'sld-sandbox' : /\bsearch\b/.test(t) ? 'search' : /(bridge|parquet)/.test(t) ? 'bridge' : DIES.find(d => t.includes(d.split('-')[0])) || null;
const wantArrange = /(arrange|re-?arrange|layout|lay out|as a cpu|floorplan|floor plan|\brings?\b|\bgrid\b|sector|by app)/.test(t);
const earthNames = ['spider sandbox', 'periodic table', 'gridatlas', 'pipelinenews', 'pipeline news', 'globalgrid2050', 'grid-dictionary', 'spiders', 'star-solar-star', 'code-generator', 'testcode', 'galaxies-wafers', 'ventus-grid-engine', 'stars'];
if (/\b(back to space|to space|space)\b/.test(t) && !/\bland\b/.test(t)) return { commands: ['space'], because: 'back to the wafer' };
if (/\b(land|land on|take me to|go down to|visit|open|show me the app)\b/.test(t)) { const e = earthNames.find(n => t.includes(n)); if (e) return { commands: [`land ${e.replace('pipeline news', 'pipelinenews')}`], because: 'down to the live app' }; }
if (/\bplasma\b/.test(t)) out.push('plasma');
if (/\b(lightning|strike)\b/.test(t)) out.push(`lightning ${appHit || 'gridatlas'}`);
if (/(voltage drop|volt drop|vdrop)/.test(t)) {
const A = num(/(\d+(?:\.\d+)?)\s*(?:amps?\b|a\b)/), L = num(/(\d+(?:\.\d+)?)\s*(?:metres?|meters?|m\b)/), R = num(/(\d+(?:\.\d+)?)\s*(?:ohms?|Ω)/);
let pf = num(/(?:pf|power factor)\s*(?:of\s*)?(\d+(?:\.\d+)?)\s*%/) ?? num(/(\d+(?:\.\d+)?)\s*%\s*(?:pf|power factor)/); if (pf != null) pf = pf / 100; if (pf == null) pf = num(/(?:pf|power factor)\s*(?:of\s*)?(\d?\.?\d+)/) ?? num(/(\d?\.?\d+)\s*(?:pf|power factor)/);
const X = num(/(?:reactance|x)\s*(?:of\s*)?(\d+(?:\.\d+)?)/);
const ph = /single/.test(t) ? 'single' : 'three';
const missing = [A == null && 'current in A', L == null && 'length in m', R == null && 'resistance in ohm/km', pf == null && 'power factor'].filter(Boolean);
if (missing.length) return { commands: [], because: `voltage drop needs: ${missing.join(', ')} (say e.g. 120 A, 250 m, 0.32 ohm/km, pf 0.95)` };
out.push(`run voltage-drop.voltageDropVolts ${JSON.stringify(X != null ? { currentA: A, lengthM: L, resistanceOhmPerKm: R, reactanceOhmPerKm: X, powerFactor: pf, phases: ph } : { currentA: A, lengthM: L, resistanceOhmPerKm: R, powerFactor: pf, phases: ph })}`);
} else if (/(diversif|houses|dwellings|units)/.test(t) && /\bk(w|va)\b/.test(t)) {
const n = num(/(\d+)\s*(?:houses|dwellings|units)/), kw = num(/(\d+(?:\.\d+)?)\s*k(?:w|va)\b/), cf = num(/(?:coincidence|diversity)\s*(?:factor\s*)?(?:of\s*)?(\d?\.\d+)/);
if (n == null || kw == null || cf == null) return { commands: [], because: 'diversified demand needs: number of houses, kW each, coincidence factor' };
out.push(`run diversified-demand.diversifiedDemandKw ${JSON.stringify({ unitCount: n, perUnitKw: kw, coincidenceFactor: cf })}`);
}
if (/(entangle|\btwin|coupl)/.test(t)) out.push('entangle');
const key = num(/(?:read|block|key|fly to|go to|twin|state|qubit|measure)\s+(\d{1,7})\b/) ?? (/(voltage|amp|metre|meter|ohm|houses|kw|kva)/.test(t) ? null : num(/\b(\d{2,7})\b/));
if (/(\bread\b|show me the code|the real line)/.test(t) && key != null) out.push(`read ${key}`);
else if (/(fly to|go to|\bblock\b|\bkey\b)/.test(t) && key != null) out.push(`block ${key}`);
if (/\b(seed|grow)\b/.test(t)) out.push(`seed ${sentence.replace(/^.*?\b(seed|grow)\b\s*/i, '') || sentence}`);
if (/\b(twin)\b/.test(t) && key != null) out.push(`twin ${key}`); if (/\b(qubit)\b/.test(t) && key != null) out.push(`qubit ${key}`); if (/\b(measure)\b/.test(t) && key != null) out.push(`measure ${key}`);
if (/(versions|history|\bclock\b|over time)/.test(t)) out.push(/\b(run|play|all)\b/.test(t) ? 'clock run' : 'versions');
if (/\b(explode|blow)\b/.test(t)) out.push('explode');
if (/\b(implode|come back)\b/.test(t)) out.push('implode');
if (/\bhome\b/.test(t)) out.push('home');
if (/(engine|calculations?|modules?)/.test(t) && /\b(list|show|what)\b/.test(t)) out.push('engine');
if (/\b(apps|applications)\b/.test(t) && /\b(list|show|what|which)\b/.test(t)) out.push('apps');
if (dieHit && !out.some(c => c.startsWith('lightning'))) out.push(`die ${dieHit}`);
else if (appHit && !out.some(c => /^(lightning|plasma)/.test(c))) out.push(appHit === 'gridatlas' && /\batlas\b/.test(t) && !t.includes('gridatlas') ? 'light atlas' : `app ${appHit}`);
if (wantArrange) out.push(`arrange ${/(floorplan|floor plan|cpu)/.test(t) ? 'floorplan' : /\brings?\b/.test(t) ? 'rings' : /\bgrid\b/.test(t) ? 'grid' : /(app|sector)/.test(t) ? 'apps' : 'time'}`);
if (/(\breset\b|start again|\bclear\b)/.test(t)) out.push('reset');
if (!out.length) return { commands: [], because: 'no command matched; try words like: atlas, app <name>, plasma, lightning, arrange floorplan, voltage drop 120 A 250 m 0.32 ohm pf 0.95, read <key>, entangle' };
return { commands: [...new Set(out)], because: 'matched by words and numbers in your sentence' };
};
// Family #31947 · element #31947 · 88 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/202609051156/tests/check_v7_2_project_table_export.mjs#L32-L61
export const f31947_parseCsv = function parseCsv(content) {
const text = content.startsWith("\ufeff") ? content.slice(1) : content;
const rows = [];
let row = [];
let cell = "";
let quoted = false;
for (let index = 0; index < text.length; index += 1) {
const character = text[index];
if (quoted && character === '"' && text[index + 1] === '"') {
cell += '"';
index += 1;
} else if (character === '"') {
quoted = !quoted;
} else if (!quoted && character === ",") {
row.push(cell);
cell = "";
} else if (!quoted && character === "\r" && text[index + 1] === "\n") {
row.push(cell);
rows.push(row);
row = [];
cell = "";
index += 1;
} else {
cell += character;
}
}
row.push(cell);
rows.push(row);
return rows;
};
// Family #31948 · element #31948 · 88 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/202609051156/tests/check_v7_2_project_table_export.mjs#L71-L73
export const f31948__anonymous_ = (item) => (
item.repdRef === "8470" && item.targetInCurrentUniverse === false
);
// Family #1342 · element #1342 · 44 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-substations.js#L15-L25
export const f1342__anonymous_ = item => ({
type: "Feature",
geometry: item.geometry || {
type: "Point",
coordinates: [
item.lon ?? item.lng ?? item.longitude ?? item.Longitude ?? item.X,
item.lat ?? item.latitude ?? item.Latitude ?? item.Y
]
},
properties: item.properties || item
});
// Family #31857 · element #31857 · 86 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/202609051156/tests/browser_smoke_v8_1.mjs#L98-L100
export const f31857__anonymous_ = (buttons) => (
buttons.map((button) => button.dataset.technology)
);
// Family #9094 · element #9094 · 150 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/data/canonical-projects-v9-4.js#L5-L7
export const f9094_invariant = function invariant(condition, message) {
if (!condition) throw new Error(`V9.4 canonical projects: ${message}`);
};
// Family #31954 · element #31954 · 84 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/202609051156/tests/check_v9_1.mjs#L35-L41
export const f31954_classifyLegacy = (properties) => {
const raw = String(properties.raw_tech || "").toLowerCase();
if (properties.tech === "solar" || properties.tech === "solar_roof") return "solar";
if (properties.tech === "bess") return "bess";
if (properties.tech === "wind") return raw.includes("offshore") ? "wind_offshore" : "wind_onshore";
return null;
};
// Family #7434 · element #7434 · 41 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-drawing.js#L5-L7
export const f7434_normBearing = function normBearing(deg) {
return ((deg % 360) + 360) % 360;
};
// Family #32429 · element #32429 · 10 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/v9.5.1/scripts/plugins/projects-v9-5-1.js#L42-L53
export const f32429_atlasUrlV9_5_1 = function atlasUrlV9_5_1(project) {
if (project.geometry_status !== "valid") return "";
const url = new URL("https://globalgrid2050.com/repd_grid_atlasv8/");
url.searchParams.set("repd_ref", project.repd_ref);
url.searchParams.set("project", project.name);
url.searchParams.set("technology", project.technology);
url.searchParams.set("capacity_mw", project.capacity_mw);
url.searchParams.set("latitude", project.latitude);
url.searchParams.set("longitude", project.longitude);
url.searchParams.set("zoom", "12");
return url.href;
};
// Family #9100 · element #9100 · 149 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/data/canonical-projects-v9-5.js#L5-L7
export const f9100_invariant = function invariant(condition, message) {
if (!condition) throw new Error(`V9.5 canonical projects: ${message}`);
};
// Family #9234 · element #9234 · 149 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/plugins/newspaper-v9-5.js#L12-L18
export const f9234_canonicalItem = function canonicalItem(item) {
return item
&& item.role === "PRIMARY_MATCH"
&& item.eligible_for_news_signal === true
&& String(item.repd_ref || "")
&& String(item.gg_project_id || "");
};
// Family #7537 · element #7537 · 40 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-drawing.js#L25-L33
export const f7537_atlasHaversineKm = function atlasHaversineKm(a, b) {
const R = 6378.137;
const r = Math.PI / 180;
const lon1 = a[0], lat1 = a[1], lon2 = b[0], lat2 = b[1];
const dLat = (lat2 - lat1) * r;
const dLon = (lon2 - lon1) * r;
const x = Math.sin(dLat / 2) ** 2 + Math.cos(lat1 * r) * Math.cos(lat2 * r) * Math.sin(dLon / 2) ** 2;
return R * 2 * Math.atan2(Math.sqrt(x), Math.sqrt(1 - x));
};
// Family #32324 · element #32324 · 8 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/v9.4/scripts/plugins/projects-v9-1.js#L18-L30
export const f32324_atlasUrl = function atlasUrl(project) {
const url = new URL("https://globalgrid2050.com/repd_grid_atlasv8/");
url.searchParams.set("repd_ref", project.repd_ref);
url.searchParams.set("project", project.name);
url.searchParams.set("technology", project.technology);
url.searchParams.set("capacity_mw", project.capacity_mw);
if (project.geometry_status === "valid") {
url.searchParams.set("latitude", project.latitude);
url.searchParams.set("longitude", project.longitude);
url.searchParams.set("zoom", "12");
}
return url.href;
};
// Family #32342 · element #32342 · 8 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/v9.4/scripts/plugins/projects-v9-2.js#L40-L51
export const f32342_atlasUrlV9_2 = function atlasUrlV9_2(project) {
if (project.geometry_status !== "valid") return "";
const url = new URL("https://globalgrid2050.com/repd_grid_atlasv8/");
url.searchParams.set("repd_ref", project.repd_ref);
url.searchParams.set("project", project.name);
url.searchParams.set("technology", project.technology);
url.searchParams.set("capacity_mw", project.capacity_mw);
url.searchParams.set("latitude", project.latitude);
url.searchParams.set("longitude", project.longitude);
url.searchParams.set("zoom", "12");
return url.href;
};
// Family #32369 · element #32369 · 8 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/uk_renewables_pipeline/v9.4/scripts/plugins/projects-v9-3.js#L42-L53
export const f32369_atlasUrlV9_3 = function atlasUrlV9_3(project) {
if (project.geometry_status !== "valid") return "";
const url = new URL("https://globalgrid2050.com/repd_grid_atlasv8/");
url.searchParams.set("repd_ref", project.repd_ref);
url.searchParams.set("project", project.name);
url.searchParams.set("technology", project.technology);
url.searchParams.set("capacity_mw", project.capacity_mw);
url.searchParams.set("latitude", project.latitude);
url.searchParams.set("longitude", project.longitude);
url.searchParams.set("zoom", "12");
return url.href;
};
// Family #135050 · element #135050 · 8 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/testcode/wafer-development-environment/202609191315-proof-4/conductor.html#L45-L61
export const f135050_geometry = function geometry(c){
const o = { wires:[] };
if (c.lay === 'concentric') {
o.d = Math.sqrt(4*c.area / (c.n*Math.PI)); // from A = n x pi d^2 / 4
o.D = (2*c.layers + 1) * o.d; // across the layers
o.wires.push([0,0]);
for (let k = 1; k <= c.layers; k++) for (let j = 0; j < 6*k; j++) { const a = 2*Math.PI*j/(6*k) + (k%2 ? 0 : Math.PI/(6*k));
o.wires.push([k*o.d*Math.cos(a), k*o.d*Math.sin(a)]); }
o.fill = c.n*o.d*o.d / (o.D*o.D); // metal area over circle area
o.Dc = Math.sqrt(4*c.area / (Math.PI*c.compactFill)); // the circle the same metal needs at the compacted fill
o.metalArea = c.n*Math.PI*o.d*o.d/4;
} else {
o.d = c.d; o.metalArea = c.n*Math.PI*o.d*o.d/4; o.fill = 0.75; o.D = o.d*Math.sqrt(c.n/o.fill);
for (let i = 0; i < c.n; i++) { const r = (o.D/2 - o.d/2)*Math.sqrt((i+0.5)/c.n), a = i*2.399963229728653; o.wires.push([r*Math.cos(a), r*Math.sin(a)]); }
}
return o;
};
// Family #1599 · element #1599 · 104 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/pipelinenews_intelligence/202608311343/assets/202608291447-app.mjs#L211-L220
export const f1599_normalise = function normalise(value) {
return String(value ?? "")
.normalize("NFKD")
.replace(/[\u0300-\u036f]/g, "")
.toLocaleLowerCase("en-GB")
.replace(/&/g, " and ")
.replace(/[^a-z0-9.-]+/g, " ")
.replace(/\s+/g, " ")
.trim();
};
// Family #7688 · element #7688 · 38 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-calculations.js#L18-L30
export const f7688_zeroStats = function zeroStats(dc_ac_ratio, mods_pallet, mods_container) {
return {
total_blocks: 0, block_ground_area_m2: 0, dc_mwp: 0, ac_mw: 0, module_count: 0,
net_mod_area_m2: 0, net_array_area_m2: 0, gross_site_area_m2: 0,
dc_ac_ratio, pallets: 0, containers: 0, spares_pct: 0,
modules_inc_spares: 0, pallets_inc_spares: 0, containers_inc_spares: 0,
mods_pallet, mods_container,
combiner_boxes_per_inverter: 0, total_combiner_boxes: 0,
string_inverter_kva: 0, production_substation_ac_mva: 0, ring_main_ac_mva: 0,
central_inverter_mwac: 0, combiner_box_dc_kw: 0, combiner_design_limit_kwdc: 0,
engineering_warning: "Check assumptions"
};
};
// Family #7689 · element #7689 · 38 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-calculations.js#L32-L75
export const f7689_buildStats = function buildStats(opts) {
const {
total_blocks, module_count, ac_mw_direct, dc_ac_ratio, physical,
combiner_boxes_per_inverter, total_combiner_boxes,
string_inverter_kva, inverter_acmax_mva, production_substation_ac_mva, ring_main_ac_mva,
central_inverter_mwac, central_inverter_mwdc, combiner_box_dc_kw, combiner_design_limit_kwdc,
engineering_warning
} = opts;
const { mod_wp, mod_l, mod_w, gcr, gross_factor, mods_pallet, mods_container, spare_pct } = physical;
const dc_mwp = (module_count * mod_wp) / 1_000_000;
const ac_mw = ac_mw_direct != null ? ac_mw_direct : (dc_ac_ratio > 0 ? dc_mwp / dc_ac_ratio : 0);
const actual_dc_ac = ac_mw > 0 ? dc_mwp / ac_mw : dc_ac_ratio;
const net_mod_area_m2 = module_count * mod_l * mod_w;
const net_array_area_m2 = gcr > 0 ? net_mod_area_m2 / gcr : 0;
const gross_site_area_m2 = net_array_area_m2 * gross_factor;
const block_ground_area_m2 = total_blocks > 0 ? net_array_area_m2 / total_blocks : 0;
const pallets = Math.ceil(module_count / mods_pallet);
const containers = Math.ceil(module_count / mods_container);
const modules_inc_spares = Math.ceil(module_count * (1 + spare_pct / 100));
const pallets_inc_spares = Math.ceil(modules_inc_spares / mods_pallet);
const containers_inc_spares = Math.ceil(modules_inc_spares / mods_container);
return {
total_blocks, block_ground_area_m2, dc_mwp, ac_mw, module_count,
net_mod_area_m2, net_array_area_m2, gross_site_area_m2, dc_ac_ratio: actual_dc_ac,
pallets, containers, spares_pct: spare_pct,
modules_inc_spares, pallets_inc_spares, containers_inc_spares,
mods_pallet, mods_container,
combiner_boxes_per_inverter: combiner_boxes_per_inverter || 0,
total_combiner_boxes: total_combiner_boxes || 0,
string_inverter_kva: string_inverter_kva || 0,
inverter_acmax_mva: inverter_acmax_mva || 0,
production_substation_ac_mva: production_substation_ac_mva || 0,
ring_main_ac_mva: ring_main_ac_mva || 0,
central_inverter_mwac: central_inverter_mwac || 0,
central_inverter_mwdc: central_inverter_mwdc || 0,
combiner_box_dc_kw: combiner_box_dc_kw || 0,
combiner_design_limit_kwdc: combiner_design_limit_kwdc || 0,
engineering_warning: engineering_warning || "Check assumptions"
};
};
// Family #146344 · element #146344 · 36 places in 2 repositories · https://github.com/Ventusltd/energy-transition-simulator/blob/a165ce6d56cb22271828874d68d570e8fa5e428a/prototype/mod/engine/block-build.mjs#L248-L255
export const f146344_inside = (poly, x, y) => {
let c = false;
for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
const [xi, yi] = poly[i], [xj, yj] = poly[j];
if ((yi > y) !== (yj > y) && x < (xj - xi) * (y - yi) / (yj - yi) + xi) c = !c;
}
return c;
};
// Family #146473 · element #146473 · 36 places in 2 repositories · https://github.com/Ventusltd/energy-transition-simulator/blob/a165ce6d56cb22271828874d68d570e8fa5e428a/prototype/mod/engine/plant-layout.mjs#L77-L80
export const f146473_segDist = (x, y, ax, ay, bx, by) => {
const dx = bx - ax, dy = by - ay, d2 = dx * dx + dy * dy, t = d2 ? Math.max(0, Math.min(1, ((x - ax) * dx + (y - ay) * dy) / d2)) : 0;
return Math.hypot(x - ax - t * dx, y - ay - t * dy);
};
// Family #1579 · element #1579 · 162 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/pipelinenews_intelligence/202608311343/assets/202608272130-sector-intelligence.mjs#L86-L91
export const f1579_validateAsset = function validateAsset(asset) {
if (!asset || typeof asset !== "object") throw new Error("sector payload asset is missing");
if (!/^data\/202608272130-sector-intelligence\.json$/u.test(asset.url)) throw new Error("sector payload URL changed");
if (!Number.isSafeInteger(asset.bytes) || asset.bytes <= 0) throw new Error("sector payload byte count is invalid");
if (!/^[a-f0-9]{64}$/u.test(asset.sha256)) throw new Error("sector payload digest is invalid");
};
// Family #1601 · element #1601 · 103 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/pipelinenews_intelligence/202608311343/assets/202608291447-app.mjs#L226-L230
export const f1601_arraysEqual = function arraysEqual(left, right) {
return Array.isArray(left) && Array.isArray(right)
&& left.length === right.length
&& left.every((value, index) => value === right[index]);
};
// Family #1608 · element #1608 · 103 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/pipelinenews_intelligence/202608311343/assets/202608291447-app.mjs#L301-L303
export const f1608_formatNumber = function formatNumber(value) {
return (Number(value) || 0).toLocaleString("en-GB", { maximumFractionDigits: 2 });
};
// Family #1613 · element #1613 · 103 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/pipelinenews_intelligence/202608311343/assets/202608291447-app.mjs#L331-L336
export const f1613_relationshipSummary = function relationshipSummary(item) {
const development = Array.isArray(item.development_repd_refs) ? item.development_repd_refs.length : 0;
const direct = Array.isArray(item.direct_related_repd_refs) ? item.direct_related_repd_refs.length : 0;
const siblings = Array.isArray(item.planning_sibling_repd_refs) ? item.planning_sibling_repd_refs.length : 0;
return `${development} development · ${direct} direct · ${siblings} planning sibling record(s)`;
};
// Family #1619 · element #1619 · 103 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/pipelinenews_intelligence/202608311343/assets/202608291447-app.mjs#L403-L407
export const f1619_updateChart = function updateChart(chart, value, maximum) {
if (!chart) return;
chart.data.datasets[0].data = [value, Math.max(maximum - value, 0)];
chart.update("none");
};
// Family #7792 · element #7792 · 37 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L1263-L1265
export const f7792_sleepForPrintPack = function sleepForPrintPack(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
};
// Family #57026 · element #57026 · 26 places in 2 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051211-substation-intelligence-v9-63.js#L5087-L5090
export const f57026_dropById = function dropById(doc, id) {
var existing = doc.getElementById(id);
if (existing && existing.parentNode) existing.parentNode.removeChild(existing);
};
// Family #58574 · element #58574 · 21 places in 2 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051455-substation-intelligence-v9-63.js#L5112-L5196
export const f58574_installPrintStyle = function installPrintStyle(doc) {
if (doc.getElementById('gridatlas-print-css')) return;
var style = doc.createElement('style');
style.id = 'gridatlas-print-css';
style.textContent = [
'#gridatlas-print-furniture{display:none}',
'#gridatlas-print-map{display:none}',
/* A SCREEN GRAB, NOT A SLIDE.
------------------------------------------------------------------------
This block used to hide the entire page -- `body > *{display:none}` --
and print the map raster edge to edge, as a presentation slide. The
architect printed one and the layer panel was gone: "The layers are
vital otherwise the reader doesnt know what is being shown on the map",
and then the contract itself: "Keep EVERYTHING IN THE PRINT, DONT TRY TO
BE CLEVER, JUST A SCREEN GRAP OF WHAT THE USER SEES ... just print what
is already being rendered on the display".
So nothing is hidden any more. The one substitution that remains is not
a choice: a WebGL canvas built without preserveDrawingBuffer is
transparent to every rasteriser outside the frame that drew it, so its
OWN captured pixels are laid in its OWN box. Everything else on the
sheet is the live DOM at the size it had on screen. */
'@media print{',
' @page{size:auto;margin:0}',
/* The reader's paper is not a layout instruction. The view keeps the
width and height it had on screen -- published by printView() as
--gpf-vw / --gpf-vh -- so nothing reflows to paper width, which is
what turned a 1390px-wide desktop view into a phone-shaped column. */
' html{background:#fff!important;height:auto!important;',
' overflow:visible!important}',
' body{background:#0b1416!important;margin:0!important;padding:0!important;',
' width:var(--gpf-vw,100%)!important;height:auto!important;',
' min-height:0!important;overflow:visible!important;display:block!important}',
' body>.dashboard{width:var(--gpf-vw,100%)!important;',
' height:var(--gpf-vh,100vh)!important;max-height:none!important;',
' min-height:0!important;overflow:hidden!important}',
/* The captured raster sits in the canvas's own box, at its own size.
Only ever shown when a capture actually succeeded: the body class is
added by printView() after the PNG decodes, so a failed capture prints
the live canvas exactly as before rather than a hole. */
' #gridatlas-print-map{display:block!important;position:absolute!important;',
' left:0!important;top:0!important;width:100%!important;height:100%!important;',
' max-width:none!important;max-height:none!important;object-fit:fill;',
' z-index:1;pointer-events:none}',
' body.gridatlas-print-raster .maplibregl-canvas{visibility:hidden!important}',
/* PROVENANCE BELOW THE RECORD, NEVER ON TOP OF IT.
The furniture used to be position:fixed;inset:0 with scrim bands at
both ends, painted over the map -- which was fine when the map WAS the
sheet, and is not fine now that the sheet is the reader's screen: a
band over the top covers the menu bar and a band over the bottom covers
the legend. "I like the headers and footers thats nice ... KEEP THAT",
so it is kept, as a strip AFTER the view. Nothing the reader was
looking at is obscured, and the stamp is still on the sheet. */
' #gridatlas-print-furniture{display:block!important;position:static!important;',
' width:var(--gpf-vw,100%)!important;box-sizing:border-box!important;',
' inset:auto!important;padding:5mm 7mm 6mm!important;background:#040a0c!important;',
' color:#eaf4f6!important;z-index:auto!important;',
' font:11px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace!important}',
' #gridatlas-print-furniture::before,#gridatlas-print-furniture::after{',
' content:none!important}',
' #gridatlas-print-furniture .gpf-head{letter-spacing:.28em;font-size:11px}',
' #gridatlas-print-furniture .gpf-brand{font-weight:700;margin-right:10px}',
' #gridatlas-print-furniture .gpf-sub{opacity:.65;letter-spacing:.16em}',
' #gridatlas-print-furniture .gpf-title{margin-top:2mm;font-size:15px;',
' letter-spacing:.02em}',
' #gridatlas-print-furniture .gpf-foot{position:static;margin-top:2mm;',
' display:flex;justify-content:space-between;gap:6mm;',
' font-size:8.5px;opacity:.75}',
/* The map chain is given an explicit print height rather than `auto`.
Measured at 202609050354: with `height:auto` the canvas was 385x0 on a
393x852 phone and 1392x0 on a 1400x900 desktop, and Page.printToPDF
produced ZERO image XObjects -- a sheet with no map on it. The height
has to be stated. */
' .map-container{position:relative!important;width:100%!important;',
' height:100%!important;max-height:100%!important;min-height:0!important}',
' #map,.maplibregl-map,.maplibregl-canvas-container{',
' height:100%!important;width:100%!important;max-height:100%!important}',
' .maplibregl-canvas{width:100%!important;height:100%!important}',
/* One sheet. The view plus its strip is the record; nothing may spill. */
' body>*{break-inside:avoid;page-break-inside:avoid}',
' body{page-break-after:avoid}',
'}'
].join('');
doc.head.appendChild(style);
};
// Family #58577 · element #58577 · 21 places in 2 repositories · https://github.com/Ventusltd/gridatlas/blob/f944f8dcbc09cd09c0895f0126682ec241cd576f/atlas/cartridges/202609051455-substation-intelligence-v9-63.js#L5261-L5266
export const f58577_unpinViewportSize = function unpinViewportSize(doc) {
var root = doc.documentElement;
if (!root || !root.style || !root.style.removeProperty) return;
root.style.removeProperty('--gpf-vw');
root.style.removeProperty('--gpf-vh');
};
// Family #7834 · element #7834 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-map.js#L41-L43
export const f7834_atlasV8CapacityExpression = function atlasV8CapacityExpression() {
return ["to-number", ["coalesce", ["get", "capacity"], ["get", "capacity_mw"], 0]];
};
// Family #7835 · element #7835 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-map.js#L45-L51
export const f7835_atlasV8AssetBaseFilter = function atlasV8AssetBaseFilter(assetKey) {
if (assetKey === "solar_operational") return ["==", ["get", "tech"], "solar"];
if (assetKey === "bess_operational") return ["==", ["get", "tech"], "bess"];
if (assetKey === "wind_onshore_operational") return ["==", ["get", "raw_tech"], "Wind Onshore"];
if (assetKey === "wind_offshore_operational") return ["==", ["get", "raw_tech"], "Wind Offshore"];
return true;
};
// Family #7836 · element #7836 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-map.js#L53-L55
export const f7836_atlasV8StatusExpression = function atlasV8StatusExpression() {
return ["downcase", ["to-string", ["coalesce", ["get", "status"], ["get", "Status"], ""]]];
};
// Family #7881 · element #7881 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L351-L358
export const f7881_gisSearchEscape = function gisSearchEscape(value) {
return String(value ?? "")
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
};
// Family #7882 · element #7882 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L360-L365
export const f7882_gisSearchPick = function gisSearchPick(prop, keys, fallback = "") {
for (const key of keys) {
if (prop && prop[key] !== undefined && prop[key] !== null && String(prop[key]).trim() !== "") return prop[key];
}
return fallback;
};
// Family #7883 · element #7883 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L367-L369
export const f7883_gisSearchValidPoint = function gisSearchValidPoint(feature) {
return feature && feature.geometry && feature.geometry.type === "Point" && Array.isArray(feature.geometry.coordinates);
};
// Family #7884 · element #7884 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L385-L389
export const f7884__anonymous_ = f => {
const p = f.properties || {};
return String(p.status || "").toLowerCase() === "operational" &&
(["solar", "bess"].includes(String(p.tech || "")) || ["Wind Onshore", "Wind Offshore"].includes(String(p.raw_tech || "")));
};
// Family #7901 · element #7901 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L573-L578
export const f7901_siteIntelPick = function siteIntelPick(prop, keys, fallback = "") {
for (const key of keys) {
if (prop && prop[key] !== undefined && prop[key] !== null && String(prop[key]).trim() !== "") return prop[key];
}
return fallback;
};
// Family #7902 · element #7902 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L580-L587
export const f7902_siteIntelEscape = function siteIntelEscape(value) {
return String(value ?? "")
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
};
// Family #7903 · element #7903 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L589-L591
export const f7903_siteIntelValidPoint = function siteIntelValidPoint(feature) {
return feature && feature.geometry && feature.geometry.type === "Point" && Array.isArray(feature.geometry.coordinates);
};
// Family #7904 · element #7904 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L593-L598
export const f7904_siteIntelFeatureCollection = function siteIntelFeatureCollection(raw) {
if (!raw) return { type: "FeatureCollection", features: [] };
if (raw.type === "FeatureCollection" && Array.isArray(raw.features)) return raw;
if (Array.isArray(raw)) return { type: "FeatureCollection", features: raw };
return { type: "FeatureCollection", features: [] };
};
// Family #7907 · element #7907 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L600-L614
export const f7907_siteIntelFlattenLines = function siteIntelFlattenLines(features) {
const lines = [];
(features || []).forEach(feature => {
if (!feature || !feature.geometry) return;
const prop = feature.properties || {};
if (feature.geometry.type === "LineString") {
lines.push({ type: "Feature", geometry: feature.geometry, properties: prop });
} else if (feature.geometry.type === "MultiLineString") {
feature.geometry.coordinates.forEach(coords => {
lines.push({ type: "Feature", geometry: { type: "LineString", coordinates: coords }, properties: prop });
});
}
});
return lines;
};
// Family #7917 · element #7917 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L713-L717
export const f7917_formatKm = function formatKm(value) {
if (!Number.isFinite(value)) return "n/a";
if (value < 1) return `${Math.round(value * 1000)} m`;
return `${value.toFixed(1)} km`;
};
// Family #7923 · element #7923 · 36 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051901/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/gis-sld-v5-ui.js#L748-L763
export const f7923_siteIntelOpportunityNotes = function siteIntelOpportunityNotes(results) {
const notes = [];
const hvDistances = [results.grid["132 kV"], results.grid["275 kV"], results.grid["400 kV"]]
.filter(Boolean)
.map(item => item.distanceKm);
const minHv = hvDistances.length ? Math.min(...hvDistances) : NaN;
const nearestSolar = results.assets.solar?.distanceKm;
const nearestBess = results.assets.bess?.distanceKm;
if (Number.isFinite(minHv) && minHv <= 5) notes.push("Near high voltage corridor. Worth deeper grid screening.");
if (Number.isFinite(minHv) && minHv > 15) notes.push("High voltage corridor not immediately nearby. Route and connection assumptions need care.");
if (Number.isFinite(nearestSolar) && nearestSolar <= 10) notes.push("Existing operating solar nearby. Compare pattern, grid route and project scale.");
if (Number.isFinite(nearestBess) && nearestBess <= 15) notes.push("Operating battery storage nearby. Check co location or grid constraint context.");
if (!notes.length) notes.push("Use as early spatial screening only. Formal grid and design studies still required.");
return notes;
};
// Family #144955 · element #144955 · 23 places in 2 repositories · https://github.com/Ventusltd/graphics-engines-open-source/blob/79e0bd8ee33844835e553fc84d552b6aa1521152/web/versions/202609262227-site-world/world/layers/grid.mjs#L19-L23
export const f144955_voltageClass = function voltageClass(kv) {
const v = Number(kv);
if (!(v > 0)) return '33kV';
return v >= 345 ? '400kV' : v >= 220 ? '275kV' : v >= 66 ? '132kV' : '33kV';
};
// Family #22870 · element #22870 · 18 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/testcode/202609060208/reported-project.mjs#L9-L19
export const f22870_validate = (claims, subject) => {
const metrics = new Set();
for (const claim of claims) {
if (claim.subject !== subject) throw Error('Cross-project attribution rejected');
if (metrics.has(claim.metric)) throw Error('Conflicting metric requires explicit resolution');
metrics.add(claim.metric);
if (!['reported_statement','reported_claim','reported_proposal'].includes(claim.kind)) throw Error('Unsupported evidence class');
if (typeof claim.value === 'number' && (!Number.isFinite(claim.value) || claim.value < 0)) throw Error('Invalid reported number');
if (claim.metric === 'solar_capacity' && claim.unit !== 'MW') throw Error('Capacity must retain MW units');
}
};
// Family #22871 · element #22871 · 18 places in 2 repositories · https://github.com/Ventusltd/globalgrid2050/blob/32ae2ded87b626ab573efa6887547f2128c55304/testcode/202609060208/reported-project.mjs#L3-L24
export const f22871_validateReportedProject = function validateReportedProject(project) {
if (project?.schema !== 'pipelinenews.reported-project.v1' || !project.primary_project) throw Error('Invalid project evidence schema');
const url = new URL(project.article_url);
if (url.protocol !== 'https:' || !['www.bbc.co.uk','www.bbc.com'].includes(url.hostname)) throw Error('Invalid publisher URL');
if (!project.publisher || !project.evidence_basis || !project.source_published_at) throw Error('Attribution required');
if (!Array.isArray(project.claims) || !Array.isArray(project.related_projects)) throw Error('Claims required');
const validate = (claims, subject) => {
const metrics = new Set();
for (const claim of claims) {
if (claim.subject !== subject) throw Error('Cross-project attribution rejected');
if (metrics.has(claim.metric)) throw Error('Conflicting metric requires explicit resolution');
metrics.add(claim.metric);
if (!['reported_statement','reported_claim','reported_proposal'].includes(claim.kind)) throw Error('Unsupported evidence class');
if (typeof claim.value === 'number' && (!Number.isFinite(claim.value) || claim.value < 0)) throw Error('Invalid reported number');
if (claim.metric === 'solar_capacity' && claim.unit !== 'MW') throw Error('Capacity must retain MW units');
}
};
validate(project.claims, project.primary_project);
for (const related of project.related_projects) validate(related.claims, related.name);
if (project.repd_ref === null && project.eligible_for_project_signal !== false) throw Error('Unmatched news cannot become a matched project signal');
return structuredClone(project);
};
// Family #172959 · element #173420 · 8 places in 2 repositories · https://github.com/Ventusltd/ventus-grid-engine/blob/ad566356a44e006682e956483d569f31ddbb9630/engine/compute-presentation.js#L2-L18
export const f172959_describeComputeReceipt = function describeComputeReceipt(receipt) {
const status = receipt?.status || 'not_requested';
const summary = receipt?.summary;
const nearest = summary?.nearest_km;
const labels = {
not_requested: 'Grid calculation not requested', requested: 'Grid calculation queued',
started: 'Calculating nearest mapped substations', completed_empty: 'Search completed: no mapped substations returned',
unsupported: 'Grid calculation unavailable', failed: 'Grid calculation failed',
};
if (status === 'completed' && Number.isFinite(nearest) && nearest >= 0) {
return { status, text: `Nearest mapped substation: ${nearest.toFixed(2)} km`,
distance_km: nearest, unit: 'km', scope: 'Geometric screening only; not an electrical connection, capacity or offer.' };
}
return { status, text: labels[status] || 'Grid calculation result unavailable',
reason: receipt?.reason || null, distance_km: null, unit: null,
scope: 'Geometric screening only; not an electrical connection, capacity or offer.' };
};
// Family #130731 · element #130731 · 6 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609151802-galaxy-bond/wafer.mjs#L73-L78
export const f130731_phase = function phase(key) {
let h = key >>> 0;
h = Math.imul(h ^ (h >>> 16), 0x45d9f3b) >>> 0;
h = Math.imul(h ^ (h >>> 16), 0x45d9f3b) >>> 0;
return ((h ^ (h >>> 16)) >>> 0) / 4294967296;
};
// Family #9048 · element #9048 · 144 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/core/atlas-receiver-v9-7.js#L280-L282
export const f9048_atlasCentresOnRepdPointV9_7 = function atlasCentresOnRepdPointV9_7(project) {
return Boolean(project) && project.geometry_status === "valid";
};
// Family #9128 · element #9128 · 144 places in 2 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/pipeline/scripts/news/adapters/committed-json-v9-7.mjs#L1-L14
export const f9128_committedJsonItemsV9_7 = function committedJsonItemsV9_7(payload, adapter) {
if (adapter?.kind !== "committed-json-snapshot" || !adapter.input_collection) {
throw new Error("unsupported or incomplete V9.7 source adapter");
}