GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Solar and storage design / testcode / sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox

Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page and 1 more file

A web page in the layer apps folder of Testcode that reads inputs for loc, mod wp and mod, covering battery storage (BESS), cables, substations and 33kV.

541 lines of HTML and JavaScript from testcode, in 2 files. Topic: Solar and storage design. Section 262 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. Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page render · testcode / sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html lines 1–509
  2. Map Frame interaction · testcode / sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/map-frame.js lines 1–32

Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page

A web page in the layer apps folder of Testcode that reads inputs for loc, mod wp and mod, covering battery storage (BESS), cables, substations and 33kV.

rendertestcode / sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html · lines 1–509 of 509 · version 2026-09-05 20:28 · Entry point

What it does
It draws battery storage (BESS), cables, substations and 33kV. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'sandbox'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: battery storage (BESS), cables, substations, 33kV, 400kV, 275kV. README: "The publication checkout is sparse: `index.html` and the complete `uk_renewables_pipeline/` tree."
Inputs & outputs
In: form fields (user input). Out: web page. Voltage levels named: 400kV, 275kV, 132kV, 66kV, 33kV.
Downstream impact
It is itself an entry point (page); no other file was found loading it.
What it achieves
The README says: The publication checkout is sparse: `index.html` and the complete `uk_renewables_pipeline/` tree. Its code works with 33 kV, 0.00 MVA and 132 kV.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
testcode · sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox · page
Uses
GIS Single-Line Diagram (SLD) V5 Config (script src), GIS Single-Line Diagram (SLD) V5 Helpers (script src), GIS Single-Line Diagram (SLD) V5 State (script src), GIS Single-Line Diagram (SLD) V5 Substations (script src), GIS Single-Line Diagram (SLD) V5 (stylesheet), GIS Single-Line Diagram (SLD) V5 Map (script src), GIS Single-Line Diagram (SLD) V5 Calculations (script src), GIS Single-Line Diagram (SLD) V4 Finance (script src), and 6 more, https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js, https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js
Used by
none found
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
testcode@a8a215982b13d6e2f6019b40bf0bef5755719773 sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html:1-509 · blob 30df4d7eb32d3c14a584c088ea0573be9118c636 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unknown
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GIS SLD Financial Sandbox V7</title>

<link href="https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js" defer></script>

<script src="gis-sld-v5-config.js"></script>

<script src="gis-sld-v5-helpers.js"></script>

<script src="gis-sld-v5-state.js"></script>

<script src="gis-sld-v5-substations.js"></script>

<link rel="stylesheet" href="gis-sld-v5.css">

</head>
<body>

<div class="dashboard">
    <div class="panel panel-left">
        <h2>Solar Photovoltaic (PV) Development, Engineering, Procurement and Construction (EPC) and Grid Analysis</h2>

    <div class="search-box">
        <input type="text" id="loc_search" placeholder="Enter location (e.g. London)..." />
        <button id="btn_search">FLY</button>
    </div>

    <div class="tab-container">
        <button class="tab-btn active" id="tabbtn_string" data-tab="string">String</button>
        <button class="tab-btn" id="tabbtn_central" data-tab="central">Central</button>
    </div>

    <div id="string_tab" class="tab-content active">
        <h3>Dimensions & Physics</h3>
        <div class="input-group"><label>Module Rating (Wp)</label><input type="number" id="mod_wp" value="660" min="1" /></div>
        <div class="input-group">
            <label>Mod L x W (m)</label>
            <div style="display: flex; gap: 4px;">
                <input type="number" id="mod_l" value="2.38" step="0.01" min="0.01" style="width: 45px;" />
                <input type="number" id="mod_w" value="1.30" step="0.01" min="0.01" style="width: 45px;" />
            </div>
        </div>
        <div class="input-group">
            <label>Mounting & GCR</label>
            <select id="mounting_type">
                <option value="0.75">East-West Dome (~75%)</option>
                <option value="0.45" selected>Fixed Tilt South (~45%)</option>
                <option value="0.35">Tracker (~35%)</option>
            </select>
        </div>
        <div class="input-group"><label>Gross Site Factor</label><input type="number" id="gross_factor" value="1.35" step="0.05" min="1.0" /></div>

        <h3>Array Hierarchy (String)</h3>
        <div class="input-group array-size-control"><label>Target DC Capacity MWp</label><input type="number" id="target_dc_mwp" value="" placeholder="Optional" step="1" min="0.1" /></div>
        <div class="ux-note array-size-note">Optional sizing helper. Enter a target MWp DC and the sandbox will resize by whole skid and ring main steps. Module rating, modules per string, strings per inverter and inverter rating remain user controlled.</div>
        <div class="input-group"><label>DC/AC Ratio</label><input type="number" id="dc_ac_ratio" value="1.20" step="0.05" min="0.01" /></div>
        <div class="input-group"><label>String Inverter Rating kVA</label><input type="number" id="string_inv_kva" value="352" step="1" min="1" /></div>
        <div class="input-group"><label>String Skid Transformer Rating MVA</label><input type="number" id="string_skid_mva" value="8.96" step="0.01" min="0.1" /></div>
        <div class="input-group"><label>Modules per String</label><input type="number" id="x_mods" value="28" min="1" /></div>
        <div class="input-group"><label>Strings per String Inverter</label><input type="number" id="z_strings" value="18" min="1" /></div>
        <div class="input-group"><label>String Inverters per Skid</label><input type="number" id="y_invs" value="28" min="1" /></div>
        <div class="input-group"><label>Skids per 33 kV Ring Main</label><input type="number" id="s_subs" value="5" min="1" /></div>
        <div class="input-group"><label>Number of 33 kV Ring Main Circuits</label><input type="number" id="b_cols" value="6" min="1" /></div>

        <h3>Module Logistics</h3>
        <div class="input-group">
            <label>Packaging Preset</label>
            <select id="logistics_preset" data-suffix="">
                <option value="high_density" selected>High Density (33/box, 594/40ft)</option>
                <option value="legacy">Standard Legacy (31/box, 620/40ft)</option>
                <option value="manual">Manual Entry</option>
            </select>
        </div>
        <div class="input-group"><label>Modules / Packing Unit</label><input type="number" id="mods_pallet" value="33" min="1" /></div>
        <div class="input-group"><label>Mods / 40ft Container</label><input type="number" id="mods_container" value="594" min="1" /></div>
        <div class="input-group"><label>Spare Allowance %</label><input type="number" id="spare_pct" value="1.0" step="0.1" min="0" /></div>

        <details class="finance-box">
            <summary>Baseline Project Economics</summary>
            <div class="finance-headline">
                <div class="stat-row"><span>Year 1 Revenue Projection</span><span class="stat-val" id="fin_string_annual_rev">£0</span></div>
                <div class="stat-row"><span>25 Year Revenue Projection</span><span class="stat-val" id="fin_string_25_rev">£0</span></div>
                <div class="stat-row"><span>35 Year Revenue Projection</span><span class="stat-val" id="fin_string_35_rev">£0</span></div>
                <div class="stat-row"><span>Total CAPEX</span><span class="stat-val" id="fin_string_capex">£0</span></div>
                <div class="stat-row"><span>CAPEX per Wp</span><span class="stat-val" id="fin_string_capex_wp">£0.00/Wp</span></div>
                <div class="stat-row"><span>Undiscounted 25 Year Cash Surplus</span><span class="stat-val" id="fin_string_surplus_25">£0</span></div>
                <div class="stat-row"><span>Undiscounted 35 Year Cash Surplus</span><span class="stat-val" id="fin_string_surplus_35">£0</span></div>
            </div>

            <h3>Revenue</h3>
            <div class="input-group"><label>Energy Price £/MWh</label><input type="number" id="fin_string_price" value="65" step="1" min="0"></div>
            <div class="input-group"><label>Other Income £/MWh</label><input type="number" id="fin_string_other" value="0" step="1" min="0"></div>
            <div class="input-group"><label>Base Yield kWh/kWp</label><input type="number" id="fin_string_yield" value="1000" step="10" min="0"></div>
            <div class="input-group"><label>Bifacial Gain %</label><input type="number" id="fin_string_bifacial" value="5" step="0.5" min="0" max="15"></div>
            <div class="input-group"><label>Base Losses %</label><input type="number" id="fin_string_losses" value="2" step="0.1" min="0"></div>
            <div class="input-group"><label>Degradation % (Yr 2+)</label><input type="number" id="fin_string_deg" value="0.4" step="0.01" min="0"></div>
            <div class="input-group"><label>OPEX £/MWac/yr</label><input type="number" id="fin_string_opex" value="25000" step="1000" min="0"></div>

            <h3>Development Financials</h3>
