GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Solar and storage design / globalgrid2050 / solar-bess-topology-v5

Module Layout V5 and 4 more files (part 1)

A style sheet in GlobalGrid2050. Served with the page at https://globalgrid2050.com/solar-bess-topology-v5/.

692 lines of Python and CSS from globalgrid2050, in 5 files. Topic: Solar and storage design. Section 87 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Install DC AC LV 02 CSS storage · globalgrid2050 / solar-bess-topology-v5/install_dc_ac_lv_02_css.py lines 1–109
  2. Install DC AC LV 03 JS interaction · globalgrid2050 / solar-bess-topology-v5/install_dc_ac_lv_03_js.py lines 1–171
  3. Install DC AC LV 04 Link storage · globalgrid2050 / solar-bess-topology-v5/install_dc_ac_lv_04_link.py lines 1–18
  4. Install Geometry Visualiser Migration V5 storage · globalgrid2050 / solar-bess-topology-v5/install_geometry_visualiser_migration_v5.py lines 1–107
  5. Module Layout V5 render · globalgrid2050 / solar-bess-topology-v5/module-layout-v5.css lines 1–287

Install DC AC LV 02 CSS

A Python module in GlobalGrid2050.

storageglobalgrid2050 / solar-bess-topology-v5/install_dc_ac_lv_02_css.py · lines 1–109 of 109 · Entry point

What it does
Uses libraries pathlib. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'ac'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
Downstream impact
Used directly by 2 files: GlobalGrid2050 V5 DC AC LV 02 CSS Workflow (globalgrid2050); GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow (globalgrid2050). It is itself an entry point, published at https://globalgrid2050.com/solar-bess-topology-v5/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Run by GlobalGrid2050 V5 DC AC LV 02 CSS Workflow and GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow.
Application
globalgrid2050 · solar-bess-topology-v5 · Python module
Uses
pathlib
Used by
run by GlobalGrid2050 V5 DC AC LV 02 CSS Workflow (workflow run), run by GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow (workflow run)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 solar-bess-topology-v5/install_dc_ac_lv_02_css.py:1-109 · blob e97fdacf0bf087aa0dea09aff73d8cfbdca648a6 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
from pathlib import Path

ROOT = Path(__file__).resolve().parent
OUT = ROOT / "dc-ac-lv-topology-review-v5.css"

CSS = ''':root {
    --topo-bg: #020202;
    --topo-cyan: #00ffff;
    --topo-orange: #ff9900;
    --topo-green: #00ff88;
    --topo-red: #ff3333;
}

.topo-app-shell { background: #050505; }
.topo-header-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topo-main { grid-template-columns: 390px minmax(0, 1fr); }
.topo-panel { max-height: calc(100vh - 150px); }

.topo-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.topo-tab {
    border: 1px solid var(--module-border);
    background: #080808;
    color: var(--module-muted);
    padding: 12px 8px;
    border-radius: 8px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.topo-tab.active {
    color: var(--topo-cyan);
    border-color: var(--topo-cyan);
    background: rgba(0, 255, 255, 0.08);
}

.topo-mode { display: none; }
.topo-mode.active { display: block; }

.topo-scada-card {
    position: relative;
    border: 1px solid var(--module-border);
    background: #020202;
    border-radius: 10px;
    overflow: hidden;
    min-height: calc(100vh - 150px);
    box-shadow: inset 0 0 80px rgba(0, 255, 255, 0.04);
}

.topo-scada-title {
    position: absolute;
    top: 12px;
    left: 14px;
    z-index: 2;
    color: var(--topo-green);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#topo_scada {
    width: 100%;
    height: calc(100vh - 190px);
    min-height: 660px;
    display: block;
    background: radial-gradient(circle at center, rgba(0,255,255,0.05), #020202 55%);
}

.topo-scada-footer {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--module-muted);
    font-size: 11px;
}

.scada-box { fill: #060606; stroke: #00ffff; stroke-width: 2; rx: 8; }
.scada-box.orange { stroke: #ff9900; }
.scada-box.green { stroke: #00ff88; }
.scada-box.red { stroke: #ff3333; }
.scada-line { stroke: #00ffff; stroke-width: 3; fill: none; }
.scada-line.orange { stroke: #ff9900; }
.scada-line.green { stroke: #00ff88; }
.scada-line.red { stroke: #ff3333; }
.scada-text { fill: #ffffff; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 18px; }
.scada-small { fill: #a6adbb; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; }
.scada-value { fill: #00ff88; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 15px; }
.scada-warning { fill: #ff9900; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 14px; }

@media (max-width: 900px) {
    .topo-main { grid-template-columns: 1fr; }
    .topo-scada-card { min-height: 680px; }
    #topo_scada { height: 680px; min-height: 680px; }
}
'''

