In this section
- Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox interaction · solar-electrical-topology-analysis-engine-text-based / b9-sandbox/app.js lines 433–581
- Cartridges transform · solar-electrical-topology-analysis-engine-text-based / b9-sandbox/cartridges.js lines 1–71
- Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox Page render · solar-electrical-topology-analysis-engine-text-based / b9-sandbox/index.html lines 1–223
Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox
A JavaScript module that draws b9 scene. Served with the page at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/. It adds text (`addText`), syncs orientation cartridge (`syncOrientationFromCartridge`) and draws module (`drawModule`).
interactionsolar-electrical-topology-analysis-engine-text-based / b9-sandbox/app.js · lines 433–581 of 581 (continued from section 199) · Entry point · pattern downloadJson (shared by 2 files)
- What it does
- It draws b9 scene. Defines 26 functions or classes, including byId, numberValue, integerValue, textValue, svgElement. 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.
- Inputs & outputs
- In: JSON file b9-scene.json; GeoJSON file b9-scene.geojson.
- Downstream impact
- Used directly by 1 file: Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox Page (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/). Reached from 1 other entry point, including Tests (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/tests.html). It is itself an entry point, published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/.
- What it achieves
- Defines `byId`, `numberValue`, `integerValue` and 23 more. It responds to input, change and click events.
- Why it matters
- Loaded by the page of the same name at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/.
- Application
- solar-electrical-topology-analysis-engine-text-based · b9-sandbox · JavaScript module
- Uses
- Cartridges (import), Model (import)
- Used by
- loaded by Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox Page (script src)
- Produces
- byId, numberValue, integerValue, textValue, svgElement, addText, clearSvg, inputModel, syncOrientationFromCartridge, rebuild, terminalPosition, drawModule
- Defines here
- renderSide, renderStage, setText, renderSummary, render, downloadJson, populateCartridges, installEvents
- 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 b9-sandbox/app.js:433-581 · blob 5ee07f57ff726321d90e73c503d667e9624945b1 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
d: `M 40 ${groundY} L 1200 ${groundY}`,
class: "ground-line",
}));
svg.appendChild(svgElement("path", {
d: `M ${axisX} ${groundY} L ${axisX} ${axisY}`,
class: "structure-line",
}));
svg.appendChild(svgElement("path", {
d: `M ${axisX - dx} ${axisY + dy} L ${axisX + dx} ${axisY - dy}`,
class: "structure-line",
}));
svg.appendChild(svgElement("circle", {
cx: axisX,
cy: axisY,
r: 8,
class: "terminal-pos",
}));
addText(svg, axisX + 16, axisY - 12, `${scene.geometry.trackerAngleDeg}°`);
}
function renderSide(svg) {
const scene = state.scene;
svg.setAttribute("viewBox", "0 0 1240 620");
addText(svg, 36, 38, "SIDE VIEW", "view-title");
addText(svg, 36, 64, scene.cartridge.name);
if (scene.cartridge.tracker) {
renderTrackerSide(svg, scene);
} else if (scene.cartridge.eastWest) {
renderEastWestSide(svg, scene);
} else {
renderFixedSide(svg, scene);
}
}
function renderStage() {
const svg = byId("stage");
clearSvg(svg);
if (state.view === "plan") {
renderPlan(svg);
} else if (state.view === "side") {
renderSide(svg);
} else {
renderCircuit(svg);
}
}
function setText(id, value, className = "") {
const element = byId(id);
element.textContent = value;
element.className = className;
}
function renderSummary() {
const scene = state.scene;
const summary = state.summary;
setText("summaryCartridge", scene.cartridge.name);
setText("summaryOrientation", scene.module.orientation);
setText("summaryModules", summary.moduleCount.toLocaleString("en-GB"));
setText("summaryStrings", summary.stringCount.toLocaleString("en-GB"));
setText("summaryRowSpan", `${summary.rowSpanM.toFixed(2)} m`);
setText("summaryTopology", scene.electrical.topology);
setText("summaryFreeNegative", summary.freeNegative);
setText("summaryFreePositive", summary.freePositive);
setText("summaryConnections", summary.connectionCount.toLocaleString("en-GB"));
setText("summaryExternal", `${summary.externalCableM.toFixed(2)} m`);
setText("summaryFactory", `${summary.factoryLeadM.toFixed(2)} m`);
setText(
"summaryCopper",
`${summary.totalCommercialCopperKg.toFixed(2)} kg`,
);
const feasibilityClass = scene.feasibility.passes ? "pass" : "fail";
const feasibilityText = scene.feasibility.passes
? `PASS · ${scene.feasibility.availableReachM.toFixed(3)} m available`
: `FAIL · ${scene.feasibility.shortfallM.toFixed(3)} m short`;
setText("summaryFeasibility", feasibilityText, feasibilityClass);
const warningList = byId("warningList");
warningList.replaceChildren();
const warnings = scene.warnings.length
? scene.warnings
: ["No blocking geometry or topology warnings in this first-pass screen."];
warnings.forEach((warning) => {
const item = document.createElement("li");
item.textContent = warning;
warningList.appendChild(item);
});
}
function render() {
renderStage();
renderSummary();
document.querySelectorAll("[data-view]").forEach((button) => {
button.classList.toggle("active", button.dataset.view === state.view);
});
}
function downloadJson(filename, payload) {
const blob = new Blob([JSON.stringify(payload, null, 2)], {
type: "application/json",
});
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
URL.revokeObjectURL(link.href);
}
function populateCartridges() {
const select = byId("cartridge");
CARTRIDGES.forEach((cartridge) => {
const option = document.createElement("option");
option.value = cartridge.id;
option.textContent = cartridge.name;
select.appendChild(option);
});
}
function installEvents() {
document.querySelectorAll("input, select, textarea").forEach((control) => {
control.addEventListener("input", rebuild);
control.addEventListener("change", rebuild);
});
document.querySelectorAll("[data-view]").forEach((button) => {
button.addEventListener("click", () => {
state.view = button.dataset.view;
render();
});
});
byId("exportScene").addEventListener("click", () => {
downloadJson("b9-scene.json", state.scene);
});
byId("exportGeoJson").addEventListener("click", () => {
downloadJson("b9-scene.geojson", toGeoJson(state.scene));
});
byId("resetScene").addEventListener("click", () => {
window.location.reload();
});
}
populateCartridges();
installEvents();
rebuild();Cartridges
A JavaScript module in Solar Electrical Topology Analysis Engine Text Based. Served with the page at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/. It gets cartridge (`getCartridge`).
transformsolar-electrical-topology-analysis-engine-text-based / b9-sandbox/cartridges.js · lines 1–71 of 71
- What it does
- It calculates its inputs. Defines getCartridge.
- 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 2 files: Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/); Tests (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/). Reached from 2 other entry points, including Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox Page (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/); Tests (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/tests.html).
- What it achieves
- Defines `getCartridge`.
- Why it matters
- Imported by Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox. Checked by Tests.
- Application
- solar-electrical-topology-analysis-engine-text-based · b9-sandbox · JavaScript module
- Uses
- none found
- Used by
- imported by Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox (import), imported by Tests (import)
- Produces
- CARTRIDGES, getCartridge
- Defines here
- getCartridge
- 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 b9-sandbox/cartridges.js:1-71 · blob 78855cb48fcaa3202d29786954fc6c991b9d501f · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: production_core
export const CARTRIDGES = [
{
id: "fixed-1p",
name: "Fixed tilt · 1 in portrait",
version: "0.1.0",
faces: 1,
modulesHigh: 1,
tracker: false,
eastWest: false,
},
{
id: "fixed-2p",
name: "Fixed tilt · 2 in portrait",
version: "0.1.0",
faces: 1,
modulesHigh: 2,
tracker: false,
eastWest: false,
},
{
id: "east-west-1p",
name: "East-west · 1 in portrait per face",
version: "0.1.0",
faces: 2,
modulesHigh: 1,
tracker: false,
eastWest: true,
},
{
id: "east-west-5p",
name: "East-west · 5 in portrait per face",
version: "0.1.0",
faces: 2,
modulesHigh: 5,
tracker: false,
eastWest: true,
},
{
id: "legacy-6l",
name: "Legacy fixed tilt · 6 in landscape",
version: "0.1.0",
faces: 1,
modulesHigh: 6,
tracker: false,
eastWest: false,
orientation: "landscape",
},
{
id: "tracker-1p",
name: "Tracker · 1 in portrait",
version: "0.1.0",
faces: 1,
modulesHigh: 1,
tracker: true,
eastWest: false,
},
{
id: "tracker-2p",
name: "Tracker · 2 in portrait",
version: "0.1.0",
faces: 1,
modulesHigh: 2,
tracker: true,
eastWest: false,
},
];
export function getCartridge(id) {
return CARTRIDGES.find((cartridge) => cartridge.id === id)
?? CARTRIDGES[0];
}Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox Page
A web page that draws SVG graphics and reads inputs for cartridge, orientation and module width (units: mm²). Published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/.
rendersolar-electrical-topology-analysis-engine-text-based / b9-sandbox/index.html · lines 1–223 of 223 · Entry point
- What it does
- It draws cables. 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: cables.
- Inputs & outputs
- In: DuckDB queries; form fields (user input). Out: web page; SVG drawing.
- Downstream impact
- Used directly by 1 file: Tests (solar-electrical-topology-analysis-engine-text-based, https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/tests.html). It is itself an entry point, published at https://ventusltd.github.io/solar-electrical-topology-analysis-engine-text-based/b9-sandbox/.
- What it achieves
- Generic PV array geometry and circuit authoring sandbox.
- Why it matters
- Checked by Tests.
- Application
- solar-electrical-topology-analysis-engine-text-based · b9-sandbox · page
- Uses
- Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox Style Sheet (stylesheet), Solar Electrical Topology Analysis Engine Text Based — B9 Sandbox (script src)
- Used by
- linked from Tests (link)
- 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
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 b9-sandbox/index.html:1-223 · blob 17f35b6ece5f96c9f0306bc15dca1850b55fc102 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>B9 Multi-Array Electrical Sandbox</title>
<meta
name="description"
content="Generic PV array geometry and circuit authoring sandbox."
>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<main class="app-shell">
<aside class="sidebar">
<header class="brand">
<small>GlobalGrid2050 · B9 development</small>
<h1>Multi-Array Electrical Sandbox</h1>
<p>
First working slice. Build generic module arrangements, select an
electrical cartridge and inspect plan, side and circuit views.
</p>
</header>
<section class="panel">
<h2>Mechanical cartridge</h2>
<div class="field full">
<label for="cartridge">Array arrangement</label>
<select id="cartridge"></select>
</div>
<div class="field">
<label for="orientation">Module orientation</label>
<select id="orientation">
<option value="portrait">Portrait</option>
<option value="landscape">Landscape</option>
</select>
</div>
<div class="field">
<label for="moduleWidth">Module width (m)</label>
<input id="moduleWidth" type="number" value="1.303" step="0.001">
</div>
<div class="field">
<label for="moduleHeight">Module height (m)</label>
<input id="moduleHeight" type="number" value="2.384" step="0.001">
</div>
<div class="field">
<label for="moduleGap">Along-row gap (m)</label>
<input id="moduleGap" type="number" value="0" step="0.001">
</div>
</section>
<section class="panel">
<h2>String and terminals</h2>
<div class="field">
<label for="modulesPerString">Modules per string</label>
<input id="modulesPerString" type="number" value="30" min="1">
</div>
<div class="field">
<label for="stringCount">Parallel strings</label>
<input id="stringCount" type="number" value="24" min="1">
</div>
<div class="field">
<label for="topology">Electrical cartridge</label>
<select id="topology">
<option value="sequential">Sequential</option>
<option value="leapfrog" selected>Leapfrog</option>
<option value="mirrored-sequential">Mirrored sequential</option>
<option value="alternating-return">Alternating return</option>
<option value="custom">Custom order</option>
</select>
</div>
<div class="field full">
<label for="customOrder">Custom module order</label>
<textarea
id="customOrder"
placeholder="1,3,5,...,29,30,28,...,4,2"
></textarea>
</div>
<div class="field">
<label for="junctionBoxMode">Junction boxes</label>
<select id="junctionBoxMode">
<option value="split">Split positive / negative</option>
<option value="central">Single central box</option>
</select>
</div>
<div class="field">
<label for="positiveLead">Positive lead (m)</label>
<input id="positiveLead" type="number" value="1.4" step="0.01">
</div>
<div class="field">
<label for="negativeLead">Negative lead (m)</label>
<input id="negativeLead" type="number" value="1.4" step="0.01">
</div>
</section>
<section class="panel">
<h2>Table and route geometry</h2>
<div class="field">
<label for="lowEdge">Low edge (m)</label>
<input id="lowEdge" type="number" value="1" step="0.1">
</div>
<div class="field">
<label for="highEdge">High edge / axis (m)</label>
<input id="highEdge" type="number" value="4" step="0.1">
</div>
<div class="field">
<label for="ridgeGap">Ridge gap (m)</label>
<input id="ridgeGap" type="number" value="0.3" step="0.05">
</div>
<div class="field">
<label for="rowPitch">String row pitch (m)</label>
<input id="rowPitch" type="number" value="3" step="0.1">
</div>
<div class="field">
<label for="trackerAngle">Tracker angle (°)</label>
<input id="trackerAngle" type="number" value="0" step="1">
</div>
<div class="field">
<label for="inverterDistance">Inverter distance (m)</label>
<input id="inverterDistance" type="number" value="10" step="1">
</div>
</section>
<section class="panel">
<h2>Conductor basis</h2>
<div class="field">
<label for="externalCableCsa">External cable CSA (mm²)</label>
<input id="externalCableCsa" type="number" value="6" step="1">
</div>
<div class="field">
<label for="factoryLeadCsa">Factory lead CSA (mm²)</label>
<input id="factoryLeadCsa" type="number" value="4" step="1">
</div>
<p class="help">
Commercial copper uses CSA × km × 9.6. Electrical resistance and
inductance are deliberately outside this first drawing slice.
</p>
</section>
</aside>
<section class="workspace">
<nav class="toolbar" aria-label="Drawing views">
<button class="active" data-view="plan">Plan view</button>
<button data-view="side">Side view</button>
<button data-view="circuit">Circuit view</button>
</nav>
<div class="stage-wrap">
<svg
id="stage"
role="img"
aria-label="PV array geometry and electrical circuit drawing"
></svg>
<div class="legend">
Blue terminal = negative · Red terminal = positive · Orange = inverter
</div>
</div>
</section>
<aside class="inspector">
<section class="panel">
<h2>Technician summary</h2>
<dl class="summary-grid">
<dt>Cartridge</dt><dd id="summaryCartridge">—</dd>
<dt>Orientation</dt><dd id="summaryOrientation">—</dd>
<dt>Modules</dt><dd id="summaryModules">—</dd>
<dt>Strings</dt><dd id="summaryStrings">—</dd>
<dt>Row span</dt><dd id="summaryRowSpan">—</dd>
<dt>Topology</dt><dd id="summaryTopology">—</dd>
<dt>Free negative</dt><dd id="summaryFreeNegative">—</dd>
<dt>Free positive</dt><dd id="summaryFreePositive">—</dd>
<dt>Connections</dt><dd id="summaryConnections">—</dd>
<dt>Lead feasibility</dt><dd id="summaryFeasibility">—</dd>
</dl>
</section>
<section class="panel">
<h2>Cable and copper screen</h2>
<dl class="summary-grid">
<dt>External cable</dt><dd id="summaryExternal">—</dd>
<dt>Factory leads</dt><dd id="summaryFactory">—</dd>
<dt>Commercial Cu</dt><dd id="summaryCopper">—</dd>
</dl>
<p class="status-note">
Factory leads remain in circuit under every topology. The external
cable screen changes only the routed home-run consequence.
</p>
</section>
<section class="panel">
<h2>Warnings</h2>
<ul id="warningList" class="warning-list"></ul>
</section>
<section class="panel">
<h2>Export</h2>
<div class="actions">
<button id="exportScene" class="primary">Scene JSON</button>
<button id="exportGeoJson">GeoJSON</button>
<button id="resetScene">Reset</button>
<button disabled>Parquet later</button>
</div>
<p class="status-note">
Scene JSON is the browser interchange format. Parquet and DuckDB
remain the later analytical build path.
</p>
</section>
<section class="panel">
<h2>Current boundary</h2>
<p class="status-note">
This release proves shared IDs, cartridges, exact module dimensions,
fixed physical module positions, side elevation, typed electrical
order, lead reach and generic exports. It does not yet issue a design
approval or calculate R, L, C, G, propagation or protection settings.
</p>
</section>
</aside>
</main>
<script type="module" src="./app.js"></script>
</body>
</html>