<div class="finance-headline">
    <div class="stat-row"><span>Development Capital at Risk</span><span class="stat-val" id="fin_string_dev_capital">£0</span></div>
    <div class="stat-row"><span>Module Supply Cost</span><span class="stat-val" id="fin_string_dev_module_cost">£0</span></div>
    <div class="stat-row"><span>EPC Cost</span><span class="stat-val" id="fin_string_dev_epc_cost">£0</span></div>
    <div class="stat-row"><span>Other Owner Costs</span><span class="stat-val" id="fin_string_dev_owner_cost">£0</span></div>
<div class="stat-row"><span>Grid Connection Cost</span><span class="stat-val" id="fin_string_dev_grid_cost">£0</span></div>
    <div class="stat-row"><span>Total Build Cost</span><span class="stat-val" id="fin_string_dev_total_cost">£0</span></div>
    <div class="stat-row"><span>Target Exit Value</span><span class="stat-val" id="fin_string_dev_exit_value">£0</span></div>
<div class="stat-row"><span>Operating Asset Net Present Value (NPV)</span><span class="stat-val" id="fin_string_dev_operating_npv">£0</span></div>
    <div class="stat-row"><span>Gross Development Margin</span><span class="stat-val" id="fin_string_dev_margin">£0</span></div>
    <div class="stat-row"><span>Risk Adjusted Development Value</span><span class="stat-val" id="fin_string_dev_risk_value">£0</span></div>
    <div class="stat-row"><span>Development Equity Money Multiple</span><span class="stat-val" id="fin_string_dev_multiple">0.00x</span></div>
</div>

<div class="input-group" style="display: block; margin-bottom: 8px;">
    <label style="margin-bottom: 4px; display: block;">Development Stage</label>
    <select id="fin_string_dev_stage" data-dev-stage-prefix="fin_string" style="width: 100%;">
        <option value="3000">Land Option Signed</option>
        <option value="15000">Grid Connection Application Accepted</option>
        <option value="35000">Planning Application Submitted</option>
        <option value="55000">Planning Permission Granted</option>
        <option value="70000">Grid Connection Terms Reviewed and Agreed</option>
        <option value="80000">Buyer or Revenue Agreement Reviewed (Power Purchase Agreement (PPA) / Offtaker)</option>
        <option value="100000" selected>Construction Contract Signed and Finance Committed (Financial Close)</option>
    </select>
</div>
<div class="input-group"><label>Development Cost £/MW</label><input type="number" id="fin_string_dev_cost_mw" value="100000" step="5000" min="0"></div>
<div class="input-group"><label>Module Supply Cost £/MWp</label><input type="number" id="fin_string_dev_module_mwp" value="150000" step="10000" min="0"></div>
<div class="input-group"><label>EPC Cost £/MW</label><input type="number" id="fin_string_dev_epc_mw" value="500000" step="25000" min="0"></div>
<div class="input-group"><label>Other Owner Costs £/MW</label><input type="number" id="fin_string_dev_owner_mw" value="100000" step="25000" min="0"></div>
<div class="input-group"><label>Grid Connection Cost £ per Megawatt (MW)</label><input type="number" id="fin_string_dev_grid_mw" value="100000" step="25000" min="0"></div>
<div class="input-group"><label>Target Exit Value £/MWp</label><input type="number" id="fin_string_dev_exit_mwp" value="1350000" step="50000" min="0"></div>
<div class="input-group"><label>Operating Asset Net Present Value (NPV) £ per Megawatt peak (MWp)</label><input type="number" id="fin_string_dev_npv_mwp" value="1200000" step="50000" min="0"></div>
<div class="input-group"><label>Development Success Probability %</label><input type="number" id="fin_string_dev_success" value="15" step="1" min="0" max="100"></div>
<div class="input-group"><label>Development Years</label><input type="number" id="fin_string_dev_years" value="4" step="0.5" min="0"></div>

<h3>CAPEX</h3>
<div class="input-group"><label>Modules £/Wp</label><input type="number" id="fin_string_modules" value="0.15" step="0.01" min="0"></div>
<div class="input-group"><label>EPC ex Modules £/Wp</label><input type="number" id="fin_string_epc_ex" value="0.30" step="0.01" min="0"></div>
<div class="input-group">
    <label>Flood Resilience</label>
    <div style="display: flex; gap: 4px; align-items: center;">
        <input type="checkbox" id="fin_string_flood" />
        <input type="number" id="fin_string_flood_rate" value="0.03" step="0.01" min="0" style="width: 50px;" />
    </div>
