In this section
- V7 Development — Feed I Page render · solar-electrical-topology-analysis-engine-text-based / v7-development/feed-i/index.html lines 1–108
- Solar Electrical Topology Analysis Engine Text Based — V7 Development Page render · solar-electrical-topology-analysis-engine-text-based / v7-development/index.html lines 1–147
- Solar Electrical Topology Analysis Engine Text Based — V8 Leapfrog electrical · solar-electrical-topology-analysis-engine-text-based / v8-leapfrog/app.js lines 1–445
V7 Development — Feed I Page
A web page in Solar Electrical Topology Analysis Engine Text Based that reads inputs for length, csa and spacing (units: Ω). Published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v7-development/feed-i/.
rendersolar-electrical-topology-analysis-engine-text-based / v7-development/feed-i/index.html · lines 1–108 of 108 · Entry point
- What it does
- It draws its content. Defines el, fmt, row, calculate. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Inputs & outputs
- In: form fields (user input). Out: web page.
- Downstream impact
- Used directly by 3 files: Geometry Workbench (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v10-development/geometry-workbench.html); Solar Electrical Topology Analysis Engine Text Based — V8 Leapfrog Page (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v8-leapfrog/); Tests (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v8-leapfrog/tests.html). Reached from 125 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage V002 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v002.html). It is itself an entry point, published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v7-development/feed-i/.
- What it achieves
- It is built from the fmt step (`fmt`), the row step (`row`) and the calculate step (`calculate`). V7 FEED I Electromagnetic Workbench. It responds to input events.
- Why it matters
- Loaded by the Geometry Workbench page at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v10-development/geometry-workbench.html and 1 other page. Checked by Tests.
- Application
- solar-electrical-topology-analysis-engine-text-based · v7-development/feed-i · page
- Uses
- Solar Electrical Topology Analysis Engine Text Based — V7 Development Page (link), Solar Electrical Topology Analysis Engine Text Based — Index Page (link)
- Used by
- linked from Geometry Workbench (link), linked from Solar Electrical Topology Analysis Engine Text Based — V8 Leapfrog Page (link), linked from Tests (link)
- Produces
- el, fmt, row, calculate
- Defines here
- el, fmt, row, calculate
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 v7-development/feed-i/index.html:1-108 · blob 88c8f7bcde7c17566acf4881384eafe194d4699a · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>V7 FEED I Electromagnetic Workbench</title>
<style>
:root{color-scheme:dark;--bg:#05070a;--panel:#0b1118;--line:#263747;--text:#ecf7ff;--muted:#8fa4b8;--cyan:#27d8ff;--amber:#ffb347;--green:#48e28d;--red:#ff626d}*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at 75% 0,#10263a 0,#05070a 40%);color:var(--text);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}header{padding:22px 24px;border-bottom:1px solid var(- … [line shortened here: 2,836 characters; full line on GitHub]
</style>
</head>
<body>
<header><div class="kicker">GLOBALGRID2050 · V7 FEED I · INDEPENDENT BUILD</div><h1>Electromagnetic Foundations Workbench</h1><p>Unit-safe, evidence-labelled screening of a two-conductor PV string route. The working root engine and earlier V7 page remain unchanged.</p></header>
<div class="warning"><strong>RESEARCH BUILD.</strong> This increment does not claim measured glass-glass capacitance, validated water-film participation, full PEEC, OEM inverter impedance or standards compliance.</div>
<div class="layout">
<aside class="controls">
<section class="panel"><h2>Route geometry</h2>
<label>Route length (m)<input id="length" type="number" value="120" step="1"></label>
<label>Conductor CSA (mm²)<input id="csa" type="number" value="6" step="0.1"></label>
<label>Centre spacing (mm)<input id="spacing" type="number" value="40" step="1"></label>
<label>Effective relative permittivity<input id="er" type="number" value="1.3" step="0.1"></label>
<label>Geometry evidence<select id="geometryStatus"><option>MEASURED</option><option>OEM_DECLARED</option><option selected>ASSUMED</option><option>UNKNOWN</option></select></label>
<div class="note">The inductance geometry uses conductor diameter derived from CSA, not cable outside diameter.</div></section>
<section class="panel"><h2>Event classification</h2>
<label>Event rise time (µs)<input id="rise" type="number" value="1.2" step="0.01"></label>
<label>Event type<select id="event"><option>INVERTER_SWITCHING_EDGE</option><option>LIGHTNING_SURGE_FRONT</option><option>ARC_RESTRIKE</option><option>DIAGNOSTIC_PULSE</option><option>STEADY_DC</option></select></label>
<label>Lumped threshold (× delay)<input id="lumpedRatio" type="number" value="10" step="1"></label>
<label>Distributed threshold (× delay)<input id="distributedRatio" type="number" value="2" step="0.5"></label>
<div class="note">Faster events cannot become more lumped. Thresholds are configurable screening boundaries, not physical discontinuities.</div></section>
<section class="panel"><h2>Capacitance aggregation</h2>
<label>Literature C (nF/kWp)<input id="capPerKwp" type="number" value="85" step="1"></label>
<label>Module power (kWp)<input id="moduleKwp" type="number" value="0.660" step="0.001"></label>
<label>Modules / string<input id="modules" type="number" value="30" step="1"></label>
<label>Strings / MPPT<input id="stringsMppt" type="number" value="2" step="1"></label>
<label>Strings / inverter<input id="stringsInv" type="number" value="24" step="1"></label>
<label>Capacitance evidence<select id="capStatus"><option>MEASURED</option><option>OEM_DECLARED</option><option selected>LITERATURE_MODEL</option><option>FIRST_PRINCIPLES_DERIVED</option><option>ASSUMED</option><option>UNKNOWN</option></select></label>
<div class="note">This is an explicitly labelled literature-screening input. It is not a measured value for the selected module construction.</div></section>
<section class="panel"><h2>Common-mode research gate</h2>
<label>Film conductivity (S/m)<input id="conductivity" type="number" value="0.005" step="0.001"></label>
<label>Frequency (Hz)<input id="frequency" type="number" value="4000" step="100"></label>
<label>Film-model status<select id="filmStatus"><option selected>FINITE_ELEMENT_REQUIRED</option><option>LITERATURE_MODEL</option><option>MEASURED</option><option>UNKNOWN</option></select></label>
<div class="note">Only the qualitative scaling √(conductivity/frequency) is shown. No quantitative film capacitance is calculated until an accepted geometry constant or measurement is supplied.</div></section>
</aside>
<main class="work">
<div class="status">
<article><span>Model class</span><strong id="modelClass">—</strong></article>
<article><span>One-way delay</span><strong id="delay">—</strong></article>
<article><span>Differential Z₀</span><strong id="z0">—</strong></article>
<article><span>Inverter C screen</span><strong id="invCap">—</strong></article>
</div>
<section class="section"><h2>Differential two-wire parameters</h2><table><tbody id="diffTable"></tbody></table></section>
<section class="section"><h2>Unit-safe capacitance aggregation</h2><table><thead><tr><th>Boundary</th><th>Power basis</th><th>Capacitance</th><th>Evidence</th></tr></thead><tbody id="capTable"></tbody></table></section>
<section class="section"><h2>Event decision trace</h2><table><tbody id="eventTable"></tbody></table></section>
<section class="section"><h2>Common-mode and water-film gate</h2><div class="gate" id="gate"></div></section>
<section class="section"><h2>FEED I / FEED II build status</h2><div class="gate"><strong>Implemented in this launch:</strong> unit discipline, evidence status, two-wire differential parameters, low/high-frequency inductance split, capacitance aggregation and event classification.<br><br><strong>Held for FEED II or validation:</strong> generated sequential/leapfrog geometry, multi-layer cell-to-ear … [line shortened here: 591 characters; full line on GitHub]
<div class="links"><a href="../">Earlier V7 reference</a><a href="../../">Working root engine</a><a href="../comparisons/BUILD_PLAN_FEEDS_I_II.md">Build plan</a><a href="../comparisons/FEED_I_VS_FEED_II.md">Feed comparison</a></div>
</main>
</div>
<script>
'use strict';
const MU0=4*Math.PI*1e-7, EPS0=8.8541878128e-12;
const ids=['length','csa','spacing','er','rise','lumpedRatio','distributedRatio','capPerKwp','moduleKwp','modules','stringsMppt','stringsInv','conductivity','frequency','geometryStatus','capStatus','filmStatus','event'];
const el=id=>document.getElementById(id); const n=id=>Number(el(id).value);
function fmt(v,u,d=3){return Number.isFinite(v)?v.toFixed(d)+' '+u:'—'}
function row(a,b,c=''){return `<tr><td>${a}</td><td>${b}</td><td>${c}</td></tr>`}
function calculate(){
const length=n('length'), area=n('csa'), spacing=n('spacing')/1000, er=n('er');
const diameter=Math.sqrt(4*area/Math.PI)/1000;
if(!(spacing>diameter&&length>0&&area>0&&er>=1)){el('modelClass').textContent='INVALID INPUT';return}
const g=Math.acosh(spacing/diameter);
const lExt=MU0/Math.PI*g;
const lInt=MU0/(4*Math.PI);
const lLow=lExt+lInt;
const lHigh=lExt;
const cDiff=Math.PI*EPS0*er/g;
const velocity=1/Math.sqrt(lHigh*cDiff);
const z0=Math.sqrt(lHigh/cDiff);
const delay=length/velocity;
const rise=n('rise')*1e-6;
const ratio=rise/delay;
let cls='TRANSITIONAL',klass='warn';
if(ratio>n('lumpedRatio')){cls='LUMPED';klass='good'} else if(ratio<=n('distributedRatio')){cls='DISTRIBUTED';klass='bad'}
el('modelClass').textContent=cls;el('modelClass').className=klass;
el('delay').textContent=fmt(delay*1e6,'µs',3);el('z0').textContent=fmt(z0,'Ω',2);
el('diffTable').innerHTML=
row('Conductor diameter',fmt(diameter*1000,'mm',3),'FIRST_PRINCIPLES_DERIVED')+
row('Geometry acosh term',g.toFixed(5),el('geometryStatus').value)+
row('External L′',fmt(lExt*1e6,'µH/m',4),'FIRST_PRINCIPLES_DERIVED')+
row('Internal loop L′ at low frequency',fmt(lInt*1e6,'µH/m',4),'FIRST_PRINCIPLES_DERIVED')+
row('Total low-frequency L',fmt(lLow*length*1e6,'µH',2),'SCREENING')+
row('Total high-frequency L',fmt(lHigh*length*1e6,'µH',2),'SCREENING')+
row('Differential C′',fmt(cDiff*1e12,'pF/m',2),'FIRST_PRINCIPLES_DERIVED')+
row('Differential route C',fmt(cDiff*length*1e9,'nF',3),'SCREENING')+
row('Propagation velocity',fmt(velocity/1e6,'Mm/s',2),'SCREENING')+
row('Characteristic impedance',fmt(z0,'Ω',2),'SCREENING');
const cpk=n('capPerKwp')*1e-9, moduleP=n('moduleKwp'), mods=n('modules'), sm=n('stringsMppt'), si=n('stringsInv');
const cModule=cpk*moduleP, cString=cModule*mods, cMppt=cString*sm, cInv=cString*si;
el('invCap').textContent=cInv>=1e-6?fmt(cInv*1e6,'µF',2):fmt(cInv*1e9,'nF',2);
const status=el('capStatus').value;
el('capTable').innerHTML=`<tr><td>Module</td><td>${moduleP.toFixed(3)} kWp</td><td>${fmt(cModule*1e9,'nF',2)}</td><td class="evidence">${status}</td></tr>`+
`<tr><td>String</td><td>${(moduleP*mods).toFixed(2)} kWp</td><td>${fmt(cString*1e6,'µF',3)}</td><td class="evidence">${status}</td></tr>`+
`<tr><td>MPPT</td><td>${(moduleP*mods*sm).toFixed(2)} kWp</td><td>${fmt(cMppt*1e6,'µF',3)}</td><td class="evidence">${status}</td></tr>`+
`<tr><td>Inverter</td><td>${(moduleP*mods*si).toFixed(2)} kWp</td><td>${fmt(cInv*1e6,'µF',3)}</td><td class="evidence">${status}</td></tr>`;
el('eventTable').innerHTML=row('Event',el('event').value,'USER_SELECTED')+row('Rise time',fmt(rise*1e6,'µs',3),'USER_INPUT')+row('One-way delay',fmt(delay*1e6,'µs',3),'DERIVED')+row('Rise-time / delay ratio',ratio.toFixed(3),'DERIVED')+row('Classification',cls,'CONFIGURABLE_SCREEN');
const scale=Math.sqrt(Math.max(n('conductivity'),0)/Math.max(n('frequency'),1));
el('gate').innerHTML=`<strong>${el('filmStatus').value}</strong><br>Qualitative RC-sheet participation index: <code>√(σ/f) = ${scale.toExponential(4)}</code> in unnormalised units.<br>Increasing conductivity increases this index; increasing frequency decreases it. The build deliberately does not convert this index into participating width or capacitance because the geometry constant, boundary con … [line shortened here: 675 characters; full line on GitHub]
}
ids.forEach(id=>el(id).addEventListener('input',calculate));calculate();
</script>
</body></html>Solar Electrical Topology Analysis Engine Text Based — V7 Development Page
A web page that draws solar DC topology and cables. Published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v7-development/. It is built from the fmt step (`fmt`), the bands step (`bands`) and the acosh step (`acosh`).
rendersolar-electrical-topology-analysis-engine-text-based / v7-development/index.html · lines 1–147 of 147 · Entry point · pattern cmInductance (shared by 2 files)
- What it does
- It draws solar DC topology and cables. Defines 20 functions or classes, including $, fmt, bands, acosh, rTemp. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): 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.
- Inputs & outputs
- In: form fields (user input). Out: JSON file solar-dc-topology-v7.json; downloaded file solar-dc-topology-v7.json; web page; canvas drawing.
- Downstream impact
- Used directly by 40 files: V7 Development — Feed I Page (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v7-development/feed-i/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); Homepage Versions — GlobalGrid2050 Page (globalgrid2050, https://globalgrid2050.com/homepage_versions/202608291526-globalgrid2050/); Homepage V002 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v002.html); and 36 more. Reached from 89 other entry points, including GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html); Homepage V038 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v038.html). It is itself an entry point, published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v7-development/.
- What it achieves
- Independent V7 solar DC topology workbench with sequential and leapfrog wiring, geometry-derived inverter distances and electrical comparison. It responds to input, wheel and pointerdown events.
- Why it matters
- Loaded by the Feed I page at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v7-development/feed-i/ and 39 other pages.
- Application
- solar-electrical-topology-analysis-engine-text-based · v7-development · page
- Uses
- none found
- Used by
- linked from V7 Development — Feed I Page (link), named by URL in GlobalGrid2050 Historical Builds (estate URL), named by URL in Homepage Versions — GlobalGrid2050 Page (estate URL), named by URL in Homepage V002 (estate URL), named by URL in Homepage V003 (estate URL), named by URL in Homepage V004 (estate URL), named by URL in Homepage V005 (estate URL), named by URL in Homepage V006 (estate URL), and 32 more
- Produces
- $, fmt, bands, acosh, rTemp, twoWire, route, moduleCaps, coldVoc, breachTemp, cmInductance, bounds
- Defines here
- $, fmt, bands, acosh, rTemp, twoWire, route, moduleCaps, coldVoc, breachTemp, cmInductance, bounds, resize, transform, cable, nearest, comparisonCable, zoomAt, point, endPointer
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 v7-development/index.html:1-147 · blob 5fe3bb53932ea27fef144de122a64fd977941af8 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Solar DC String Topology Engine V7</title>
<meta name="description" content="Independent V7 solar DC topology workbench with sequential and leapfrog wiring, geometry-derived inverter distances and electrical comparison.">
<style>
:root{color-scheme:dark;--bg:#05070a;--panel:#0b1118;--line:#263747;--text:#ecf7ff;--muted:#90a4b8;--cyan:#27d8ff;--purple:#b893ff;--amber:#ffb347;--red:#ff626d;--green:#48e28d}
*{box-sizing:border-box}html,body{margin:0;background:radial-gradient(circle at 75% 0,#10263a 0,#05070a 42%);color:var(--text);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}
header{display:flex;justify-content:space-between;gap:22px;padding:24px 28px;border-bottom:1px solid var(--line);background:#05070a}h1{margin:5px 0 7px;font-size:clamp(28px,4vw,48px);line-height:1.02}.kicker{color:var(--cyan);font:900 12px ui-monospace,monospace;letter-spacing:.16em}.muted,header p{color:var(--muted)}header p{margin:0;max-width:960px}.status{align-self:flex-start;padding:11px 14px … [line shortened here: 4,166 characters; full line on GitHub]
@media(max-width:1100px){.shell{grid-template-columns:1fr}.controls{display:grid;grid-template-columns:repeat(2,1fr)}}
@media(max-width:720px){header{display:block;padding:22px 18px}.status{display:inline-block;margin-top:12px}.shell{padding:10px}.controls{grid-template-columns:1fr}.summary{grid-template-columns:repeat(2,1fr)}.canvasWrap{height:68vh;min-height:560px}.card label{grid-template-columns:1fr 128px}.toprow{display:block}.legend{margin-top:8px}}
@media(max-width:430px){.summary{grid-template-columns:1fr}.card label{grid-template-columns:1fr}}
</style>
</head>
<body>
<header><div><div class="kicker">GLOBALGRID2050 · INDEPENDENT V7 WORKSPACE</div><h1>Solar DC String Topology Engine</h1><p>V7 preserves the physical 30-module A-frame model while making sequential and leapfrog string routes explicit, selectable and electrically comparable.</p></div><div class="status">V7 IN DEVELOPMENT · USE AT YOUR OWN RISK</div></header>
<div class="warning"><strong>RESEARCH BUILD.</strong> Geometry and route lengths are calculated; installation details, lead routing, capacitance, inverter termination and transient results remain screening outputs until verified from project evidence and measurement.</div>
<div class="shell">
<aside class="controls">
<section class="card"><h2>Physical array geometry</h2>
<label>Modules / string <input id="modules" type="number" min="2" value="30"></label>
<label>Module width along row (m) <input id="moduleWidth" type="number" min=".1" step=".001" value="1.303"></label>
<label>Module length up slope (m) <input id="moduleLength" type="number" min=".1" step=".001" value="2.384"></label>
<label>Along-row gap (m) <input id="gap" type="number" min="0" step=".001" value=".020"></label>
<label>Clamp gap up slope (m) <input id="clampGap" type="number" min="0" step=".001" value=".020"></label>
<label>Tilt (degrees) <input id="tilt" type="number" min="0" max="60" step=".1" value="10"></label>
<label>East bands <input id="eastBands" type="text" value="5,5,2"></label>
<label>West bands <input id="westBands" type="text" value="5,5,2"></label>
<label>Band route allowance (m) <input id="bandGap" type="number" min="0" step=".1" value=".5"></label>
<label>Distance from inverter to nearest terminals (m) <input id="distance" type="number" min="0" step=".5" value="10"></label>
<div class="note">No string length is typed. Every external positive and negative route is derived from the inverter distance, row span, band position and wiring mode.</div>
</section>
<section class="card"><h2>Wiring topology and MPPT</h2>
<label>Wiring mode <select id="wiring"><option value="sequential">Sequential · opposite physical ends</option><option value="leapfrog" selected>Leapfrog · both terminals near</option></select></label>
<label>MPPT count <input id="mppts" type="number" min="1" value="12"></label>
<label>External +/− spacing (mm) <input id="externalSpacing" type="number" min="3.1" step="1" value="40"></label>
<label>Sequential module-loop separation (mm) <input id="sequentialSpacing" type="number" min="2.5" step="10" value="500"></label>
<label>Leapfrog residual separation (mm) <input id="leapfrogSpacing" type="number" min="2.5" step="1" value="40"></label>
<label>Effective εr <input id="epsilon" type="number" min="1" step=".1" value="1.3"></label>
<label>Cable height above earth (m) <input id="height" type="number" min=".01" step=".1" value="1.5"></label>
<label>Disturbance rise time (µs) <input id="rise" type="number" min=".001" step=".1" value="1.2"></label>
<div class="note">Leapfrog changes the module connection order and terminal coordinates. It does not change string voltage, current, module count or polarity.</div>
</section>
<section class="card"><h2>Complete circuit resistance</h2>
<label>Home-run R20 (mΩ/m) <input id="homeR20" type="number" min="0" step=".01" value="3.39"></label>
<label>Module-lead R20 (mΩ/m) <input id="leadR20" type="number" min="0" step=".01" value="5.09"></label>
<label>Positive lead/module (m) <input id="posLead" type="number" min="0" step=".01" value=".35"></label>
<label>Negative lead/module (m) <input id="negLead" type="number" min="0" step=".01" value=".28"></label>
<label>Home conductor diameter (mm) <input id="homeDiameter" type="number" min=".1" step=".01" value="3.00"></label>
<label>Lead conductor diameter (mm) <input id="leadDiameter" type="number" min=".1" step=".01" value="2.45"></label>
<label>Home-run temperature (°C) <input id="homeTemp" type="number" value="70"></label>
<label>Lead temperature (°C) <input id="leadTemp" type="number" value="75"></label>
<label>Mated connector pairs/string <input id="connectorPairs" type="number" min="0" value="33"></label>
<label>Resistance / mated pair (mΩ) <input id="pairR" type="number" min="0" step=".01" value=".20"></label>
<label>String current (A) <input id="current" type="number" min="0" step=".01" value="17.35"></label>
</section>
<section class="card"><h2>Capacitance and voltage screen</h2>
<label>Glass εr <input id="glassEr" type="number" min="1" step=".1" value="7.5"></label>
<label>Glass thickness (mm) <input id="glass" type="number" min=".1" step=".1" value="2.0"></label>
<label>Wetted face count <select id="wetFaces"><option value="1">1</option><option value="2" selected>2</option></select></label>
<label>Frame contact width (mm) <input id="contactWidth" type="number" min="0" step="1" value="10"></label>
<label>Module Vmp (V) <input id="moduleVmp" type="number" step=".1" value="38.1"></label>
<label>Module Voc (V) <input id="moduleVoc" type="number" step=".1" value="45.9"></label>
<label>βVoc (%/°C) <input id="betaVoc" type="number" step=".01" value="-.25"></label>
<label>Minimum cell temperature (°C) <input id="coldTemp" type="number" value="-10"></label>
<label>System maximum voltage (V) <input id="systemMax" type="number" value="1500"></label>
<div class="note">Dry and fully wetted capacitances remain geometry screening values, not measured module impedance.</div>
</section>
<section class="card"><h2>Fleet scale</h2>
<label>Inverter count <input id="siteInv" type="number" min="1" value="795"></label>
<label>Actual site strings <input id="siteStrings" type="number" min="1" value="19080"></label>
</section>
<div class="buttons"><button id="reset">RESET</button><button id="export" class="primary">EXPORT V7 JSON</button></div>
</aside>
<section class="workspace">
<div id="fatal" class="error"></div>
<div class="toprow"><div><h2>V7 topology · correct terminal coordinates</h2><p>Drag to pan, wheel or pinch to zoom, click a string to inspect it.</p></div><div class="legend"><span class="east">East face</span><span class="west">West face</span><span class="inv">Inverter</span></div></div>
<div class="canvasWrap" id="wrap"><div class="zoom"><button id="zoomOut">−</button><span id="zoomReadout">100%</span><button id="zoomReset">FIT</button><button id="zoomIn">+</button></div><canvas id="scene"></canvas></div>
<div id="modelBanner" class="banner"></div>
<div class="summary">
<article><span>Row span</span><strong id="rowSpan">—</strong><small>derived geometry</small></article>
<article><span>Archetype strings</span><strong id="stringCount">—</strong><small>east + west bands</small></article>
<article><span>Selected + / −</span><strong id="selectedLengths">—</strong><small>external home-runs</small></article>
<article><span>Selected saving</span><strong id="selectedSaving">—</strong><small>versus sequential</small></article>
<article><span>External cable / inverter</span><strong id="externalFleet">—</strong><small>selected topology</small></article>
<article><span>Complete conductor</span><strong id="totalConductor">—</strong><small>home-runs + module leads</small></article>
<article><span>R operating</span><strong id="resistance">—</strong><small>complete circuit</small></article>
<article><span>Voltage drop / loss</span><strong id="drop">—</strong><small>at stated current</small></article>
<article><span>L differential low / high</span><strong id="inductance">—</strong><small>internal L included / removed</small></article>
<article><span>Loop area guide</span><strong id="loopArea">—</strong><small>selected topology</small></article>
<article><span>Z₀ / initial wave</span><strong id="wave">—</strong><small>high-frequency differential screen</small></article>
<article><span>One-way delay</span><strong id="delay">—</strong><small>model-selection basis</small></article>
<article><span>C string dry / wet</span><strong id="capString">—</strong><small>screening values</small></article>
<article><span>C inverter dry / wet</span><strong id="capInverter">—</strong><small>all archetype strings</small></article>
<article><span>Cold Voc / margin</span><strong id="coldVocOut">—</strong><small id="coldVocBasis">—</small></article>
<article><span>Fleet average</span><strong id="fleetAverage">—</strong><small>actual strings / inverters</small></article>
</div>
<section class="section comparison"><h2>Sequential versus leapfrog impact</h2><div class="body" id="comparisonText">Calculating…</div><canvas id="comparison" width="1200" height="520"></canvas></section>
<section class="section"><h2>All strings · V7 schedule</h2><div class="scroll"><table><thead><tr><th>ID</th><th>Face</th><th>Band</th><th>Rank</th><th>Mode</th><th>+ m</th><th>− m</th><th>External m</th><th>Leads m</th><th>Total m</th><th>R op Ω</th><th>ΔV V</th><th>Loss W</th><th>Area m²</th><th>L low/high µH</th><th>C dry/wet µF</th><th>MPPT</th></tr></thead><tbody id="rows"></tbody></table></di … [line shortened here: 412 characters; full line on GitHub]
<section class="section"><h2>MPPT pairing review</h2><div class="scroll"><table><thead><tr><th>MPPT</th><th>String A</th><th>String B</th><th>Pairing</th><th>External length ratio</th></tr></thead><tbody id="mpptRows"></tbody></table></div></section>
</section>
</div>
<footer>Generic research model. Planned topology is not evidence of the as-built installation. Every design conclusion requires competent engineering review.</footer>
<script>
"use strict";
(()=>{
const MU0=4*Math.PI*1e-7,EPS0=8.8541878128e-12,ALPHA=.00393;
const $=id=>document.getElementById(id),num=id=>Number($(id).value),text=id=>$(id).value;
const inputIds=["modules","moduleWidth","moduleLength","gap","clampGap","tilt","eastBands","westBands","bandGap","distance","wiring","mppts","externalSpacing","sequentialSpacing","leapfrogSpacing","epsilon","height","rise","homeR20","leadR20","posLead","negLead","homeDiameter","leadDiameter","homeTemp","leadTemp","connectorPairs","pairR","current","glassEr","glass","wetFaces","contactWidth","modul … [line shortened here: 476 characters; full line on GitHub]
const state={selected:1,zoom:1,panX:0,panY:0,pointers:new Map(),gesture:null,last:null};
const fmt=(v,d=2)=>Number.isFinite(v)?v.toLocaleString("en-GB",{minimumFractionDigits:d,maximumFractionDigits:d}):"—";
function bands(id){const a=text(id).split(",").map(x=>Math.round(Number(x.trim()))).filter(x=>x>0);return a.length?a:[1]}
function acosh(x){return Math.log(x+Math.sqrt(x*x-1))}
function rTemp(r20,t){return r20*(1+ALPHA*(t-20))}
function twoWire(spacingMm,diameterMm,er){const D=spacingMm/1000,d=diameterMm/1000;if(!(D>d))throw new Error("Conductor centre spacing must exceed conductor diameter");const g=acosh(D/d),Lext=MU0/Math.PI*g,Lint=MU0/(4*Math.PI),C=Math.PI*EPS0*er/g;return{g,Lext,Llow:Lext+Lint,C,z0:Math.sqrt(Lext/C),v:1/Math.sqrt(Lext*C)}}
function inputs(){return{modules:Math.max(2,Math.round(num("modules"))),moduleWidth:Math.max(.01,num("moduleWidth")),moduleLength:Math.max(.01,num("moduleLength")),gap:Math.max(0,num("gap")),clampGap:Math.max(0,num("clampGap")),tilt:num("tilt"),eastBands:bands("eastBands"),westBands:bands("westBands"),bandGap:Math.max(0,num("bandGap")),distance:Math.max(0,num("distance")),wiring:text("wiring"),mpp … [line shortened here: 1,545 characters; full line on GitHub]
function geometry(m){const row=m.modules*m.moduleWidth+(m.modules-1)*m.gap,rankSlope=m.moduleLength+m.clampGap,rankPlan=rankSlope*Math.cos(m.tilt*Math.PI/180),strings=[];let id=1;[["E",-1,m.eastBands],["W",1,m.westBands]].forEach(([face,sign,list])=>list.forEach((count,band)=>{const x0=m.distance+band*(row+m.bandGap),x1=x0+row;for(let rank=0;rank<count;rank++){const y0=sign*rank*rankPlan,y1=sign*( … [line shortened here: 694 characters; full line on GitHub]
function route(s,m){const near=s.x0,far=s.x1;if(m.wiring==="leapfrog")return{p:near,n:near,near,far};return s.face==="E"?{p:near,n:far,near,far}:{p:far,n:near,near,far}}
function moduleCaps(m){const area=m.moduleWidth*m.moduleLength,perimeter=2*(m.moduleWidth+m.moduleLength),dryArea=perimeter*m.contactWidth/1000,C=(A)=>EPS0*m.glassEr*A/(m.glass/1000);return{dryModule:C(dryArea),wetModule:C(area*m.wetFaces)}}
function coldVoc(m){return m.moduleVoc*m.modules*(1+(m.betaVoc/100)*(m.coldTemp-25))}
function breachTemp(m){const base=m.moduleVoc*m.modules,b=m.betaVoc/100;return b===0?NaN:25+(m.systemMax/base-1)/b}
function cmInductance(s,m,tw){const r=m.homeDiameter/2000,sep=m.externalSpacing/1000,req=Math.sqrt(Math.max(r*sep,1e-15)),ratio=2*m.height/req,Lm=ratio>1?MU0/(2*Math.PI)*Math.log(ratio):0,length=Math.max(s.p,s.n)+s.leadLen/2;return Lm*length}
function compute(){const m=inputs(),g=geometry(m),twExt=twoWire(m.externalSpacing,m.homeDiameter,m.epsilon),moduleSep=m.wiring==="leapfrog"?m.leapfrogSpacing:m.sequentialSpacing,twModule=twoWire(moduleSep,m.leadDiameter,m.epsilon),caps=moduleCaps(m);g.strings.forEach(s=>{Object.assign(s,route(s,m));s.external=s.p+s.n;s.leadLen=m.modules*(m.posLead+m.negLead);s.total=s.external+s.leadLen;s.r20=s.ex … [line shortened here: 1,322 characters; full line on GitHub]
function pairMppts(strings,limit){const un=[...strings],out=[];let mppt=1;while(un.length&&mppt<=limit){const a=un.shift(),idx=un.findIndex(x=>x.face===a.face&&x.band===a.band),b=idx>=0?un.splice(idx,1)[0]:un.shift();out.push({mppt:mppt++,a,b,type:b?(a.face===b.face&&a.band===b.band?"within-band":"forced cross-band"):"single"})}while(un.length){const a=un.shift(),b=un.shift();out.push({mppt:mppt++ … [line shortened here: 453 characters; full line on GitHub]
function bounds(d){return{minX:-3,maxX:d.g.width+3,minY:-d.g.maxRanks*d.g.rankPlan-2,maxY:d.g.maxRanks*d.g.rankPlan+2}}
function resize(){const c=$("scene"),r=c.getBoundingClientRect(),d=devicePixelRatio||1;c.width=Math.max(1,Math.round(r.width*d));c.height=Math.max(1,Math.round(r.height*d));const ctx=c.getContext("2d");ctx.setTransform(d,0,0,d,0,0);return{ctx,w:r.width,h:r.height}}
function transform(d,w,h){const b=bounds(d),pad=45,fit=Math.min((w-2*pad)/(b.maxX-b.minX),(h-2*pad)/(b.maxY-b.minY)),sc=fit*state.zoom,ox=pad-b.minX*sc+state.panX,oy=h/2+state.panY;return{sc,ox,oy,sx:x=>ox+x*sc,sy:y=>oy+y*sc,wx:x=>(x-ox)/sc,wy:y=>(y-oy)/sc}}
function cable(ctx,a,b,t,width=1.3){ctx.save();ctx.strokeStyle="rgba(232,242,249,.5)";ctx.lineWidth=width+1.2;ctx.beginPath();ctx.moveTo(t.sx(a[0]),t.sy(a[1]));ctx.lineTo(t.sx(b[0]),t.sy(b[1]));ctx.stroke();ctx.strokeStyle="#000";ctx.lineWidth=width;ctx.beginPath();ctx.moveTo(t.sx(a[0]),t.sy(a[1]));ctx.lineTo(t.sx(b[0]),t.sy(b[1]));ctx.stroke();ctx.restore()}
function drawModules(ctx,s,m,t,selected){const yy=Math.min(s.y0,s.y1),h=Math.abs(s.y1-s.y0),pitch=m.moduleWidth+m.gap;for(let i=0;i<m.modules;i++){const x=s.x0+i*pitch,px=t.sx(x),py=t.sy(yy),ww=Math.max(1,m.moduleWidth*t.sc-.7),hh=Math.max(2,h*t.sc-1);ctx.fillStyle=selected?"rgba(255,179,71,.28)":s.face==="E"?"rgba(39,216,255,.18)":"rgba(184,147,255,.22)";ctx.fillRect(px,py,ww,hh);ctx.strokeStyle= … [line shortened here: 512 characters; full line on GitHub]
function drawLeapfrogInternal(ctx,s,m,t,width){const pitch=m.moduleWidth+m.gap,top=s.y-Math.min(.09,m.moduleLength*.03),bottom=s.y+Math.min(.09,m.moduleLength*.03);for(let i=0;i<m.modules-2;i+=2){cable(ctx,[s.x0+(i+.5)*pitch,top],[s.x0+(i+2.5)*pitch,top],t,width)}for(let i=1;i<m.modules-2;i+=2){cable(ctx,[s.x0+(i+.5)*pitch,bottom],[s.x0+(i+2.5)*pitch,bottom],t,width)}cable(ctx,[s.x0+(m.modules-1.5 … [line shortened here: 457 characters; full line on GitHub]
function drawScene(d){const {ctx,w,h}=resize(),t=transform(d,w,h);state.last={d,t,w,h};ctx.clearRect(0,0,w,h);ctx.fillStyle="#04070b";ctx.fillRect(0,0,w,h);ctx.strokeStyle="#111e29";ctx.lineWidth=1;for(let x=0;x<=d.g.width;x+=10){ctx.beginPath();ctx.moveTo(t.sx(x),0);ctx.lineTo(t.sx(x),h);ctx.stroke()}const invX=t.sx(0),b=bounds(d);ctx.fillStyle="#ffb347";ctx.fillRect(invX-10,t.sy(b.minY)+10,20,t. … [line shortened here: 1,541 characters; full line on GitHub]
function nearest(wx,wy,d){let best=null,score=Infinity;for(const s of d.g.strings){const dx=wx<s.x0?s.x0-wx:wx>s.x1?wx-s.x1:0,dy=Math.abs(wy-s.y),q=dx+dy*.8;if(q<score){score=q;best=s}}return score<Math.max(2,d.g.rankPlan*.8)?best:null}
function comparisonCable(ctx,pts,w=4){ctx.save();ctx.lineJoin="round";ctx.lineCap="round";ctx.strokeStyle="rgba(238,247,255,.72)";ctx.lineWidth=w+2;ctx.beginPath();pts.forEach((p,i)=>i?ctx.lineTo(p[0],p[1]):ctx.moveTo(p[0],p[1]));ctx.stroke();ctx.strokeStyle="#000";ctx.lineWidth=w;ctx.beginPath();pts.forEach((p,i)=>i?ctx.lineTo(p[0],p[1]):ctx.moveTo(p[0],p[1]));ctx.stroke();ctx.restore()}
function drawComparison(d){const c=$("comparison"),ctx=c.getContext("2d"),W=c.width;ctx.clearRect(0,0,W,c.height);ctx.fillStyle="#03070b";ctx.fillRect(0,0,W,c.height);const count=Math.min(d.m.modules,30),x0=185,right=W-50,pitch=(right-x0)/count,mw=Math.max(5,pitch-2),inv=65;function row(y,title,leap){ctx.fillStyle="#e0f7ff";ctx.font="900 20px ui-monospace,monospace";ctx.fillText(title,24,y+30);ctx … [line shortened here: 1,627 characters; full line on GitHub]
function render(){try{$("fatal").style.display="none";const d=compute();if(!d.g.strings.some(s=>s.id===state.selected))state.selected=d.g.strings[0]?.id||1;const s=d.g.strings.find(x=>x.id===state.selected);drawScene(d);drawComparison(d);const totalExternal=d.g.strings.reduce((a,x)=>a+x.external,0),seqEquivalent=d.g.strings.reduce((a,x)=>a+(2*x.near+x.row),0),saving=seqEquivalent-totalExternal,inv … [line shortened here: 3,406 characters; full line on GitHub]
function zoomAt(factor,sx,sy){if(!state.last||!state.current)return;const t0=state.last.t,wx=t0.wx(sx),wy=t0.wy(sy);state.zoom=Math.max(.35,Math.min(12,state.zoom*factor));const {w,h}=state.last,t1=transform(state.current,w,h);state.panX+=sx-t1.sx(wx);state.panY+=sy-t1.sy(wy);render()}
inputIds.forEach(id=>$(id).addEventListener("input",render));$("reset").onclick=()=>location.reload();$("export").onclick=()=>{const d=compute(),payload={schema:"v7-leapfrog-topology-2026-07-27",reliance:"Indicative research model; not as-built or construction design.",inputs:d.m,row_span_m:d.g.row,strings:d.g.strings,pairs:d.pairs.map(p=>({mppt:p.mppt,a:p.a.id,b:p.b?.id||null,type:p.type}))};cons … [line shortened here: 861 characters; full line on GitHub]
const canvas=$("scene");canvas.addEventListener("wheel",e=>{e.preventDefault();const r=canvas.getBoundingClientRect();zoomAt(Math.exp(-e.deltaY*.001),e.clientX-r.left,e.clientY-r.top)},{passive:false});
function point(e){const r=canvas.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top,cx:e.clientX,cy:e.clientY}}
canvas.addEventListener("pointerdown",e=>{canvas.setPointerCapture?.(e.pointerId);const p=point(e);state.pointers.set(e.pointerId,p);if(state.pointers.size===2){const a=[...state.pointers.values()];state.gesture={kind:"pinch",distance:Math.hypot(a[1].x-a[0].x,a[1].y-a[0].y),zoom:state.zoom,midX:(a[0].x+a[1].x)/2,midY:(a[0].y+a[1].y)/2,panX:state.panX,panY:state.panY};return}state.gesture={kind:"pa … [line shortened here: 474 characters; full line on GitHub]
canvas.addEventListener("pointermove",e=>{if(!state.pointers.has(e.pointerId)||!state.gesture)return;const p=point(e);state.pointers.set(e.pointerId,p);if(state.pointers.size===2){const a=[...state.pointers.values()],d=Math.hypot(a[1].x-a[0].x,a[1].y-a[0].y),midX=(a[0].x+a[1].x)/2,midY=(a[0].y+a[1].y)/2;state.zoom=Math.max(.35,Math.min(12,state.gesture.zoom*d/Math.max(1,state.gesture.distance)));s … [line shortened here: 761 characters; full line on GitHub]
function endPointer(e){const p=point(e),g=state.gesture;state.pointers.delete(e.pointerId);if(g&&g.kind==="pan"&&!g.moved&&state.last){const wx=state.last.t.wx(p.x),wy=state.last.t.wy(p.y),s=nearest(wx,wy,state.current);if(s){state.selected=s.id;render()}}if(state.pointers.size===0)state.gesture=null}
["pointerup","pointercancel","lostpointercapture"].forEach(n=>canvas.addEventListener(n,endPointer));window.addEventListener("resize",render);render();
})();
</script>
</body></html>Solar Electrical Topology Analysis Engine Text Based — V8 Leapfrog
A JavaScript file that reads inputs (`readInputs`), sets input (`setInputValues`) and groups bands (`groupBands`) (units: Ω, kW), covering leapfrog cable comparison and cables. Served with the page at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v8-leapfrog/.
electricalsolar-electrical-topology-analysis-engine-text-based / v8-leapfrog/app.js · lines 1–445 of 1260 · Entry point · pattern clearError (shared by 2 files)
- What it does
- It draws leapfrog cable comparison and cables. Defines 40 functions or classes, including $, fmt, available, setText, readInputs. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): 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.
- Inputs & outputs
- Out: JSON file v8-leapfrog-cable-comparison.json; downloaded file v8-leapfrog-cable-comparison.json.
- Downstream impact
- Used directly by 2 files: Solar Electrical Topology Analysis Engine Text Based — V8 Leapfrog Page (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v8-leapfrog/); V8 Tests Workflow (solar-electrical-topology-analysis-engine-text-based). Reached from 127 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage V002 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v002.html). It is itself an entry point, published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v8-leapfrog/.
- What it achieves
- It sets text (`setText`), reads inputs (`readInputs`) and sets input (`setInputValues`). Defines `fmt`, `available`, `setText` and 36 more. It responds to click, input and change events.
- Why it matters
- Loaded by the page of the same name at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/v8-leapfrog/. Checked by V8 Tests Workflow.
- Application
- solar-electrical-topology-analysis-engine-text-based · v8-leapfrog · script
- Uses
- none found
- Used by
- loaded by Solar Electrical Topology Analysis Engine Text Based — V8 Leapfrog Page (script src), run by V8 Tests Workflow (workflow run)
- Produces
- $, fmt, available, setText, readInputs, setInputValues, groupBands, renderFeasibilityBanner, renderMetrics, renderLeadScreen, renderBandSchedule, renderStringSchedule
- Defines here
- $, fmt, available, setText, readInputs, setInputValues, groupBands, renderFeasibilityBanner, renderMetrics, renderLeadScreen, renderBandSchedule, renderStringSchedule, renderScenarios
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 v8-leapfrog/app.js:1-445 · blob 7c796bc6748cf14500cc7786248eabdb53db4f0f · 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
(function startV8Application() {
'use strict';
const Model = window.V8LeapfrogModel;
if (!Model) {
throw new Error('V8LeapfrogModel failed to load.');
}
const $ = (id) => document.getElementById(id);
const valueMap = {
modulesPerString: 'modulesPerString',
moduleWidthM: 'moduleWidthM',
alongRowGapM: 'alongRowGapM',
bandGapM: 'bandGapM',
eastBands: 'eastBands',
westBands: 'westBands',
inverterDistanceM: 'inverterDistanceM',
scenarioDistancesM: 'scenarioDistancesM',
polarityConvention: 'polarityConvention',
cableR20MilliOhmPerM: 'cableR20MilliOhmPerM',
cableTemperatureC: 'cableTemperatureC',
stringCurrentA: 'stringCurrentA',
moduleVmpV: 'moduleVmpV',
inverterCount: 'inverterCount',
totalSiteStringCount: 'totalSiteStringCount',
installedCableRatePerM: 'installedCableRatePerM',
positiveFactoryLeadM: 'positiveFactoryLeadM',
negativeFactoryLeadM: 'negativeFactoryLeadM',
measuredLeapfrogSpanM: 'measuredLeapfrogSpanM',
leadEvidence: 'leadEvidence'
};
function fmt(value, decimals = 2) {
if (!Number.isFinite(value)) {
return '—';
}
return value.toLocaleString('en-GB', {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals
});
}
function available(value, suffix, decimals = 2) {
if (value == null || !Number.isFinite(value)) {
return 'UNAVAILABLE';
}
return `${fmt(value, decimals)}${suffix}`;
}
function setText(id, value) {
const element = $(id);
if (element) {
element.textContent = value;
}
}
function readInputs() {
const raw = {};
Object.entries(valueMap).forEach(([key, id]) => {
const element = $(id);
if (element) {
raw[key] = element.value;
}
});
return raw;
}
function setInputValues(values) {
Object.entries(valueMap).forEach(([key, id]) => {
const element = $(id);
const value = values[key];
if (!element || value == null) {
return;
}
element.value = Array.isArray(value)
? value.join(',')
: String(value);
});
}
function groupBands(strings) {
const groups = new Map();
strings.forEach((string) => {
const key = `${string.face}-${string.band}`;
if (!groups.has(key)) {
groups.set(key, []);
}
groups.get(key).push(string);
});
return [...groups.values()];
}
function renderFeasibilityBanner(study) {
const banner = $('feasibilityBanner');
if (!banner) {
return;
}
if (study.feasibility.feasible) {
banner.style.borderColor = '#205838';
banner.style.background = '#062014';
banner.style.color = '#bdf5d4';
banner.innerHTML =
'<strong>LEAPFROG LENGTH SCREEN PASSED</strong>' +
study.feasibility.message;
return;
}
banner.style.borderColor = '#8b3038';
banner.style.background = '#2a0b0f';
banner.style.color = '#ffbec4';
banner.innerHTML =
'<strong>LEAPFROG SAVING NOT AVAILABLE</strong>' +
study.feasibility.message;
}
function renderMetrics(study) {
const totals = study.totals;
const electrical = study.electrical;
setText(
'metricModulePitch',
`${fmt(study.geometry.modulePitchM, 3)} m`
);
setText(
'metricRowSpan',
`${fmt(study.geometry.rowSpanM, 2)} m`
);
setText(
'metricStrings',
String(totals.stringsPerArchetypeInverter)
);
setText(
'metricSiteStrings',
totals.totalSiteStringCount.toLocaleString('en-GB')
);
setText(
'metricAverageStrings',
`${fmt(totals.averageSiteStringsPerInverter, 2)} average/inverter`
);
setText(
'metricSequential',
`${fmt(totals.sequentialExternalMPerArchetypeInverter / 1000, 3)} km`
);
setText(
'metricLeapfrog',
`${fmt(totals.leapfrogExternalMPerArchetypeInverter / 1000, 3)} km theoretical`
);
setText(
'metricSavingInverter',
available(
totals.availableSavingMPerArchetypeInverter == null
? null
: totals.availableSavingMPerArchetypeInverter / 1000,
' km',
3
)
);
setText(
'metricSavingFleet',
available(totals.availableSiteSavingKm, ' km', 1)
);
setText(
'metricResistanceSaving',
available(
electrical.availableResistanceSavingOhmPerString,
' Ω',
4
)
);
setText(
'metricVoltageSaving',
electrical.availableVoltageDropSavingVPerString == null
? 'UNAVAILABLE'
: `${fmt(electrical.availableVoltageDropSavingVPerString, 2)} V · ` +
`${fmt(electrical.voltageDropSavingPercentOfStringVmp, 3)}%`
);
setText(
'metricLossSaving',
available(
totals.availablePowerLossSavingWPerArchetypeInverter == null
? null
: totals.availablePowerLossSavingWPerArchetypeInverter / 1000,
' kW',
3
)
);
setText(
'metricFleetLossSaving',
available(totals.availableSitePowerLossSavingKW, ' kW', 1)
);
const rate = study.input.installedCableRatePerM;
const cost = totals.availableSiteInstalledCostSaving;
setText(
'metricCostSaving',
rate > 0 && cost != null
? `£${fmt(cost, 0)}`
: rate > 0
? 'UNAVAILABLE'
: 'Not priced'
);
setText(
'decompBasePair',
`${fmt(totals.leapfrogExternalMPerArchetypeInverter, 1)} m`
);
setText(
'decompSequentialReturn',
`${fmt(totals.theoreticalSavingMPerArchetypeInverter, 1)} m`
);
setText(
'decompLeapfrogReturn',
study.feasibility.feasible ? '0.0 m' : 'UNAVAILABLE'
);
setText(
'decompSequentialTotal',
`${fmt(totals.sequentialExternalMPerArchetypeInverter, 1)} m`
);
setText(
'decompLeapfrogTotal',
`${fmt(totals.leapfrogExternalMPerArchetypeInverter, 1)} m theoretical`
);
setText(
'decompDifference',
available(totals.availableSavingMPerArchetypeInverter, ' m', 1)
);
}
function renderLeadScreen(study) {
const lead = study.feasibility;
setText(
'leadPositive',
`${fmt(study.input.positiveFactoryLeadM, 3)} m`
);
setText(
'leadNegative',
`${fmt(study.input.negativeFactoryLeadM, 3)} m`
);
setText(
'leadCombined',
`${fmt(lead.availableLeadReachM, 3)} m`
);
setText(
'leadRequired',
`${fmt(lead.requiredReachM, 3)} m`
);
setText('leadBasis', lead.basis);
setText('leadMargin', `${fmt(lead.marginM, 3)} m`);
setText(
'leadExtension',
`${fmt(lead.extensionRequiredM, 3)} m`
);
const status = $('leadStatus');
if (status) {
status.textContent = lead.status;
status.className = lead.feasible ? 'green' : 'red';
}
setText(
'leadMessage',
`${lead.message} Evidence: ${lead.evidence}.`
);
}
function renderBandSchedule(study) {
const body = $('bandSchedule');
const foot = $('bandScheduleFoot');
if (!body) {
return;
}
body.innerHTML = groupBands(study.strings)
.map((group) => {
const first = group[0];
const count = group.length;
const sequentialTotal = group.reduce(
(sum, string) => sum + string.sequential.totalExternalM,
0
);
const leapfrogTotal = group.reduce(
(sum, string) => sum + string.leapfrog.totalExternalM,
0
);
const theoreticalDifference =
count * study.geometry.rowSpanM;
const availableDifference = study.feasibility.feasible
? theoreticalDifference
: null;
return `
<tr>
<td>${first.face}</td>
<td>${first.band}</td>
<td>${count}</td>
<td>${fmt(first.nearRouteM, 2)}</td>
<td>${fmt(first.sequential.positiveM, 2)}</td>
<td>${fmt(first.sequential.negativeM, 2)}</td>
<td>${fmt(sequentialTotal, 2)}</td>
<td>${fmt(first.leapfrog.positiveM, 2)}</td>
<td>${fmt(first.leapfrog.negativeM, 2)}</td>
<td>${fmt(leapfrogTotal, 2)}</td>
<td class="warning-cell">
${fmt(theoreticalDifference, 2)}
</td>
<td class="good-cell">
${available(availableDifference, '', 2)}
</td>
</tr>
`;
})
.join('');
if (foot) {
foot.innerHTML = `
<tr>
<th colspan="6">Per archetype inverter</th>
<td>
${fmt(
study.totals.sequentialExternalMPerArchetypeInverter,
2
)}
</td>
<td colspan="2"></td>
<td>
${fmt(
study.totals.leapfrogExternalMPerArchetypeInverter,
2
)}
</td>
<td class="warning-cell">
${fmt(
study.totals.theoreticalSavingMPerArchetypeInverter,
2
)}
</td>
<td class="good-cell">
${available(
study.totals.availableSavingMPerArchetypeInverter,
'',
2
)}
</td>
</tr>
`;
}
}
function renderStringSchedule(study) {
const body = $('stringSchedule');
if (!body) {
return;
}
body.innerHTML = study.strings
.map((string) => `
<tr>
<td>${string.number}</td>
<td>${string.positiveId} / ${string.negativeId}</td>
<td>${string.face}</td>
<td>${string.band}</td>
<td>${fmt(string.nearRouteM, 2)}</td>
<td>${fmt(string.sequential.positiveM, 2)}</td>
<td>${fmt(string.sequential.negativeM, 2)}</td>
<td>${fmt(string.leapfrog.positiveM, 2)}</td>
<td>${fmt(string.leapfrog.negativeM, 2)}</td>
<td class="warning-cell">
${fmt(string.saving.theoreticalExternalCableM, 2)}
</td>
<td class="good-cell">
${available(
string.saving.availableExternalCableM,
'',
2
)}
</td>
<td>
${available(
string.saving.availableResistanceOhmPerString,
'',
4
)}
</td>
<td>
${available(
string.saving.availableVoltageDropVPerString,
'',
2
)}
</td>
<td>
${available(
string.saving.availablePowerLossWPerString,
'',
1
)}
</td>
</tr>
`)
.join('');
}
function renderScenarios(raw) {
const body = $('scenarioSchedule');
if (!body) {
return;
}
body.innerHTML = Model.scenarioStudies(raw)
.map((scenario) => `
<tr>
<td>${fmt(scenario.distanceM, 1)}</td>
<td>
${fmt(scenario.basePairMPerArchetypeInverter, 1)}
</td>
<td>
${fmt(
scenario.sequentialExternalMPerArchetypeInverter,
1
)}
</td>
<td>
${fmt(
scenario.leapfrogExternalMPerArchetypeInverter,