OUT.write_text(CSS, encoding="utf-8")
print(f"Wrote {OUT}")

Install DC AC LV 03 JS

A Python module in GlobalGrid2050 covering transformers and cables.

interactionglobalgrid2050 / solar-bess-topology-v5/install_dc_ac_lv_03_js.py · lines 1–171 of 171 · Entry point

What it does
It draws transformers and cables. Uses libraries pathlib. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'ac'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: transformers, cables, 33kV.
Inputs & outputs
Out: SVG drawing. Voltage levels named: 33kV.
Downstream impact
Used directly by 2 files: GlobalGrid2050 V5 DC AC LV 03 JS Workflow (globalgrid2050); GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow (globalgrid2050). It is itself an entry point, published at https://globalgrid2050.com/solar-bess-topology-v5/.
What it achieves
Its code works with 33 kV.
Why it matters
Run by GlobalGrid2050 V5 DC AC LV 03 JS Workflow and GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow.
Application
globalgrid2050 · solar-bess-topology-v5 · Python module
Uses
pathlib
Used by
run by GlobalGrid2050 V5 DC AC LV 03 JS Workflow (workflow run), run by GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow (workflow run)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 solar-bess-topology-v5/install_dc_ac_lv_03_js.py:1-171 · blob 5c3894f8eaf868eddd100bc3c74787673543ba5f · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
from pathlib import Path

ROOT = Path(__file__).resolve().parent
OUT = ROOT / "dc-ac-lv-topology-review-v5.js"