</div>
<div class="input-group"><label>Other CAPEX £/Wp</label><input type="number" id="fin_string_other_capex" value="0.20" step="0.01" min="0"></div>
<div class="input-group"><label>Fixed CAPEX £</label><input type="number" id="fin_string_fixed_capex" value="1500000" step="50000" min="0"></div>
<div class="input-group"><label>Contingency %</label><input type="number" id="fin_string_cont" value="7" step="0.5" min="0"></div>

            <h3>Loss Allowances</h3>
            <div class="input-group"><label>DC String Cable Loss %</label><input type="number" id="fin_string_loss_dc_string" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>LV Main DC Loss %</label><input type="number" id="fin_string_loss_lv_dc" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>LV AC Loss %</label><input type="number" id="fin_string_loss_lv_ac" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>Transformer Loss %</label><input type="number" id="fin_string_loss_tx" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>Other Electrical Loss %</label><input type="number" id="fin_string_loss_other" value="0" step="0.1" min="0"></div>

            <h3>BESS Optional</h3>
            <div class="input-group"><label>BESS Power MW</label><input type="number" id="fin_string_bess_mw" value="0" step="1" min="0"></div>
            <div class="input-group"><label>BESS Energy MWh</label><input type="number" id="fin_string_bess_mwh" value="0" step="1" min="0"></div>
            <div class="input-group"><label>BESS CAPEX £/MWh</label><input type="number" id="fin_string_bess_capex" value="0" step="10000" min="0"></div>
            <div class="input-group"><label>BESS Cycles / Year</label><input type="number" id="fin_string_bess_cycles" value="0" step="10" min="0"></div>
            <div class="input-group"><label>BESS Spread £/MWh</label><input type="number" id="fin_string_bess_spread" value="0" step="1" min="0"></div>
            <div class="input-group"><label>BESS Efficiency %</label><input type="number" id="fin_string_bess_eff" value="88" step="1" min="0" max="100"></div>

            <div class="warning-box" id="fin_string_warnings"></div>
        </details>
    </div>

    <div id="central_tab" class="tab-content">
        <h3>Dimensions & Physics</h3>
        <div class="input-group"><label>Module Rating (Wp)</label><input type="number" id="mod_wp_c" value="660" min="1" /></div>
        <div class="input-group">
            <label>Mod L x W (m)</label>
            <div style="display: flex; gap: 4px;">
                <input type="number" id="mod_l_c" value="2.38" step="0.01" min="0.01" style="width: 45px;" />
                <input type="number" id="mod_w_c" value="1.30" step="0.01" min="0.01" style="width: 45px;" />
            </div>
        </div>
        <div class="input-group">
            <label>Mounting & GCR</label>
            <select id="mounting_type_c">
                <option value="0.75">East-West Dome (~75%)</option>
                <option value="0.45" selected>Fixed Tilt South (~45%)</option>
                <option value="0.35">Tracker (~35%)</option>
            </select>
        </div>
        <div class="input-group"><label>Gross Site Factor</label><input type="number" id="gross_factor_c" value="1.35" step="0.05" min="1.0" /></div>

        <h3>Array Hierarchy (Central)</h3>
        <div class="input-group array-size-control"><label>Target DC Capacity MWp</label><input type="number" id="target_dc_mwp_c" value="" placeholder="Optional" step="1" min="0.1" /></div>
        <div class="ux-note array-size-note">Optional sizing helper. Enter a target MWp DC and the sandbox will resize by whole central inverter, skid and ring main steps. Module rating, modules per string and central inverter ratings remain user controlled.</div>
        <div class="input-group"><label>Central Inverter DC Input Rating MWdc</label><input type="number" id="inv_dc_mw_c" value="5.28" step="0.01" min="0.1" max="30" /></div>
        <div class="input-group"><label>Central Inverter AC Output Rating MWac</label><input type="number" id="inv_ac_mw_c" value="4.40" step="0.01" min="0.1" max="20" /></div>
        <div class="input-group"><label>Central Skid Transformer Rating MVA</label><input type="number" id="central_skid_mva_c" value="4.40" step="0.01" min="0.1" max="25" /></div>
        <div class="ux-note">A skid is a factory assembled power package. It usually combines inverter equipment, transformer, switchgear, protection and auxiliary systems on a transportable base or frame. Finance and non technical teams can treat each skid as one repeatable cost and power block. Values above 10 MWac should be treated as large power block assumptions and require transformer, MV sw  … [line shortened here: 473 characters; full line on GitHub]
        <div class="input-group"><label>Calculated DC/AC Ratio</label><input type="number" id="dc_ac_ratio_c" value="1.20" step="0.05" min="0.01" /></div>
        <div class="input-group"><label>Modules / String</label><input type="number" id="x_mods_c" value="28" min="1" /></div>
        <div class="input-group"><label>Strings per Combiner Box</label><input type="number" id="str_per_cb_c" value="24" min="1" /></div>
        <div class="input-group"><label>Combiner Box Design Limit kWdc</label><input type="number" id="combiner_limit_kwdc_c" value="500" step="10" min="1" /></div>
        <div class="input-group"><label>Central Inverter Units per Skid</label><input type="number" id="inv_per_mv_c" value="1" min="1" /></div>
        <div class="input-group"><label>Central Skids per 33 kV Ring Main</label><input type="number" id="mv_per_ring_c" value="4" min="1" /></div>
        <div class="input-group"><label>Number of 33 kV Ring Main Circuits</label><input type="number" id="rings_c" value="4" min="1" /></div>

        <h3>Module Logistics</h3>
        <div class="input-group">
            <label>Packaging Preset</label>
            <select id="logistics_preset_c" data-suffix="_c">
                <option value="high_density" selected>High Density (33/box, 594/40ft)</option>
                <option value="legacy">Standard Legacy (31/box, 620/40ft)</option>
                <option value="manual">Manual Entry</option>
            </select>
        </div>
        <div class="input-group"><label>Modules / Packing Unit</label><input type="number" id="mods_pallet_c" value="33" min="1" /></div>
        <div class="input-group"><label>Mods / 40ft Container</label><input type="number" id="mods_container_c" value="594" min="1" /></div>
        <div class="input-group"><label>Spare Allowance %</label><input type="number" id="spare_pct_c" value="1.0" step="0.1" min="0" /></div>

        <details class="finance-box">
            <summary>Baseline Project Economics</summary>
            <div class="finance-headline">
                <div class="stat-row"><span>Year 1 Revenue Projection</span><span class="stat-val" id="fin_central_annual_rev">£0</span></div>
                <div class="stat-row"><span>25 Year Revenue Projection</span><span class="stat-val" id="fin_central_25_rev">£0</span></div>
                <div class="stat-row"><span>35 Year Revenue Projection</span><span class="stat-val" id="fin_central_35_rev">£0</span></div>
                <div class="stat-row"><span>Total CAPEX</span><span class="stat-val" id="fin_central_capex">£0</span></div>
                <div class="stat-row"><span>CAPEX per Wp</span><span class="stat-val" id="fin_central_capex_wp">£0.00/Wp</span></div>
                <div class="stat-row"><span>Undiscounted 25 Year Cash Surplus</span><span class="stat-val" id="fin_central_surplus_25">£0</span></div>
                <div class="stat-row"><span>Undiscounted 35 Year Cash Surplus</span><span class="stat-val" id="fin_central_surplus_35">£0</span></div>
            </div>

            <h3>Revenue</h3>
            <div class="input-group"><label>Energy Price £/MWh</label><input type="number" id="fin_central_price" value="65" step="1" min="0"></div>
            <div class="input-group"><label>Other Income £/MWh</label><input type="number" id="fin_central_other" value="0" step="1" min="0"></div>
            <div class="input-group"><label>Base Yield kWh/kWp</label><input type="number" id="fin_central_yield" value="1000" step="10" min="0"></div>
            <div class="input-group"><label>Bifacial Gain %</label><input type="number" id="fin_central_bifacial" value="5" step="0.5" min="0" max="15"></div>
            <div class="input-group"><label>Base Losses %</label><input type="number" id="fin_central_losses" value="2" step="0.1" min="0"></div>
            <div class="input-group"><label>Degradation % (Yr 2+)</label><input type="number" id="fin_central_deg" value="0.4" step="0.01" min="0"></div>
            <div class="input-group"><label>OPEX £/MWac/yr</label><input type="number" id="fin_central_opex" value="25000" step="1000" min="0"></div>

            <h3>Development Financials</h3>
<div class="finance-headline">
    <div class="stat-row"><span>Development Capital at Risk</span><span class="stat-val" id="fin_central_dev_capital">£0</span></div>
    <div class="stat-row"><span>Module Supply Cost</span><span class="stat-val" id="fin_central_dev_module_cost">£0</span></div>
    <div class="stat-row"><span>EPC Cost</span><span class="stat-val" id="fin_central_dev_epc_cost">£0</span></div>
    <div class="stat-row"><span>Other Owner Costs</span><span class="stat-val" id="fin_central_dev_owner_cost">£0</span></div>
<div class="stat-row"><span>Grid Connection Cost</span><span class="stat-val" id="fin_central_dev_grid_cost">£0</span></div>
    <div class="stat-row"><span>Total Build Cost</span><span class="stat-val" id="fin_central_dev_total_cost">£0</span></div>
    <div class="stat-row"><span>Target Exit Value</span><span class="stat-val" id="fin_central_dev_exit_value">£0</span></div>
<div class="stat-row"><span>Operating Asset Net Present Value (NPV)</span><span class="stat-val" id="fin_central_dev_operating_npv">£0</span></div>
    <div class="stat-row"><span>Gross Development Margin</span><span class="stat-val" id="fin_central_dev_margin">£0</span></div>
    <div class="stat-row"><span>Risk Adjusted Development Value</span><span class="stat-val" id="fin_central_dev_risk_value">£0</span></div>
    <div class="stat-row"><span>Development Equity Money Multiple</span><span class="stat-val" id="fin_central_dev_multiple">0.00x</span></div>
</div>

<div class="input-group" style="display: block; margin-bottom: 8px;">
    <label style="margin-bottom: 4px; display: block;">Development Stage</label>
    <select id="fin_central_dev_stage" data-dev-stage-prefix="fin_central" style="width: 100%;">
        <option value="3000">Land Option Signed</option>
        <option value="15000">Grid Connection Application Accepted</option>
        <option value="35000">Planning Application Submitted</option>
        <option value="55000">Planning Permission Granted</option>
        <option value="70000">Grid Connection Terms Reviewed and Agreed</option>
        <option value="80000">Buyer or Revenue Agreement Reviewed (Power Purchase Agreement (PPA) / Offtaker)</option>
        <option value="100000" selected>Construction Contract Signed and Finance Committed (Financial Close)</option>
    </select>
</div>
<div class="input-group"><label>Development Cost £/MW</label><input type="number" id="fin_central_dev_cost_mw" value="100000" step="5000" min="0"></div>
<div class="input-group"><label>Module Supply Cost £/MWp</label><input type="number" id="fin_central_dev_module_mwp" value="150000" step="10000" min="0"></div>
<div class="input-group"><label>EPC Cost £/MW</label><input type="number" id="fin_central_dev_epc_mw" value="500000" step="25000" min="0"></div>
<div class="input-group"><label>Other Owner Costs £/MW</label><input type="number" id="fin_central_dev_owner_mw" value="100000" step="25000" min="0"></div>
<div class="input-group"><label>Grid Connection Cost £ per Megawatt (MW)</label><input type="number" id="fin_central_dev_grid_mw" value="100000" step="25000" min="0"></div>
<div class="input-group"><label>Target Exit Value £/MWp</label><input type="number" id="fin_central_dev_exit_mwp" value="1350000" step="50000" min="0"></div>
<div class="input-group"><label>Operating Asset Net Present Value (NPV) £ per Megawatt peak (MWp)</label><input type="number" id="fin_central_dev_npv_mwp" value="1200000" step="50000" min="0"></div>
<div class="input-group"><label>Development Success Probability %</label><input type="number" id="fin_central_dev_success" value="15" step="1" min="0" max="100"></div>
<div class="input-group"><label>Development Years</label><input type="number" id="fin_central_dev_years" value="4" step="0.5" min="0"></div>

<h3>CAPEX</h3>
<div class="input-group"><label>Modules £/Wp</label><input type="number" id="fin_central_modules" value="0.15" step="0.01" min="0"></div>
<div class="input-group"><label>EPC ex Modules £/Wp</label><input type="number" id="fin_central_epc_ex" value="0.30" step="0.01" min="0"></div>
<div class="input-group">
    <label>Flood Resilience</label>
    <div style="display: flex; gap: 4px; align-items: center;">
        <input type="checkbox" id="fin_central_flood" />
        <input type="number" id="fin_central_flood_rate" value="0.03" step="0.01" min="0" style="width: 50px;" />
    </div>