JS = '''"use strict";

const topoState = { mode: "string" };
const RHO = { cu: 0.01724, al: 0.02826 };

function t(id) { return document.getElementById(id); }
function n(id, fallback = 0) { const el = t(id); if (!el) return fallback; const v = parseFloat(el.value); return Number.isFinite(v) ? v : fallback; }
function i(id, fallback = 0) { return Math.max(0, Math.round(n(id, fallback))); }
function txt(id, value) { const el = t(id); if (el) el.textContent = value; }
function fmt(v, d = 2) { return Number.isFinite(v) ? v.toFixed(d) : "0.00"; }

function read(prefix) {
    return {
        modWp: n(prefix + "_mod_wp", 660),
        voc: n(prefix + "_voc", 45.9),
        vmp: n(prefix + "_vmp", 38.1),
        isc: n(prefix + "_isc", 18.45),
        imp: n(prefix + "_imp", 17.35),
        fuseA: n(prefix + "_fuse_a", 35),
        systemV: n(prefix + "_system_v", 1500),
        vocCoeff: n(prefix + "_voc_coeff", -0.25),
        iscCoeff: n(prefix + "_isc_coeff", 0.04),
        minTemp: n(prefix + "_min_temp", -10),
        currentFactor: n(prefix + "_current_factor", 1.25),
        bifacialCurrent: n(prefix + "_bifacial_current", 10),
        modulesPerString: i(prefix + "_modules_per_string", 30),
        dcLengthM: n(prefix + "_dc_length_m", 300),
        dcCsa: n(prefix + "_dc_csa", 6),
        dcMaterial: t(prefix + "_dc_material")?.value || "cu",
        dcVdropLimit: n(prefix + "_dc_vdrop_limit", 1)
    };
}

function baseCalc(v) {
    const stringKwp = v.modulesPerString * v.modWp / 1000;
    const stringVmp = v.modulesPerString * v.vmp;
    const stringVocStc = v.modulesPerString * v.voc;
    const coldFactor = 1 + Math.abs(v.vocCoeff / 100) * (25 - v.minTemp);
    const coldModuleVoc = v.voc * coldFactor;
    const coldStringVoc = v.modulesPerString * coldModuleVoc;
    const maxModules = Math.floor(v.systemV / coldModuleVoc);
    const designCurrent = v.isc * v.currentFactor * (1 + v.bifacialCurrent / 100);
    const rho = RHO[v.dcMaterial] || RHO.cu;
    const loopResistance = 2 * v.dcLengthM * rho / v.dcCsa;
    const cableDropV = designCurrent * loopResistance;
    const cableDropPct = stringVmp > 0 ? cableDropV / stringVmp * 100 : 0;
    const cableLossW = designCurrent * designCurrent * loopResistance;
    return { stringKwp, stringVmp, stringVocStc, coldFactor, coldStringVoc, maxModules, designCurrent, loopResistance, cableDropV, cableDropPct, cableLossW };
}

function calcString() {
    const v = read("s");
    v.stringsPerInverter = i("s_strings_per_inverter", 21);
    v.inverterKva = n("s_inverter_kva", 352);
    v.invertersPerSkid = i("s_inverters_per_skid", 28);
    v.skidMva = n("s_skid_mva", 8.96);
    v.skidsPerRing = i("s_skids_per_ring", 5);
    const b = baseCalc(v);
    const dcPerInvKwp = b.stringKwp * v.stringsPerInverter;
    const invAcMva = v.inverterKva / 1000;
    const dcac = invAcMva > 0 ? dcPerInvKwp / 1000 / invAcMva : 0;
    const skidDcMwp = dcPerInvKwp * v.invertersPerSkid / 1000;
    const skidInvAcMva = invAcMva * v.invertersPerSkid;
    const ringAcMva = v.skidMva * v.skidsPerRing;
    const warnings = [];
    if (b.coldStringVoc > v.systemV) warnings.push("Cold string Voc exceeds system voltage limit");
    if (v.modulesPerString > b.maxModules) warnings.push("Modules per string exceeds calculated cold limit");
    if (b.designCurrent > v.fuseA * 0.8) warnings.push("Design current approaches module fuse rating");
    if (b.cableDropPct > v.dcVdropLimit) warnings.push("DC cable voltage drop exceeds selected limit");
    if (skidInvAcMva > v.skidMva) warnings.push("Inverter ACmax exceeds selected skid transformer rating");
    return { mode: "string", v, b, dcPerInvKwp, invAcMva, dcac, skidDcMwp, skidInvAcMva, ringAcMva, warnings };
}

function calcCentral() {
    const v = read("c");
    v.stringsPerCombiner = i("c_strings_per_combiner", 24);
    v.combinerLimitKw = n("c_combiner_limit_kw", 500);
    v.invDcMw = n("c_inv_dc_mw", 5.28);
    v.invAcMw = n("c_inv_ac_mw", 4.40);
    v.skidMva = n("c_skid_mva", 4.40);
    v.invertersPerSkid = i("c_inverters_per_skid", 1);
    v.skidsPerRing = i("c_skids_per_ring", 5);
    const b = baseCalc(v);
    const combinerKw = b.stringKwp * v.stringsPerCombiner;
    const reqStrings = Math.ceil(v.invDcMw * 1000 / b.stringKwp);
    const combinersPerInv = Math.ceil(reqStrings / v.stringsPerCombiner);
    const dcac = v.invAcMw > 0 ? v.invDcMw / v.invAcMw : 0;
    const skidDcMwp = v.invDcMw * v.invertersPerSkid;
    const skidInvAcMva = v.invAcMw * v.invertersPerSkid;
    const ringAcMva = v.skidMva * v.skidsPerRing;
    const warnings = [];
    if (b.coldStringVoc > v.systemV) warnings.push("Cold string Voc exceeds system voltage limit");
    if (combinerKw > v.combinerLimitKw) warnings.push("Combiner box DC capacity exceeds selected limit");
    if (b.cableDropPct > v.dcVdropLimit) warnings.push("DC cable voltage drop exceeds selected limit");
    if (v.invAcMw > v.skidMva) warnings.push("Central AC output exceeds selected skid transformer rating");
    return { mode: "central", v, b, combinerKw, reqStrings, combinersPerInv, dcPerInvKwp: v.invDcMw * 1000, invAcMva: v.invAcMw, dcac, skidDcMwp, skidInvAcMva, ringAcMva, warnings };
}

function currentCalc() { return topoState.mode === "central" ? calcCentral() : calcString(); }

function renderStats(r) {
    txt("out_string_kwp", fmt(r.b.stringKwp, 2) + " kWp");
    txt("out_string_vmp", fmt(r.b.stringVmp, 1) + " V");
    txt("out_string_voc_stc", fmt(r.b.stringVocStc, 1) + " V");
    txt("out_string_voc_cold", fmt(r.b.coldStringVoc, 1) + " V");
    txt("out_max_modules", String(r.b.maxModules));
    txt("out_design_current", fmt(r.b.designCurrent, 2) + " A");
    txt("out_dc_per_inv", fmt(r.dcPerInvKwp, 1) + " kWp");
    txt("out_dcac", fmt(r.dcac, 3));
    txt("out_skid_block", fmt(r.skidDcMwp, 2) + " MWp / " + fmt(r.skidInvAcMva, 2) + " MVA");
    txt("out_ring_ac", fmt(r.ringAcMva, 2) + " MVA");
    txt("out_dc_loss", fmt(r.b.cableDropPct, 2) + "% / " + fmt(r.b.cableLossW, 0) + " W");
    txt("topo_status", r.warnings.length ? r.warnings.join(" | ") : "No screening warnings from current assumptions.");
}

function svgEl(name, attrs = {}, text = null) {
    const el = document.createElementNS("http://www.w3.org/2000/svg", name);
    Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, v));
    if (text !== null) el.textContent = text;
    return el;
}

function box(svg, x, y, w, h, title, lines = [], tone = "") {
    svg.appendChild(svgEl("rect", { x, y, width: w, height: h, class: "scada-box " + tone, rx: 10 }));
    svg.appendChild(svgEl("text", { x: x + 14, y: y + 28, class: "scada-text" }, title));
    lines.forEach((line, idx) => svg.appendChild(svgEl("text", { x: x + 14, y: y + 55 + idx * 20, class: idx === 0 ? "scada-value" : "scada-small" }, line)));
}

function line(svg, x1, y1, x2, y2, tone = "") { svg.appendChild(svgEl("path", { d: `M ${x1} ${y1} L ${x2} ${y2}`, class: "scada-line " + tone })); }

function renderScada(r) {
    const svg = t("topo_scada");
    if (!svg) return;
    svg.innerHTML = "";
    svg.appendChild(svgEl("text", { x: 32, y: 56, class: "scada-text" }, r.mode === "string" ? "STRING INVERTER TOPOLOGY" : "CENTRAL INVERTER TOPOLOGY"));
    const warnTone = r.warnings.length ? "orange" : "green";
    if (r.mode === "string") {
        box(svg, 60, 110, 190, 110, "PV Module", [`${fmt(r.v.modWp,0)} Wp`, `Voc ${fmt(r.v.voc,1)} V`, `Isc ${fmt(r.v.isc,2)} A`], "green");
        box(svg, 310, 110, 210, 110, "String", [`${r.v.modulesPerString} modules`, `${fmt(r.b.stringKwp,2)} kWp`, `Cold Voc ${fmt(r.b.coldStringVoc,1)} V`], warnTone);
        box(svg, 585, 110, 230, 110, "String Inverter", [`${r.v.stringsPerInverter} strings`, `${fmt(r.dcPerInvKwp,1)} kWp DC`, `${fmt(r.invAcMva,3)} MVA AC`]);
        box(svg, 880, 110, 230, 110, "Skid", [`${r.v.invertersPerSkid} inverters`, `${fmt(r.skidDcMwp,2)} MWp`, `${fmt(r.v.skidMva,2)} MVA transformer`], warnTone);
        box(svg, 460, 350, 280, 115, "33 kV Ring", [`${r.v.skidsPerRing} skids`, `${fmt(r.ringAcMva,2)} MVA`, `Screening view only`], "orange");
        line(svg, 250, 165, 310, 165, "green"); line(svg, 520, 165, 585, 165); line(svg, 815, 165, 880, 165); line(svg, 995, 220, 600, 350, "orange");
    } else {
        box(svg, 60, 110, 190, 110, "PV Module", [`${fmt(r.v.modWp,0)} Wp`, `Voc ${fmt(r.v.voc,1)} V`, `Isc ${fmt(r.v.isc,2)} A`], "green");
        box(svg, 290, 110, 190, 110, "String", [`${r.v.modulesPerString} modules`, `${fmt(r.b.stringKwp,2)} kWp`, `I ${fmt(r.b.designCurrent,1)} A`], warnTone);
        box(svg, 530, 110, 220, 110, "Combiner", [`${r.v.stringsPerCombiner} strings`, `${fmt(r.combinerKw,1)} kWdc`, `${r.combinersPerInv} per inverter`], warnTone);
        box(svg, 800, 110, 260, 110, "Central Inverter", [`${fmt(r.v.invDcMw,2)} MWdc input`, `${fmt(r.v.invAcMw,2)} MWac output`, `DC/AC ${fmt(r.dcac,2)}`], "orange");
        box(svg, 460, 350, 280, 115, "Skid and Ring", [`Skid ${fmt(r.v.skidMva,2)} MVA`, `${r.v.skidsPerRing} skids per ring`, `Ring ${fmt(r.ringAcMva,2)} MVA`]);
        line(svg, 250, 165, 290, 165, "green"); line(svg, 480, 165, 530, 165); line(svg, 750, 165, 800, 165, "orange"); line(svg, 930, 220, 600, 350, "orange");
    }
    const y = 560;
    svg.appendChild(svgEl("text", { x: 60, y, class: "scada-warning" }, r.warnings.length ? "WARNINGS" : "STATUS"));
    if (r.warnings.length) r.warnings.slice(0, 5).forEach((w, idx) => svg.appendChild(svgEl("text", { x: 60, y: y + 28 + idx * 22, class: "scada-warning" }, "• " + w)));
    else svg.appendChild(svgEl("text", { x: 60, y: y + 28, class: "scada-value" }, "No screening warnings. Verify with full engineering studies before design use."));
    txt("topo_footer_left", r.mode === "string" ? "String inverter LV and DC chain" : "Central inverter combiner and skid chain");
}

function update() { const r = currentCalc(); renderStats(r); renderScada(r); }
function setMode(mode) { topoState.mode = mode; document.querySelectorAll(".topo-tab").forEach(b => b.classList.toggle("active", b.dataset.mode === mode)); document.querySelectorAll(".topo-mode").forEach(p => p.classList.toggle("active", p.dataset.modePanel === mode)); update(); }
function boot() { document.querySelectorAll("input, select").forEach(el => { el.addEventListener("input", update); el.addEventListener("change", update); }); document.querySelectorAll(".topo-tab").forEach(btn => btn.addEventListener("click", () => setMode(btn.dataset.mode))); update(); }
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot); else boot();
'''