</div>
<div class="input-group"><label>Other CAPEX £/Wp</label><input type="number" id="fin_central_other_capex" value="0.20" step="0.01" min="0"></div>
<div class="input-group"><label>Fixed CAPEX £</label><input type="number" id="fin_central_fixed_capex" value="1500000" step="50000" min="0"></div>
<div class="input-group"><label>Contingency %</label><input type="number" id="fin_central_cont" value="7" step="0.5" min="0"></div>

            <h3>Loss Allowances</h3>
            <div class="input-group"><label>DC String Cable Loss %</label><input type="number" id="fin_central_loss_dc_string" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>LV Main DC Loss %</label><input type="number" id="fin_central_loss_lv_dc" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>LV AC Loss %</label><input type="number" id="fin_central_loss_lv_ac" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>Transformer Loss %</label><input type="number" id="fin_central_loss_tx" value="0" step="0.1" min="0"></div>
            <div class="input-group"><label>Other Electrical Loss %</label><input type="number" id="fin_central_loss_other" value="0" step="0.1" min="0"></div>

            <h3>BESS Optional</h3>
            <div class="input-group"><label>BESS Power MW</label><input type="number" id="fin_central_bess_mw" value="0" step="1" min="0"></div>
            <div class="input-group"><label>BESS Energy MWh</label><input type="number" id="fin_central_bess_mwh" value="0" step="1" min="0"></div>
            <div class="input-group"><label>BESS CAPEX £/MWh</label><input type="number" id="fin_central_bess_capex" value="0" step="10000" min="0"></div>
            <div class="input-group"><label>BESS Cycles / Year</label><input type="number" id="fin_central_bess_cycles" value="0" step="10" min="0"></div>
            <div class="input-group"><label>BESS Spread £/MWh</label><input type="number" id="fin_central_bess_spread" value="0" step="1" min="0"></div>
            <div class="input-group"><label>BESS Efficiency %</label><input type="number" id="fin_central_bess_eff" value="88" step="1" min="0" max="100"></div>

            <div class="warning-box" id="fin_central_warnings"></div>
        </details>
    </div>

    <div class="stat-box" style="border-color: #ff3333; background: rgba(255, 51, 51, 0.05); margin-bottom: 15px;">
        <h3 style="margin-top: 0; color: #ff3333; border-bottom-color: #ff3333;">Selected Grid Node</h3>
        <div class="stat-row"><span>Substation:</span><span class="stat-val" id="out_selected_sub_name">None selected</span></div>
        <div class="stat-row"><span>Voltage:</span><span class="stat-val" id="out_selected_sub_voltage">Unknown</span></div>
        <div class="stat-row"><span>Longitude:</span><span class="stat-val" id="out_selected_sub_lon">n/a</span></div>
        <div class="stat-row"><span>Latitude:</span><span class="stat-val" id="out_selected_sub_lat">n/a</span></div>
    </div>

    <div class="stat-box" id="tech_summary_box">
        <h3>Technical Quantity Summary</h3>
        <div class="stat-row"><span>Total Module Count:</span><span class="stat-val" id="out_module_count">0</span></div>
        <div class="stat-row"><span>Total DC Capacity:</span><span class="stat-val cyan" id="out_dc_capacity">0.00 MWp</span></div>
        <div class="stat-row"><span>Implied AC Capacity:</span><span class="stat-val" id="out_ac_capacity">0.00 MWac</span></div>
        <div class="stat-row"><span>DC/AC Ratio:</span><span class="stat-val" id="out_actual_dcac">1.20</span></div>
        <div class="stat-row"><span>String Inverter Rating:</span><span class="stat-val" id="out_string_inv_rating">n/a</span></div>
        <div class="stat-row"><span>Inverter ACmax per Skid:</span><span class="stat-val" id="out_inverter_acmax_mva">0.00 MVA</span></div>
        <div class="stat-row"><span>Skid Transformer Rating:</span><span class="stat-val" id="out_sub_ac_rating">0.00 MVA</span></div>
        <div class="stat-row"><span>33 kV Ring Main AC Rating:</span><span class="stat-val" id="out_ring_ac_rating">0.00 MVA</span></div>
        <div class="stat-row central-only" style="display: none;"><span>Central Inverter DC Input:</span><span class="stat-val" id="out_central_inv_dc_rating">0.00 MWdc</span></div>
        <div class="stat-row central-only" style="display: none;"><span>Central Inverter AC Output:</span><span class="stat-val" id="out_central_inv_rating">0.00 MWac</span></div>
        <div class="stat-row central-only" style="display: none;"><span>Combiner Box DC Capacity:</span><span class="stat-val" id="out_cb_dc_kw">0.00 kWdc</span></div>
        <div class="stat-row"><span>Engineering Warning:</span><span class="stat-val orange" id="out_engineering_warning">Check assumptions</span></div>
        <div class="stat-row central-only" style="display: none;"><span>Central Combiner Boxes / Inverter:</span><span class="stat-val" id="out_cb_per_inv">0</span></div>
        <div class="stat-row central-only" style="display: none;"><span>Total Central Combiner Boxes:</span><span class="stat-val" id="out_total_cb">0</span></div>
        <div style="border-top:1px dashed #333; margin: 8px 0;"></div>
        <div class="stat-row"><span>Net Module Surface Area:</span><span class="stat-val" id="out_net_mod_area">0 Acres</span></div>
        <div class="stat-row"><span>Net Array Area at GCR:</span><span class="stat-val" id="out_net_array_area">0 Acres</span></div>
        <div class="stat-row"><span>Indicative Gross Site Area:</span><span class="stat-val orange" id="out_gross_area">0 Acres</span></div>
        <div style="border-top:1px dashed #333; margin: 8px 0;"></div>
        <div class="stat-row"><span>Modules per Packing Unit:</span><span class="stat-val" id="out_mod_per_pallet">0</span></div>
        <div class="stat-row"><span>Total Packing Units:</span><span class="stat-val" id="out_pallets">0</span></div>
        <div class="stat-row"><span>Modules per Container:</span><span class="stat-val" id="out_mod_per_cont">0</span></div>
        <div class="stat-row"><span>Total Base Containers:</span><span class="stat-val" id="out_containers">0</span></div>
        <div class="stat-row"><span>Spare Module Allowance:</span><span class="stat-val" id="out_spare_pct">0%</span></div>
        <div class="stat-row"><span>Containers (Inc. Spares):</span><span class="stat-val cyan" id="out_containers_spares">0</span></div>
        <div class="stat-row"><span>Containers per MWp:</span><span class="stat-val cyan" id="out_cont_per_mwp">0.00</span></div>
    </div>

    <button class="btn draw-btn" id="btn_draw">⌖ DRAW NEAT GRID</button>
    <button class="btn" id="btn_export">⬇ Export GeoJSON</button>

    <div class="disclaimer-box">
        <strong>ENGINEERING SCREENING OUTPUT</strong><br><br>
        These outputs are indicative screening values only. They are not construction design, financial advice, EPC pricing, grid compliance, logistics planning or transport instruction. All quantities, packaging, site area, cable routes, container loads, module specifications and financial assumptions must be verified against current manufacturer datasheets, project specific drawings, EPC scope,   … [line shortened here: 451 characters; full line on GitHub]
    </div>

    <div class="explainer-box">

        <h3>Electrical Topology Explanation</h3>
        <p>A string is a series chain of PV modules. For example, 30 modules per string means the voltage of 30 modules is added before entering the inverter.</p>
        <p>A string inverter converts DC power from several PV strings into low voltage AC power. The inverter rating in kVA defines the apparent AC power capability of each inverter. For example, 28 string inverters rated at 352 kVA create a skid block of approximately 9,856 kVA before transformer and grid limitations.</p>
        <p>A skid is the local electrical station that collects power from a group of inverters. It normally includes low voltage AC switchgear, a step up transformer, protection equipment and a medium voltage connection, often at 33 kV.</p>
        <p>A Ring Main Unit, or RMU, is medium voltage switchgear used to connect skids into a 33 kV network. It normally includes cable switches, protection, earthing switches and sometimes transformer protection.</p>
        <p>A 33 kV ring main is a medium voltage collection circuit that links several skids back toward the main substation or HV station. In this sandbox, Skids per 33 kV Ring Main means how many local substations sit on each medium voltage collection circuit. Number of 33 kV Ring Main Circuits means how many separate collection circuits are used across the solar farm.</p>
        <p>The financial model is driven by this hierarchy. More modules, strings, inverters, substations and 33 kV ring circuits change DC capacity, AC capacity, site area, cable loading, losses, CAPEX, revenue and development value. If the topology assumptions are unrealistic, the financial outputs will also be unrealistic.</p>

        <h3>About the VENTUS GIS SLD Sandbox</h3>
        <p>VENTUS GIS SLD Sandbox is a working engineering screening tool for utility scale solar, storage and grid connection analysis.</p>
        <p>The tool helps users explore the relationship between land, grid proximity, solar topology, module count, inverter architecture, logistics, BESS assumptions and baseline project economics in one visual interface.</p>
        <p>Users can enter a location, view UK substation reference data, select a grid node and generate an indicative solar layout using either string inverter or central inverter topology. The tool can estimate module count, DC capacity, AC capacity, site area, packing units, container loads, baseline revenue, CAPEX assumptions and simple long term financial outputs.</p>
        <p>This is a real engineering screening tool. It is not a final construction design package, grid offer, connection approval, EPC quotation or financial advice. It is designed to support early stage project assessment by making technical, spatial, logistics and financial assumptions visible before deeper engineering, grid, planning, procurement and financial studies begin.</p>
        <p>A key feature of the sandbox is that technical and commercial assumptions are shown together. In real projects, module count becomes logistics. Cable routing becomes electrical loss. Grid proximity becomes interface risk. BESS assumptions affect land, CAPEX and revenue logic. Financial outputs only become useful when the physical assumptions behind them are visible.</p>
        <p>The tool also includes GeoJSON export so that generated layouts and assumptions can be carried into external GIS workflows, reports, internal review or further engineering discussion. The exported data is intended to preserve context, including topology mode, technical assumptions, logistics assumptions, financial assumptions and warnings.</p>
        <p>The public substation layer is reference data only. A visible substation point does not confirm available capacity, connection rights, voltage suitability, cable route, grid acceptance or point of connection approval. Any real project must still be reviewed by competent engineers, grid specialists, planners, EPC teams, legal advisers and project finance professionals before real world d  … [line shortened here: 422 characters; full line on GitHub]
        <p>VENTUS created this sandbox to support better early stage thinking in solar and storage deployment. The aim is to help developers, engineers, suppliers, investors and commercial teams ask better questions before committing time, capital and contractual responsibility.</p>
        <p>Use the sandbox as a thinking tool. Use it to test scale. Use it to compare assumptions. Use it to understand where deeper engineering begins.</p>