OUT.write_text(JS, encoding="utf-8")
print(f"Wrote {OUT}")

Install DC AC LV 04 Link

A Python module in GlobalGrid2050.

storageglobalgrid2050 / solar-bess-topology-v5/install_dc_ac_lv_04_link.py · lines 1–18 of 18 · Entry point

What it does
It loads data. Uses libraries pathlib. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'ac'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
Downstream impact
Used directly by 2 files: GlobalGrid2050 V5 DC AC LV 04 Link Workflow (globalgrid2050); GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow (globalgrid2050). It is itself an entry point, published at https://globalgrid2050.com/solar-bess-topology-v5/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Run by GlobalGrid2050 V5 DC AC LV 04 Link Workflow and GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow.
Application
globalgrid2050 · solar-bess-topology-v5 · Python module
Uses
pathlib
Used by
run by GlobalGrid2050 V5 DC AC LV 04 Link Workflow (workflow run), run by GlobalGrid2050 V5 DC AC LV Topology Trigger Workflow (workflow run)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 solar-bess-topology-v5/install_dc_ac_lv_04_link.py:1-18 · blob c248d4bdebd63175b94c6f8fada1248ca637b30f · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
from pathlib import Path

ROOT = Path(__file__).resolve().parent
HTML = ROOT / "module-layout-v5.html"