<h3>Financial Model Logic</h3>
<p>The financial model is a screening layer for Solar Photovoltaic (PV) development, grid connection, Engineering, Procurement and Construction (EPC) readiness and operating asset value. It is designed to make the main commercial assumptions visible beside the physical layout, not to replace a full valuation report or investment committee model.</p>
<p>The energy price input is a blended screening assumption. It may represent government backed price stabilisation, a private buyer contract, merchant power exposure or a blended revenue case. Users should enter the expected captured electricity price that best reflects the project route to market.</p>
<p>The Operating Asset Net Present Value (NPV) input is user editable because operational value changes with contract quality, revenue certainty, merchant exposure, grid status, asset maturity, inflation, debt assumptions and investor return requirements. A project with stable long term revenue may justify a higher value assumption than a project with greater merchant exposure.</p>
<p>The development cost per Megawatt (MW) input is user editable because development capital at risk rises as a project moves from site identification through grid review, planning, buyer or revenue agreement review, technical design and Engineering, Procurement and Construction (EPC) readiness.</p>
<p>The Target Exit Value input is a screening assumption, not a promised sale value or formal valuation. It helps users test whether there may be development margin after development cost, module supply cost, Engineering, Procurement and Construction (EPC) cost, grid connection cost and owner costs.</p>
<p>The model deliberately avoids pretending to be a full discounted cash flow model. It is a fast comparison tool for early stage decision making. Real projects still require competent engineering, grid studies, planning review, legal review, tax review, debt sizing, revenue analysis and investment committee approval.</p>

<h3>Detailed Screening Disclaimer</h3>
<p>The VENTUS GIS SLD Sandbox is provided as an early stage screening, learning and project qualification tool. It is intended to help users visualise relationships between land, grid proximity, solar topology, cable route assumptions, module count, inverter architecture, logistics, Battery Energy Storage System (BESS) assumptions, capital cost assumptions, revenue assumptions and indicative proje  … [line shortened here: 417 characters; full line on GitHub]
<p>The sandbox does not create, imply or evidence a grid offer, grid connection approval, point of connection approval, available grid capacity, land right, wayleave, easement, planning consent, EPC price, construction programme, investment recommendation, financial valuation, lending approval or insurance acceptance.</p>
<p>Public substation points, voltage references and grid node markers are reference data only. A visible substation point does not confirm voltage suitability, thermal capacity, fault level headroom, protection compatibility, connection queue status, Gate 2 eligibility, land access, constructability, outage availability, reinforcement cost or acceptance by a Distribution Network Operator (DNO), Tr  … [line shortened here: 493 characters; full line on GitHub]
<p>User drawn cable routes, pin routes, direct route lines and exported route geometries are indicative routing assumptions only. They do not confirm landowner consent, wayleaves, easements, highway rights, railway crossings, watercourse crossings, third party utility conflicts, environmental constraints, planning acceptability, installation method, cable pulling feasibility, trench design, duct d  … [line shortened here: 530 characters; full line on GitHub]
<p>All cable lengths, losses and route assumptions must be checked by competent cable engineers using project specific route surveys, cable data sheets, soil thermal resistivity, installation depth, grouping factors, duct factors, cyclic loading, conductor temperature limits, voltage drop limits, short circuit withstand, sheath bonding, earthing design, protection settings and applicable standards  … [line shortened here: 459 characters; full line on GitHub]
<p>Solar layout outputs are indicative. Module count, DC capacity, AC capacity, site area, Ground Coverage Ratio (GCR), gross site factor, block layout, inverter count, substation count, access assumptions and container quantities must be verified against manufacturer datasheets, planning drawings, topographical surveys, geotechnical surveys, environmental constraints, drainage strategy, fire acce  … [line shortened here: 493 characters; full line on GitHub]
<p>Financial outputs are screening values only. Revenue, capital expenditure, development cost, module cost, EPC cost, owner cost, grid connection cost, operating cost, target exit value, Operating Asset Net Present Value (NPV), development margin and surplus outputs depend on assumptions entered by the user and may change materially with route to market, Contracts for Difference (CfD), Power Purc  … [line shortened here: 616 characters; full line on GitHub]
<p>BESS assumptions are indicative only. BESS power, BESS energy, BESS CAPEX, cycles, efficiency and revenue per MWh do not replace battery degradation modelling, augmentation strategy, warranty review, revenue stack modelling, fire safety review, planning review, grid compliance studies, metering design, controls design, availability assumptions, insurance review or safety case preparation.</p>
<p>The GeoJSON export preserves useful context for review and discussion, but exported data is not an Issued for Construction (IFC) drawing, legal boundary plan, grid application pack, cable route schedule, bill of quantities, EPC instruction, investment memorandum or bankable technical due diligence package. Any exported file must be reviewed and validated before being used in external GIS workfl  … [line shortened here: 489 characters; full line on GitHub]
<p>Users remain responsible for checking all inputs, outputs, assumptions and exported data. Any real world project should be reviewed by competent engineers, grid specialists, planners, environmental consultants, land agents, legal advisers, tax advisers, insurance advisers, EPC contractors, Owner's Engineers, lenders and investment committee professionals before committing capital, signing contr  … [line shortened here: 449 characters; full line on GitHub]
<p>The sandbox is designed to make assumptions visible, not to remove professional judgement. It should be used to ask better questions, compare scenarios, identify where deeper work is required and support disciplined early stage decision making.</p>
    </div>
</div>

<div class="panel panel-right">
    <div id="fetch_status"></div>
    <div class="gis-map-search" id="gis_map_search">
        <input id="gis_search_input" class="gis-search-input" type="text" placeholder="Search site or substation..." autocomplete="off" />
        <button id="gis_search_btn" class="map-toggle-btn gis-search-btn">GO</button>
        <div id="gis_search_results" class="gis-search-results"></div>
    </div>
    <div class="map-controls">
        <div class="map-toggle-row">
            <button id="btn_subs_toggle" class="map-toggle-btn active">SUBS ON</button>
            <button id="btn_basemap" class="map-toggle-btn">SATELLITE VIEW</button>
<button id="btn_map_expand" class="map-toggle-btn">MAP MAX</button>
<button id="btn_key_toggle" class="map-toggle-btn active">KEY ON</button>
<button id="btn_array_toggle" class="map-toggle-btn active">ARRAY ON</button>
<button id="btn_print_report" class="map-toggle-btn print-btn">PRINT</button>

        </div>
        <div class="map-toggle-row voltage-toggle-row">
            <button id="btn_atlas_66kv" class="map-toggle-btn active atlas-voltage-btn atlas-66kv" data-atlas-voltage="66kv">66 kV ON</button>
            <button id="btn_atlas_132kv" class="map-toggle-btn active atlas-voltage-btn atlas-132kv" data-atlas-voltage="132kv">132 kV ON</button>
            <button id="btn_atlas_275kv" class="map-toggle-btn active atlas-voltage-btn atlas-275kv" data-atlas-voltage="275kv">275 kV ON</button>
            <button id="btn_atlas_400kv" class="map-toggle-btn active atlas-voltage-btn atlas-400kv" data-atlas-voltage="400kv">400 kV ON</button>
        </div>
        <div class="map-toggle-row asset-toggle-row asset-filter-row">
            <select id="asset_layer_select" class="map-asset-select" title="Energy asset layer">
                <option value="off">Energy assets OFF</option>
                <option value="all">All technologies</option>
                <option value="solar_operational">Solar PV</option>
                <option value="bess_operational">BESS</option>
                <option value="wind_onshore_operational">Onshore wind</option>
                <option value="wind_offshore_operational">Offshore wind</option>
            </select>
            <select id="asset_status_select" class="map-asset-status-select" title="Project status">
                <option value="all">All statuses</option>
                <option value="operational">Operational</option>
                <option value="under construction">Under construction</option>
                <option value="awaiting construction">Awaiting construction</option>
                <option value="planning approved">Planning approved</option>
                <option value="planning submitted">Planning submitted</option>
                <option value="refused">Refused</option>
                <option value="withdrawn">Withdrawn</option>
            </select>
            <input id="asset_min_mw" class="asset-range-input" type="number" min="0" step="1" placeholder="Min MW" title="Minimum project capacity MW" />
            <input id="asset_max_mw" class="asset-range-input" type="number" min="0" step="1" placeholder="Max MW" title="Maximum project capacity MW" />
            <button id="btn_asset_filter_apply" class="map-toggle-btn">APPLY</button>
        </div>
    </div>

    <div class="crosshair">⌖</div>
    <div id="site_intel_panel" class="site-intel-panel collapsed">
        <div class="site-intel-header">
            <span>Site Intelligence</span>
            <button id="site_intel_close" type="button">×</button>
        </div>
        <div id="site_intel_body" class="site-intel-body">
            Click the map to inspect nearby assets, substations and voltage corridors.
        </div>
    </div>