if not HTML.exists():
    raise SystemExit("module-layout-v5.html not found")

text = HTML.read_text(encoding="utf-8")
if "dc-ac-lv-topology-review-v5.html" in text:
    print("Link already present")
else:
    old = '<a class="module-link" href="./indexforgis-sld-v5.html">Back to GIS SLD V5</a>'
    new = '<div class="topo-header-links"><a class="module-link" href="./dc-ac-lv-topology-review-v5.html">DC AC LV Topology Review</a><a class="module-link" href="./indexforgis-sld-v5.html">Back to GIS SLD V5</a></div>'
    if old not in text:
        raise SystemExit("Header link anchor not found")
    HTML.write_text(text.replace(old, new, 1), encoding="utf-8")
    print("Added DC AC LV topology link")

Install Geometry Visualiser Migration V5

A Python command-line tool in GlobalGrid2050 that reads cables, solar and battery storage (BESS). It writes report (`write_report`).

storageglobalgrid2050 / solar-bess-topology-v5/install_geometry_visualiser_migration_v5.py · lines 1–107 of 107 · Entry point · pattern replace_once (shared by 21 files)

What it does
It loads cables, solar and battery storage (BESS). Defines replace_once, migrate_geometry_app, patch_module_layout_link, write_report, main. Uses libraries pathlib, datetime. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'bess'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: cables, solar, battery storage (BESS).
Downstream impact
Used directly by 1 file: GlobalGrid2050 V5 Geometry Visualiser Migration Workflow (globalgrid2050). It is itself an entry point, published at https://globalgrid2050.com/solar-bess-topology-v5/.
What it achieves
Defines `replace_once`, `migrate_geometry_app`, `patch_module_layout_link` and 1 more.
Why it matters
Run by GlobalGrid2050 V5 Geometry Visualiser Migration Workflow.
Application
globalgrid2050 · solar-bess-topology-v5 · Python CLI
Uses
pathlib, datetime
Used by
run by GlobalGrid2050 V5 Geometry Visualiser Migration Workflow (workflow run)
Produces
replace_once, migrate_geometry_app, patch_module_layout_link, write_report, main
Defines here
replace_once, migrate_geometry_app, patch_module_layout_link, write_report, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 solar-bess-topology-v5/install_geometry_visualiser_migration_v5.py:1-107 · blob 16a3c2514f549cdb08227257dcd974eed4174e94 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
from pathlib import Path
from datetime import datetime, timezone

ROOT = Path(__file__).resolve().parents[1]
SRC = ROOT / "solar-bess-topology" / "index.html"
V5 = ROOT / "solar-bess-topology-v5"
DST = V5 / "cable-geometry-visualiser-v5.html"
MODULE_LAYOUT = V5 / "module-layout-v5.html"
REPORT = ROOT / "gridbot_reports" / "v5_geometry_visualiser_migration.md"


def replace_once(text, old, new, label, actions):
    if old not in text:
        actions.append(f"SKIP: {label}")
        return text
    actions.append(f"OK: {label}")
    return text.replace(old, new, 1)


def migrate_geometry_app(actions):
    if not SRC.exists():
        raise SystemExit(f"Missing source file: {SRC}")

    html = SRC.read_text(encoding="utf-8")

    html = html.replace("<title>Geometry Visualiser v1.5.18</title>", "<title>Cable Geometry Visualiser V5 | GlobalGrid2050</title>")
    html = html.replace("<h2>Geometry Inputs</h2>", "<h2>Cable Geometry Visualiser V5</h2>\n            <div class=\"guidance-box\"><strong>GlobalGrid2050 V5 migration</strong><br>This page is migrated from the original cable geometry visualiser into the V5 toolset. It remains a geometry capture and visual review tool only. It does not perform electrical rating, thermal rating, cable sizing, prote  … [line shortened here: 827 characters; full line on GitHub]

    html = html.replace("schema_version: \"1.5.18r1\"", "schema_version: \"v5-geometry-migration-1\"")

    if "max-width: 1480px;" in html:
        html = html.replace("max-width: 1480px;", "max-width: 1480px;\n            min-width: 0;", 1)

    if "@media (max-width: 1080px)" in html and "overflow-x: hidden" not in html[:3000]:
        html = html.replace("body {\n            margin: 0;", "html, body { max-width: 100%; overflow-x: hidden; }\n\n        body {\n            margin: 0;", 1)

    mobile_css = """

        @media (max-width: 700px) {
            body { padding: 12px; }
            .panel { padding: 14px; width: 100%; max-width: 100%; overflow-x: hidden; }
            .panel-left { width: 100%; }
            .dashboard { width: 100%; max-width: 100%; overflow-x: hidden; }
            .input-group { flex-direction: column; align-items: stretch; gap: 4px; }
            .input-group input, .input-group select { width: 100%; max-width: 100%; }
            .button-row { flex-direction: column; }
            .btn { width: 100%; white-space: normal; }
            h2 { font-size: 16px; overflow-wrap: anywhere; }
            canvas { width: 100%; max-width: 100%; }
        }
"""
    if "@media (max-width: 700px)" not in html:
        html = html.replace("</style>", mobile_css + "\n    </style>", 1)
        actions.append("OK: added mobile sizing CSS")

    DST.write_text(html, encoding="utf-8")
    actions.append(f"WROTE: {DST.relative_to(ROOT)}")


def patch_module_layout_link(actions):
    if not MODULE_LAYOUT.exists():
        raise SystemExit(f"Missing module layout file: {MODULE_LAYOUT}")
    html = MODULE_LAYOUT.read_text(encoding="utf-8")
    if "cable-geometry-visualiser-v5.html" in html:
        actions.append("SKIP: Module Layout already links to Cable Geometry Visualiser V5")
        return

    old = '<a class="module-link" href="./dc-ac-lv-topology-review-v5.html">DC AC LV Topology Review</a>'
    new = old + '<a class="module-link" href="./cable-geometry-visualiser-v5.html">Cable Geometry Visualiser V5</a>'
    if old in html:
        html = html.replace(old, new, 1)
        MODULE_LAYOUT.write_text(html, encoding="utf-8")
        actions.append("OK: added Cable Geometry Visualiser V5 button to Module Layout header")
        return

    old2 = '<a class="module-link" href="./indexforgis-sld-v5.html">Back to GIS SLD V5</a>'
    new2 = '<a class="module-link" href="./cable-geometry-visualiser-v5.html">Cable Geometry Visualiser V5</a>' + old2
    html = replace_once(html, old2, new2, "fallback add geometry button before GIS SLD link", actions)
    MODULE_LAYOUT.write_text(html, encoding="utf-8")


def write_report(actions):
    REPORT.parent.mkdir(parents=True, exist_ok=True)
    REPORT.write_text(
        "# V5 Cable Geometry Visualiser Migration Report\n\n"
        f"UTC created: {datetime.now(timezone.utc).isoformat()}\n\n"
        "Scope: migrate `solar-bess-topology/index.html` into the V5 toolset with a clearer file name and link it from Module Layout V5.\n\n"
        "Generated file:\n\n"
        "- `solar-bess-topology-v5/cable-geometry-visualiser-v5.html`\n\n"
        "Linked from:\n\n"
        "- `solar-bess-topology-v5/module-layout-v5.html`\n\n"
        "Purpose:\n\n"
        "The migrated page remains a cable geometry visualisation and capture tool. It is not an electrical design, thermal rating, protection grading or construction design tool.\n\n"
        "Actions:\n\n" + "\n".join(f"- {a}" for a in actions) + "\n",
        encoding="utf-8"
    )


def main():
    actions = []
    migrate_geometry_app(actions)
    patch_module_layout_link(actions)
    write_report(actions)


if __name__ == "__main__":
    main()

Module Layout V5

A style sheet in GlobalGrid2050. Served with the page at https://globalgrid2050.com/solar-bess-topology-v5/.

renderglobalgrid2050 / solar-bess-topology-v5/module-layout-v5.css · lines 1–287 of 287 · Entry point

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'bess'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
Downstream impact
Used directly by 4 files: DC AC LV Topology Review V5 (globalgrid2050, https://globalgrid2050.com/solar-bess-topology-v5/dc-ac-lv-topology-review-v5.html); Module Layout V5 (globalgrid2050, https://globalgrid2050.com/solar-bess-topology-v5/module-layout-v5.html); Solar Battery Energy Storage System (BESS) Topology V6 — DC AC LV Topology Review Page (globalgrid2050, https://globalgrid2050.com/solar-bess-topology-v6/dc-ac-lv-topology-review/); Solar Battery Energy Storage System (BESS) Topology V7 — DC AC LV Topology Review Page (globalgrid2050, https://globalgrid2050.com/solar-bess-topology-v7/dc-ac-lv-topology-review/). Reached from 155 other entry points, including Iterations — 43 Registry Growth Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/43-registry-growth/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); Cable Geometry Visualiser V5 (globalgrid2050, https://globalgrid2050.com/solar-bess-topology-v5/cable-geometry-visualiser-v5.html). It is itself an entry point, published at https://globalgrid2050.com/solar-bess-topology-v5/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Loaded by the DC AC LV Topology Review V5 page at https://globalgrid2050.com/solar-bess-topology-v5/dc-ac-lv-topology-review-v5.html and 3 other pages.
Application
globalgrid2050 · solar-bess-topology-v5 · style sheet
Uses
none found
Used by
loaded by DC AC LV Topology Review V5 (stylesheet), loaded by Module Layout V5 (stylesheet), loaded by Solar Battery Energy Storage System (BESS) Topology V6 — DC AC LV Topology Review Page (stylesheet), loaded by Solar Battery Energy Storage System (BESS) Topology V7 — DC AC LV Topology Review Page (stylesheet)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 solar-bess-topology-v5/module-layout-v5.css:1-287 · blob e68561428ff2fe11349c2901cf3ea837d6dd27d1 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
:root {
    --module-bg: #050505;
    --module-panel: rgba(10, 10, 10, 0.94);
    --module-border: #2f343d;
    --module-cyan: #00ffff;
    --module-orange: #ff9900;
    --module-green: #00ff88;
    --module-red: #ff3333;
    --module-text: #ffffff;
    --module-muted: #a6adbb;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--module-bg);
    color: var(--module-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.module-app-shell {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    padding: 18px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.module-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border: 1px solid var(--module-border);
    background: var(--module-panel);
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.module-kicker {
    color: var(--module-cyan);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
}

.module-header h1 {
    margin: 6px 0;
    font-size: clamp(24px, 5vw, 24px);
    color: var(--module-text);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.module-header p {
    margin: 0;
    color: var(--module-muted);
    max-width: 850px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.topo-header-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
}

.module-link {
    color: var(--module-cyan);
    border: 1px solid var(--module-cyan);
    padding: 10px 12px;
    text-decoration: none;
    border-radius: 8px;
    white-space: normal;
    text-align: center;
    max-width: 100%;
}

.module-main {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 18px;
    max-width: 100%;
}

.module-panel {
    border: 1px solid var(--module-border);
    background: var(--module-panel);
    border-radius: 10px;
    padding: 16px;
    max-height: calc(100vh - 150px);
    overflow: auto;
    min-width: 0;
}

.module-panel h2 {
    font-size: 14px;
    margin: 8px 0 12px;
    color: var(--module-cyan);
    border-bottom: 1px solid var(--module-border);
    padding-bottom: 6px;
}

.module-panel label {
    display: block;
    color: var(--module-muted);
    font-size: 11px;
    margin: 10px 0 4px;
}

.module-panel input,
.module-panel select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #080808;
    color: var(--module-text);
    border: 1px solid var(--module-border);
    border-radius: 6px;
    padding: 9px;
    font-family: inherit;
}

.module-button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 14px 0;
}

.btn {
    border: 1px solid var(--module-cyan);
    background: rgba(0, 255, 255, 0.1);
    color: var(--module-cyan);
    padding: 10px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.btn.secondary {
    border-color: var(--module-orange);
    color: var(--module-orange);
    background: rgba(255, 153, 0, 0.1);
}

.btn.danger {
    border-color: var(--module-red);
    color: var(--module-red);
    background: rgba(255, 51, 51, 0.1);
}

.btn.small {
    padding: 8px 10px;
    font-size: 11px;
}

.module-stat {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0;
    font-size: 12px;
}

.module-stat span {
    color: var(--module-muted);
}

.module-stat strong {
    color: var(--module-green);
    text-align: right;
}

.module-status {
    margin-top: 12px;
    color: var(--module-cyan);
    font-size: 11px;
    line-height: 1.4;
}

.module-note {
    margin-top: 14px;
    padding: 10px;
    border: 1px solid var(--module-border);
    border-radius: 8px;
    color: var(--module-muted);
    font-size: 11px;
    line-height: 1.5;
}

.module-map-card {
    position: relative;
    border: 1px solid var(--module-border);
    background: var(--module-panel);
    border-radius: 10px;
    overflow: hidden;
    min-height: calc(100vh - 150px);
    min-width: 0;
}

#module_map {
    width: 100%;
    height: calc(100vh - 150px);
    min-height: 620px;
}

.module-map-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    gap: 8px;
    max-width: calc(100% - 24px);
}

@media (max-width: 900px) {
    .module-app-shell {
        padding: 12px;
    }

    .module-header {
        flex-direction: column;
        padding: 14px;
        gap: 14px;
    }

    .module-header h1 {
        font-size: clamp(22px, 8vw, 34px);
    }

    .topo-header-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .module-link {
        width: 100%;
        display: block;
    }

    .module-main {
        grid-template-columns: 1fr;
    }

    .module-panel {
        max-height: none;
        padding: 14px;
    }

    #module_map,
    .module-map-card {
        min-height: 620px;
        height: 620px;
    }

    .module-map-toolbar {
        left: 12px;
        right: 12px;
        flex-direction: column;
    }
}