<div class="map-tool-overlay" id="map_tool_overlay">
    <div class="map-toggle-row">
        <button id="btn_map_tools_toggle" class="map-toggle-btn active">TOOLS ON</button>
        <button id="btn_map_draw" class="map-toggle-btn">DRAW</button>
        <button id="btn_map_pick_array" class="map-toggle-btn">PICK ARRAY</button>
        <button id="btn_map_drop_pins" class="map-toggle-btn">DROP PINS</button>
        <button id="btn_map_draw_route" class="map-toggle-btn">DRAW ROUTE</button>
    </div>
    <div class="map-toggle-row map-size-row">
        <input id="map_target_dc_mwp" class="map-size-input" type="number" min="0.1" step="1" placeholder="MWp DC" />
        <button id="btn_map_apply_size" class="map-toggle-btn">SIZE MWp</button>
        <span id="map_size_status" class="map-size-status">Whole block sizing</span>
    </div>
    <div class="map-toggle-row map-tool-row-secondary">
        <button id="btn_map_rotate_left" class="map-toggle-btn">ROT -30</button>
        <button id="btn_map_rotate_right" class="map-toggle-btn">ROT +30</button>
        <button id="btn_map_rotate_90" class="map-toggle-btn">ROT +90</button>
        <button id="btn_map_nudge_up" class="map-toggle-btn">↑</button>
        <button id="btn_map_nudge_left" class="map-toggle-btn">←</button>
        <button id="btn_map_nudge_right" class="map-toggle-btn">→</button>
        <button id="btn_map_nudge_down" class="map-toggle-btn">↓</button>
    </div>
    <div class="map-toggle-row map-tool-row-secondary">
        <button id="btn_map_undo_pin" class="map-toggle-btn">UNDO PIN</button>
        <button id="btn_map_clear_route" class="map-toggle-btn">CLEAR ROUTE</button>
        <button id="btn_map_reset_rotation" class="map-toggle-btn">RESET ROT</button>
        <button id="btn_map_reset_array" class="map-toggle-btn">RESET ARRAY</button>
    </div>
</div>
    <div id="map"></div>
    <div class="legend" id="map_legend"></div>
</div>
</div>

<!-- V7 migrated modular app scripts -->
<script src="gis-sld-v5-map.js"></script>
<script src="gis-sld-v5-calculations.js"></script>
<script src="gis-sld-v5-finance.js"></script>
<script src="gis-sld-v5-ui-core.js"></script>
<script src="gis-sld-v5-drawing.js"></script>
<script src="gis-sld-v5-export.js"></script>
<script src="gis-sld-v5-ui.js"></script>


<script src="./route-state.js"></script>
<script src="./map-frame.js"></script>
</body>
</html>

Map Frame

A JavaScript file in the GIS SLD financial sandbox folder of Testcode that copies the current map drawing during its own render event; no display permission.

interactiontestcode / sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/map-frame.js · lines 1–32 of 32 · version 2026-09-05 20:28 · Entry point · pattern drawn (shared by 2 files)

What it does
Defines capture, cleanup, fail, cancel, drawn. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'sandbox'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 1 file: Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page (testcode).
What it achieves
It is built from the cancel step (`cancel`) and the drawn step (`drawn`). Defines `capture`, `cleanup`, `fail` and 2 more. It responds to abort events.
Why it matters
Loaded by the GIS Single-Line Diagram (SLD) Financial Sandbox page.
Application
testcode · sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox · script
Uses
none found
Used by
loaded by Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page (script src)
Produces
capture, cleanup, fail, cancel, drawn
Defines here
capture, cleanup, fail, cancel, drawn
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
testcode@a8a215982b13d6e2f6019b40bf0bef5755719773 sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/map-frame.js:1-32 · blob a60645b4d5357987439c8b7c4145d06ab3d2392d · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unknown
/* Copy the current map drawing during its own render event; no display permission. */
(() => {
  'use strict';
  async function capture({signal,timeout=5000}={}) {
    if(typeof map==='undefined'||!map?.isStyleLoaded()||!map.getSource('topology'))throw Error('GIS map is not ready');
    if(!Number.isFinite(timeout)||timeout<=0||timeout>30000)throw Error('Invalid capture timeout');
    const view=map;
    if(signal?.aborted)throw new DOMException('Capture cancelled','AbortError');
    return new Promise((resolve,reject)=>{
      let timer,settled=false;
      const cleanup=()=>{clearTimeout(timer);view.off('render',drawn);signal?.removeEventListener('abort',cancel);};
      const fail=error=>{if(settled)return;settled=true;cleanup();reject(error);};
      const cancel=()=>fail(new DOMException('Capture cancelled','AbortError'));
      const drawn=()=>{
        if(settled)return;
        try{
          if(view!==map||!view.isStyleLoaded()||!view.getSource('topology'))throw Error('GIS map changed or is not ready at capture time');
          const canvas=view.getCanvas();
          if(!canvas.width||!canvas.height)throw Error('GIS map has no drawing dimensions');
          if(canvas.width*canvas.height>40000000)throw Error('GIS map drawing exceeds capture size limit');
          const rect=canvas.getBoundingClientRect();
          const png=canvas.toDataURL('image/png');
          const route=window.GisSldRoute?.getSnapshot()||null;
          settled=true;cleanup();resolve(Object.freeze({schema:'ventus.gis-map-frame.v1',width:canvas.width,height:canvas.height,cssWidth:rect.width,cssHeight:rect.height,devicePixelRatio:window.devicePixelRatio||1,png,route,capturedAt:new Date().toISOString(),scope:'Map canvas pixels only; surrounding controls and legends are separate. No screen sharing.'}));
        }catch(error){fail(error);}
      };
      timer=setTimeout(()=>fail(Error('GIS map did not render before capture timeout')),timeout);
      try{signal?.addEventListener('abort',cancel,{once:true});view.once('render',drawn);view.triggerRepaint();}catch(error){fail(error);}
    });
  }
  Object.defineProperty(window,'GisSldMapFrame',{value:Object.freeze({capture}),writable:false,configurable:false});
})();