In this section
- Ventus Programs render · globalgrid2050 / ventus/wiring/VENTUS-programs.js lines 3501–4071
- Ventus — Wiring Page render · globalgrid2050 / ventus/wiring/index.html lines 1–1
- Public Start render · globalgrid2050 / ventus/wiring/public-start.js lines 1–20
Ventus Programs
A JavaScript module in the wiring folder of GlobalGrid2050 covering cables, using IEC 62446-1 and SHA-256 and uses data from the faraday repository. Served with the page at https://globalgrid2050.com/ventus/wiring/.
Set aside from the main view: 99% of its lines are the same as kuiper-grid/drawing/kuiper-programs.js (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 98% of lines shared with Kuiper Programs; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9857 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 kuiper-grid/drawing/kuiper-programs.js:1-4071 1702c188389e3667e255bb51ecb3b75e61fe14a0
- sha256 d35bfcc0f8c5123a7094952d5499f8c9bede5e38e257c9f1bcac8b21bff12746
- target sha256 b62e9418bc019fbd2c39144827ac5bf415cb0b57d8ced8cd973d196e0e20144b
- group of 8 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
renderglobalgrid2050 / ventus/wiring/VENTUS-programs.js · lines 3501–4071 of 4071 (continued from section 1984) · Entry point · pattern setMin (shared by 4 files)
- What it does
- It draws cables, solar, substations and transformers. Defines 208 functions or classes, including reFire, closestPair, blackSky, nameInLines, makeBody. Side effects: changes the web page (DOM); reads or writes files; makes network requests.
- Why it exists in the grid workflow
- Domain terms in the code: cables, solar, substations, transformers, 400kV, 1500V.
- Inputs & outputs
- In: data source: faraday data; JSON file current.json. Out: canvas drawing. Voltage levels named: 400kV, 1500V.
- Downstream impact
- Used directly by 1 file: Renderer (globalgrid2050, https://globalgrid2050.com/ventus/wiring/renderer.html). It is itself an entry point, published at https://globalgrid2050.com/ventus/wiring/.
- What it achieves
- It makes body (`makeBody`), sets tag (`setTag`) and merges menu (`mergeMenu`). A cartridge of the VENTUS shell. Its code works with 352 kVA, 295 kVA and 320 kVA. It responds to click, keydown and pointerdown events.
- Why it matters
- Loaded by the Renderer page at https://globalgrid2050.com/ventus/wiring/renderer.html.
- Application
- globalgrid2050 · ventus/wiring · JavaScript module
- Uses
- Faraday — Index Page (estate URL), Wafer Development Environment — Proof S0004 Page (estate URL), ./fire.js
- Used by
- loaded by Renderer (script src)
- Produces
- reFire, closestPair, blackSky, nameInLines, makeBody, bodyTo, labels, bodyJump, bodyMove, bodyDrawnDiameter, bodyDotPx, sheet
- Defines here
- put2, shapeAsk, shapeTrack, netPieces, line, ring, sym, netFinal, bad, net, pieces, line, ring, final, shown, guard
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 ventus/wiring/VENTUS-programs.js:3501-4071 · blob 49a83f035d592db467fba5cef59779d0f2c2f0e1 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network · domain stage: unknown · users: none · canonical: production_core
// its own dark ground and never against a grid line. Still a line, not a tube.
path(seg); ctx.lineWidth = core + 3.0; ctx.strokeStyle = casing; ctx.stroke();
path(seg); ctx.lineWidth = core; ctx.strokeStyle = ink; ctx.stroke();
if (!s.plus && !s.open) { path(seg); ctx.lineWidth = Math.max(0.6, core * 0.4);
ctx.strokeStyle = SHEET ? '#20262f' : '#14181f'; ctx.stroke(); } }
continue; }
const core = s.plus ? SHAPE_RED : SHAPE_BLACK;
const rim = lit ? '#eaf6ff' : s.open ? SHAPE_WARN : (s.plus ? (fused ? '#933428' : '#552722') : (fused ? '#a3b4c9' : SHAPE_EDGE));
const grow = lit ? 1.7 : 1.0;
path(s.pts); ctx.lineWidth = w + grow; ctx.strokeStyle = rim; ctx.stroke();
path(s.pts); ctx.lineWidth = w; ctx.strokeStyle = fused ? core : dimColour(core, 0.62); ctx.stroke(); }
// 3b. THE NEON HEAD, on the conductors that were actually drawn. The walk is not invented here: every
// conductor already carries the two terminals it joins, so the chain is followed from INV- by
// name - home run, lead, mate, lead, and box to box across each module - to INV+. If the chain
// breaks anywhere, or any lead is open, there is no walk and NOTHING lights: an open string
// carries no current, and a neon running over a break would be a lie. Speed is steady (the head
// is the sldTick clock); WEIGHT is the current, never the colour.
if (D.head >= 0 && !D.open) {
if (D.walk === null || D.walk === undefined) D.walk = buildStringWalk(D);
const W = D.walk;
if (W) {
const hl = 0.055, h1 = D.head, spans = h1 - hl < 0 ? [[0, h1], [1 + h1 - hl, 1]] : [[h1 - hl, h1]];
const amps = 1 + 0.5 * Math.min(1, (D.amps || 0) / 20);
ctx.save(); ctx.globalCompositeOperation = 'lighter'; ctx.shadowColor = '#7ff0ff';
for (const L of W.legs) for (const [a0, a1] of spans) {
const a = Math.max(L.u0, a0), b = Math.min(L.u1, a1);
if (b <= a) continue;
if (L.s) { const d = Math.max(1e-9, L.u1 - L.u0);
const seg = polySlice(L.s.pts, (a - L.u0) / d, (b - L.u0) / d);
if (seg.length < 2 || !onScreen(seg)) continue;
const wN = Math.max(2.2, (D.wiring ? Math.max(1.5, Math.min(3.2, perM * 0.022)) : fine * (L.s.weight || 1)) * 1.1) * amps;
ctx.shadowBlur = wN * 2.6;
path(seg); ctx.lineWidth = wN * 2.1; ctx.strokeStyle = 'rgba(86,214,255,0.22)'; ctx.stroke();
path(seg); ctx.lineWidth = wN; ctx.strokeStyle = 'rgba(224,250,255,0.92)'; ctx.stroke(); }
else if (L.mod && onScreen(L.mod.pts)) { // box to box THROUGH the module: its own outline lights
ctx.shadowBlur = 7 * amps;
path(L.mod.pts); ctx.closePath(); ctx.lineWidth = Math.max(1.4, fine * 1.2) * amps;
ctx.strokeStyle = 'rgba(120,232,255,0.55)'; ctx.stroke(); } }
ctx.restore(); ctx.shadowBlur = 0; }
}
// 3. THE GAP, and what it is short by, said in metres
for (const s of D.shapes) { if (s.role !== 'gap' || !onScreen(s.pts) || true) continue;
const a = S(s.pts[0]), b = S(s.pts[1]);
ctx.setLineDash([2.5, 3.5]); ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]);
ctx.lineWidth = hair; ctx.strokeStyle = SHAPE_WARN; ctx.stroke(); ctx.setLineDash([]);
for (const p of [a, b]) { ctx.beginPath(); ctx.arc(p[0], p[1], 1.9, 0, 6.2832); ctx.fillStyle = SHAPE_WARN; ctx.fill(); }
// WHAT IT IS SHORT BY, only when there is room for it to be read and never over a module's name.
if (false) {
} }
// 5. THE BOXES AND WHAT SITS ON THEM, over the cable ends, so a cable is seen to enter its box.
for (const s of D.shapes) {
if (s.role === 'box') { if (!onScreen(s.pts)) continue;
// A BOX TOO SMALL TO BE A BOX IS A DOT, NOT A SMALLER BOX. Under six pixels across, a rectangle
// with an outline and a fill is three grey pixels that say nothing; what a reader wants at that
// distance is only WHERE the boxes are, so one dot is drawn and the box itself is dropped. This is
// the macro rule and it is crossed by zooming, not by the word: pinch in and the dots become boxes
// at the same threshold either way.
{ const aa = S(s.pts[0]), bb2 = S(s.pts[2]);
const bpx = Math.min(Math.abs(bb2[0] - aa[0]), Math.abs(bb2[1] - aa[1]));
if (bpx < 6) { const cx2 = (aa[0] + bb2[0]) / 2, cy2 = (aa[1] + bb2[1]) / 2;
ctx.beginPath(); ctx.arc(Math.round(cx2), Math.round(cy2), 1.3, 0, 6.2832);
ctx.fillStyle = SHEET ? '#55606e' : SHAPE_PENCIL; ctx.fill(); continue; } }
path(s.pts); ctx.closePath(); ctx.fillStyle = BOXFILL; ctx.fill();
ctx.lineWidth = fine; ctx.strokeStyle = INK; ctx.stroke();
// THE MIDDLE BOX HAS NO CABLE: it carries a bypass diode, and it is drawn as one so that nobody
// takes it for a third connection.
// EACH OF THE THREE BOXES HOLDS ONE BYPASS DIODE, one per cell string. The two outer boxes carry a
// smaller mark of the same symbol, kept clear of the box edge where the lead lands.
if (s.diodeOnly || s.diode) { const a = S(s.pts[0]), b = S(s.pts[2]);
const cxm = (a[0] + b[0]) / 2, cym = (a[1] + b[1]) / 2, r2 = Math.min(Math.abs(b[0] - a[0]), Math.abs(b[1] - a[1])) * (s.diodeOnly ? 0.30 : 0.22);
if (r2 > 2) { ctx.beginPath(); ctx.moveTo(cxm - r2, cym - r2); ctx.lineTo(cxm - r2, cym + r2); ctx.lineTo(cxm + r2, cym);
ctx.closePath(); ctx.lineWidth = Math.max(0.8, fine * 0.6); ctx.strokeStyle = EDGE2; ctx.stroke();
ctx.beginPath(); ctx.moveTo(cxm + r2, cym - r2); ctx.lineTo(cxm + r2, cym + r2); ctx.stroke(); } }
continue; }
if (s.role === 'terminal' && s.pts.length > 1) { if (!onScreen(s.pts)) continue;
path(s.pts); ctx.lineWidth = fine; ctx.strokeStyle = INK; ctx.stroke(); continue; }
if (s.role === 'tube') { if (!onScreen(s.pts)) continue;
path(s.pts); ctx.lineWidth = hair; ctx.strokeStyle = EDGE2; ctx.stroke(); continue; }
if (s.role === 'landing' && false) { const q = S(s.pts[0]);
if (q[0] < -20 || q[0] > innerWidth + 20 || q[1] < -20 || q[1] > innerHeight + 20) continue;
// THE DOT ON THE BOX where the cable lands. Small, but it is the difference between a cable that
// joins a box and a line that happens to pass near one.
const r2 = Math.max(1.6, Math.min(4, perM * 0.018));
ctx.beginPath(); ctx.arc(q[0], q[1], r2, 0, 6.2832);
ctx.fillStyle = s.plus ? (SHEET ? '#c0271a' : SHAPE_RED) : (SHEET ? '#20262f' : '#cfe0ee'); ctx.fill(); continue; }
if (s.role === 'plug') { const q = S(s.pts[0]);
if (q[0] < -20 || q[0] > innerWidth + 20 || q[1] < -20 || q[1] > innerHeight + 20) continue;
// A CONNECTOR IS AN OBJECT, and the two halves are different objects: a plug is a barrel with a
// collar, a socket is a sleeve with two latches. Facing each other across a gap, they say what is
// wrong better than any words: these two were meant to meet and they do not.
const a2 = s.along || [1, 0], L2 = Math.max(1e-6, Math.hypot(a2[0], a2[1]));
const ux = a2[0] / L2, uy = a2[1] / L2, nx = -uy, ny = ux;
const len = Math.max(7, Math.min(26, perM * 0.16)), rad = len * 0.30;
const put2 = (px2, py2) => [q[0] + ux * px2 + nx * py2, q[1] + uy * px2 + ny * py2];
ctx.lineWidth = Math.max(0.8, fine * 0.7); ctx.strokeStyle = INK; ctx.fillStyle = SHEET ? '#f3f5f8' : '#10151d';
ctx.beginPath();
if (s.male) { const a = put2(0, -rad), b = put2(len * 0.75, -rad * 0.55), c2 = put2(len * 0.75, rad * 0.55), d2 = put2(0, rad);
ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.lineTo(c2[0], c2[1]); ctx.lineTo(d2[0], d2[1]); ctx.closePath(); }
else { const a = put2(0, -rad), b = put2(-len * 0.8, -rad), c2 = put2(-len * 0.8, rad), d2 = put2(0, rad);
ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.lineTo(c2[0], c2[1]); ctx.lineTo(d2[0], d2[1]); ctx.closePath(); }
ctx.fill(); ctx.stroke();
{ const e = s.male ? put2(len * 0.3, 0) : put2(-len * 0.45, 0), f = s.male ? put2(len * 0.3, 0) : put2(-len * 0.45, 0);
ctx.beginPath(); ctx.moveTo(e[0] + nx * rad, e[1] + ny * rad); ctx.lineTo(f[0] - nx * rad, f[1] - ny * rad);
ctx.lineWidth = Math.max(0.8, fine * 0.5); ctx.strokeStyle = SHAPE_EDGE; ctx.stroke(); }
continue; }
if (s.role === 'mate') { const q = S(s.pts[0]);
if (q[0] < -20 || q[0] > innerWidth + 20 || q[1] < -20 || q[1] > innerHeight + 20) continue;
// WHERE RED BECOMES BLACK: the mated pair, as a small lozenge across the cable, so a reader can
// see that two leads meet here rather than one cable changing its mind about its colour.
const a2 = s.along || [1, 0], L2 = Math.max(1e-6, Math.hypot(a2[0], a2[1]));
const ux = a2[0] / L2, uy = -a2[1] / L2, r2 = Math.max(2.6, Math.min(7, perM * 0.035)), r3 = r2 * 0.5;
ctx.beginPath();
ctx.moveTo(q[0] + ux * r2, q[1] + uy * r2); ctx.lineTo(q[0] - uy * r3, q[1] + ux * r3);
ctx.lineTo(q[0] - ux * r2, q[1] - uy * r2); ctx.lineTo(q[0] + uy * r3, q[1] - ux * r3);
ctx.closePath(); ctx.fillStyle = SHEET ? '#f3f5f8' : '#0a0d13'; ctx.fill();
ctx.lineWidth = Math.max(0.8, fine * 0.8); ctx.strokeStyle = INK; ctx.stroke(); continue; }
if (s.role === 'slack') { if (!onScreen(s.pts)) continue;
path(s.pts); ctx.lineWidth = fine + 0.9; ctx.strokeStyle = SHAPE_EDGE; ctx.stroke();
path(s.pts); ctx.lineWidth = fine; ctx.strokeStyle = SHAPE_BLACK; ctx.stroke(); continue; }
if (s.role === 'joint' && perM > 18) { const p = S(s.pts[0]);
if (p[0] < -20 || p[0] > innerWidth + 20) continue;
ctx.beginPath(); ctx.arc(p[0], p[1], 1.7, 0, 6.2832); ctx.fillStyle = '#0a0d13'; ctx.fill();
ctx.lineWidth = hair; ctx.strokeStyle = SHAPE_INK; ctx.stroke(); } }
// 5. THE MARKS: - and + beside every box and terminal, and the module's name under it, on whole pixels
// WORDS ARE DROPPED, NEVER OVERcableED. The polarity marks and the module names go down first, then
// the numbers on the links, nearest the near end first; anything that would land on something already
// written is simply not written. A crowded drawing loses labels; it never turns into a smear.
ctx.textBaseline = 'middle';
const placed = [];
const order2 = D.marks.map((m, i) => [m, i]).sort((a, b) => ((a[0].rank || 0) - (b[0].rank || 0)) || (a[0].x - b[0].x));
// NO WORD IS EVER SHRUNK. Nine pixels is the floor for a word on this drawing: under it the word is
// not written at all. The MACRO words - M1, M10, M20, M30 and the inverter - are the only ones
// written when the whole string is on the screen, and they fade out as the near names fade in, so
// pinching from one view to the other is a change of what is worth saying and not a flicker.
const MACRO_OFF = 46;
// A WORD IS PAINTED IN THE GLASS'S OWN PIXELS. The rest of the drawing is laid out in css px on a
// layer scaled by the device ratio, which is right for a line: a hairline stays a hairline. A word is
// not a line. A word has one true size - the size it arrives at the eye - and that size is counted in
// the pixels the panel actually has. So for the marks alone the layer's scale is dropped, the word is
// asked for at its css size times the device ratio, and it lands where it would have landed anyway.
// The floor is then the floor the reader sees: NINE CSS PIXELS, in this one place, and under it the
// word is not written at all. Dropped, never shrunk - a word too small to read is worse than none.
const TEXT_FLOOR_PX = 9;
ctx.setTransform(1, 0, 0, 1, 0, 0);
for (const [m] of order2) {
const sizeCss = m.size || 11;
if (sizeCss < TEXT_FLOOR_PX) continue;
if (m.macro) { if (perM > MACRO_OFF) continue; }
else if (perM < (m.minPx || 0)) continue;
const p = S([m.x, m.y]); if (p[0] < -40 || p[0] > innerWidth + 40 || p[1] < -20 || p[1] > innerHeight + 20) continue;
ctx.globalAlpha = m.macro ? Math.max(0, Math.min(1, (MACRO_OFF - perM) / 12)) : 1;
ctx.font = '600 ' + (sizeCss * dpr) + 'px ui-monospace,Menlo,Consolas,monospace';
const px = Math.round(p[0] * dpr), py = Math.round(p[1] * dpr);
const w2 = ctx.measureText(m.text).width, h2 = (sizeCss + 3) * dpr;
const x0 = px - (m.mid ? w2 / 2 : 0), y0 = py - h2 / 2;
const box2 = [x0 - dpr, y0, x0 + w2 + dpr, y0 + h2];
if (m.dodge) { let clash = false;
for (const q of placed) if (box2[0] < q[2] && box2[2] > q[0] && box2[1] < q[3] && box2[3] > q[1]) { clash = true; break; }
if (clash) continue; }
placed.push(box2);
ctx.textAlign = m.mid ? 'center' : 'left';
ctx.fillStyle = SHEET ? (m.colour === SHAPE_RED ? '#b3271a' : m.colour === SHAPE_WARN ? '#8a6100' : '#10151c') : m.colour;
ctx.fillText(m.text, px, py); }
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
ctx.globalAlpha = 1;
ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';
ctx.restore();
}
// ---- what the pointer is over -----------------------------------------------------------------
// A HOVER OR A TAP LIGHTS ONE WHOLE LINK AND NAMES IT. It never takes the pointer: this layer has no
// pointer events at all, the window listens, and the shell's own tap on a dot is untouched.
function shapeAsk(px0, py0){
const D = sldShapes; if (!D) return null;
let best = null, bd = 14;
for (const s of D.shapes) { if (!s.hit || !s.pts || s.pts.length < 2) continue;
const pts = s.pts.map(shapePoint);
for (let i = 1; i < pts.length; i++) { const a = pts[i-1], b = pts[i];
const dx = b[0] - a[0], dy = b[1] - a[1], L = dx*dx + dy*dy;
let t = L > 0 ? ((px0 - a[0]) * dx + (py0 - a[1]) * dy) / L : 0; t = Math.max(0, Math.min(1, t));
const d = Math.hypot(px0 - (a[0] + t*dx), py0 - (a[1] + t*dy));
if (d < bd) { bd = d; best = s; } } }
return best;
}
function shapeTrack(e){
if (!sldShapes || !body || !body.sld || !body.shown || bodyAnim) { if (shapeHover) { shapeHover = null; dirty = true; } return; }
const s = shapeAsk(e.clientX, e.clientY), node = s ? s.node : null;
if (node === shapeHover) return;
shapeHover = node; sldShapes.saying = s ? s.says : null; dirty = true; placeSldNames();
}
addEventListener('pointermove', shapeTrack, { passive:true });
addEventListener('pointerdown', shapeTrack, { passive:true });
// AFTER EVERY FRAME THE SHELL DRAWS, not on a loop of this file's own and not on a guessed list of
// events: the shell says it has drawn, and the words and the drawing are put where the dots are.
try { if (window.__wafer && window.__wafer.onDraw) window.__wafer.onDraw.add(function(){ try { stringClampMicro(); placeSldNames(); drawSldShapes(); } catch (_) {} }); } catch (_) {}
// ===== ANY RADIAL NETWORK, DRAWN BY THE DOTS: fire network {"seed":N} ==========================
// The generator's network (a star, a chain, a tree, sub-boards) laid out as a single line diagram: the busbar on top, every
// substation in its own column, a branch leaving its parent's tee sideways and then down, so no two lines ever share a place.
function netPieces(net){
const P = [], subs = net.subs, n = subs.length, kids = {}; subs.forEach(s => (kids[s.parent] = kids[s.parent] || []).push(s.n));
const col = {}, depth = {}; let c = 0;
(function walk(p, d){ for (const k of (kids[p] || [])) { col[k] = c++; depth[k] = d; walk(k, d + 1); } })(0, 1);
const maxD = Math.max(...Object.values(depth)), dy = Math.min(0.17, 1.05 / maxD), X = k => n === 1 ? 0 : -0.9 + 1.8 * col[k] / (n - 1), Y = k => 0.37 - dy * (depth[k] - 1) - 0.05;
const line = (tag, d, x0, y0, x1, y1) => { const len = Math.hypot(x1 - x0, y1 - y0); if (len > 1e-6) P.push({ tag, d, kind:'line', x0, y0, x1, y1, len }); return d + len; };
const ring = (tag, d, cx, cy, r) => P.push({ tag, d, kind:'ring', cx, cy, r, len:2 * Math.PI * r });
ring('grid', 0, 0, 0.9, 0.06); let d0 = line('poc', 0.06, 0, 0.83, 0, 0.66); line('poc', d0, -0.06, 0.65, 0.06, 0.65); d0 = line('board', d0, 0, 0.63, 0, 0.45);
line('bus', d0, -0.95, 0.43, 0.95, 0.43); line('bus', d0, -0.95, 0.405, 0.95, 0.405);
const teeD = { 0: d0 };
const sym = (tagT, tagL, tagP, d, x, y, s, r) => { // transformer, load and any solar, hanging from (x, y)
let dd = line(tagT, d, x, y - 0.012, x, y - 0.04); ring(tagT, dd, x, y - 0.04 - r, r); ring(tagT, dd + 0.05, x, y - 0.04 - 3 * r - 0.012, r);
const yl = y - 0.04 - 4 * r - 0.024; dd = line(tagT, dd + 0.1, x, yl, x, yl - 0.05);
line(tagL, dd, x - 0.03, yl - 0.06, x, yl - 0.105); line(tagL, dd, x + 0.03, yl - 0.06, x, yl - 0.105);
if (s.pv_kw > 0) { const sx = x + 0.06; line(tagP, dd, x + 0.012, yl - 0.025, sx - 0.03, yl - 0.025); ring(tagP, dd + 0.05, sx, yl - 0.025, 0.026); ring(tagP, dd + 0.05, sx, yl - 0.025, 0.009); }
if (net.generator_at === s.n && net.generator_kw > 0) { const gx = x - 0.06; line('gen', dd, x - 0.012, yl - 0.025, gx + 0.03, yl - 0.025); ring('gen', dd + 0.05, gx, yl - 0.025, 0.028); } };
if (net.generator_at === 0 && net.generator_kw > 0) { line('gen', d0, -0.75, 0.455, -0.75, 0.56); ring('gen', d0 + 0.15, -0.75, 0.62, 0.06); }
const r = Math.min(0.032, 0.6 / n / 2.4 + 0.012);
(function walk(p){ for (const k of (kids[p] || [])) { const s = subs[k - 1], x = X(k), y = Y(k), t = 'hv' + k; let d;
if (p === 0) d = line(t, teeD[0] + Math.abs(x), x, 0.393, x, y);
else { d = line(t, teeD[p], X(p) + 0.012, Y(p), x, Y(p)); d = line(t, d, x, Y(p) - 0.012, x, y); }
teeD[k] = d; sym('tx' + k, 'load' + k, 'pv' + k, d, x, y, s, r); walk(k); } })(0);
let far = 0; for (const p of P) far = Math.max(far, p.kind === 'ring' ? Math.hypot(p.cx, p.cy) + p.r : Math.max(Math.hypot(p.x0, p.y0), Math.hypot(p.x1, p.y1)));
const k = 0.98 / Math.max(0.98, far); // the whole drawing inside the disc
for (const p of P) { if (p.kind === 'ring') { p.cx *= k; p.cy *= k; p.r *= k; } else { p.x0 *= k; p.y0 *= k; p.x1 *= k; p.y1 *= k; } p.len *= k; }
return P;
}
function netFinal(model, tag){
const net = model.net, r = model.solved, e = r.each, c = window.FIRE.topo.C, over = Math.max(0, -r.p) > net.export_limit_kw, aMax = Math.max(1e-9, r.amps);
const bad = v => v > c.volts_high_pu || v < c.volts_low_pu;
return tag.map(t => { if (t === 'grid') return 0.95; if (t === 'poc') return over ? 2 : 0.95; if (t === 'board') return 0.9; if (t === 'bus') return bad(e.volts.board) ? 2 : 0.95;
if (t === 'gen') return model.inputs.generator ? 1 : -1;
const k = t.replace(/\D/g, '');
if (t.startsWith('pv')) return (model.inputs.solar === undefined ? 1 : model.inputs.solar) > 0 ? 1 : -1;
if (t.startsWith('load')) return bad(e.volts['lv' + k]) ? 2 : 0.85;
if (t.startsWith('tx')) return e.tx['lv' + k] > 100 ? 2 : 0.3 + 0.65 * Math.min(1, e.tx['lv' + k] / 100);
return bad(e.volts['hv' + k]) ? 2 : 0.3 + 0.65 * Math.min(1, e.amps['hv' + k] / aMax); });
}
// ===== THE POINTER IS ALWAYS LET GO ==============================================================
// THE FAULT: the shell answers a tap on body dot j with commits[iso.idx[j]] and calls pointerGone(e)
// AFTERWARDS. A drawn diagram has 896 dots and an application has however many pieces of work it has,
// so for most dots iso.idx[j] was undefined, reading .k0 of undefined threw, pointerGone never ran,
// the pointer stayed in the map and the disc went on following a mouse whose button was up. The cure
// above gives every diagram dot its own piece of work, so nothing throws. THIS is the second belt:
// whatever any handler does, the pointer is let go. A listener added here runs AFTER the shell's own
// (they are on the same target in the same phase, and an exception in one listener never stops the
// next), so a throw anywhere in the shell's answer can no longer leave a button pressed for ever.
// It is registered from a timer so that it is registered after the shell's, whatever the load order.
setTimeout(function(){
var net = function(e){ try { if (typeof pointerGone === 'function') pointerGone(e); } catch (_) {} };
addEventListener('pointerup', net);
addEventListener('pointercancel', net);
addEventListener('pointerout', function(e){ if (e.pointerType === 'mouse' && !e.relatedTarget && e.buttons === 0) net(e); });
addEventListener('blur', function(){ try { if (typeof pts !== 'undefined' && pts.clear) pts.clear();
if (typeof drag !== 'undefined') drag = null; if (typeof pinch !== 'undefined') pinch = null; } catch (_) {} });
}, 0);
/* ===========================================================================
SITE - the whole plant as one drawing, anonymised
---------------------------------------------------------------------------
A TUBE MAP, NOT A SINGLE LINE DIAGRAM. A single line diagram is drawn where
the plant is; a tube map is drawn where the reader's eye goes. Nothing here
carries a coordinate, a length, a bearing or a name, so nothing here can
identify a site: the spacing is the VENTUS's, not the ground's.
WHAT IT DRAWS, top to bottom: the grid, the interface, one transformer down
to the collection voltage, the collection busbar, and one column per block -
feeder, switch, skid transformer, inverter, and the DC that feeds it.
IT DOES NOT DRAW EVERY STRING. A tube map does not draw every train. The
strings arrive as a comb whose teeth are GROUPS, and the real count is said
in words. Drawing two dozen lines per block eight times over would break the
one rule this renderer does not bend: a dot's nearest neighbour is three dot
radii away, or the sky stops being black.
THE COLOUR IS THE ARITHMETIC, NOT A MOOD. A column goes amber when a test
says that design is outside a rating. Nothing is coloured by hand.
EVERY NUMBER IS CARRIED, NOT REMEMBERED. An earlier draft of this program
hard-coded one temperature coefficient and used it with another class's
open-circuit voltage. It was wrong by 0.03 %/K, which is 14.5 V at thirty in
series - on a design whose entire margin is a couple of volts. The bins now
travel with the program and the coefficient comes from the bin.
=========================================================================== */
(function (root) {
var F = root.FIRE; if (!F || !F.register) return;
/* the kind registers itself, the way the file asks a program to */
var K = root.FIRE_SLD_KIND || (root.FIRE_SLD_KIND = {});
K['site'] = 'site';
var BLOCKS_DRAWN = 8; /* columns across the busbar */
var TEETH = 4; /* string GROUPS drawn per block, not strings */
/* THE BINS, read off published datasheets and carried here as numbers.
phi COMES FROM A RATIO OF TWO PRINTED NUMBERS, K_Corr = Isc(BNPI)/Isc(STC),
divided by the rear irradiance of the BNPI condition:
phi = (K_Corr - 1) / 0.135
AND THE TWO FAMILIES ARE NOT ON THE SAME FOOTING. One sheet PRINTS its
BNPI condition - front 1000 W/m2, rear 135 W/m2, 25 C, AM 1.5 - so for
those bins phi is derived and the 0.135 is theirs. The other sheet HEADS
a column BNPI and never defines the irradiance condition anywhere; only
STC and NOCT are in its footnote. For those bins, dividing by 0.135
imports the first sheet's condition into the second, and phi is an
ASSUMPTION wearing a derivation's clothes.
This file said 'derived, not assumed' about both. That was true of one
family and false of the other, and the family it was false about is the
DEFAULT. bnpi_stated carries which is which and the card now says so.
The class ids are power-bin labels; no maker or product is named. */
var BINS = {
'T645': { bnpi_stated:false, voc:45.30, isc:18.31, imp:17.23, beta:-0.25, alpha:0.04, kcorr:1.0945, fuse:35, label:'645 W class' },
'T650': { bnpi_stated:false, voc:45.50, isc:18.35, imp:17.27, beta:-0.25, alpha:0.04, kcorr:1.0943, fuse:35, label:'650 W class' },
'T655': { bnpi_stated:false, voc:45.70, isc:18.40, imp:17.31, beta:-0.25, alpha:0.04, kcorr:1.0946, fuse:35, label:'655 W class' },
'T660': { bnpi_stated:false, voc:45.90, isc:18.45, imp:17.35, beta:-0.25, alpha:0.04, kcorr:1.0943, fuse:35, label:'660 W class' },
'T665': { bnpi_stated:false, voc:46.10, isc:18.50, imp:17.39, beta:-0.25, alpha:0.04, kcorr:1.0946, fuse:35, label:'665 W class, the top bin a 0 to +5 W tolerance can deliver' },
'W750': { bnpi_stated:true, voc:50.53, isc:18.56, imp:17.70, beta:-0.22, alpha:0.04, kcorr:1.1148, fuse:35, label:'750 W class' },
'W755': { bnpi_stated:true, voc:50.56, isc:18.59, imp:17.78, beta:-0.22, alpha:0.04, kcorr:1.1151, fuse:35, label:'755 W class' },
'W760': { bnpi_stated:true, voc:50.59, isc:18.62, imp:17.85, beta:-0.22, alpha:0.04, kcorr:1.1149, fuse:35, label:'760 W class' },
'W765': { bnpi_stated:true, voc:50.62, isc:18.65, imp:17.93, beta:-0.22, alpha:0.04, kcorr:1.1153, fuse:35, label:'765 W class' },
'W770': { bnpi_stated:true, voc:50.65, isc:18.68, imp:18.00, beta:-0.22, alpha:0.04, kcorr:1.1151, fuse:35, label:'770 W class' }
};
var BNPI_REAR = 0.135, TABLE_TOP = 25; /* the sheet's own top rear-gain row */
var V_CEIL = 1500; /* equipment rating, not a standards limit */
var STRING_INPUT_A = 20, MPPT_INPUT_A = 40, STRINGS_PER_MPPT = 2, SIZING = 1.25;
function pieces() {
var P = [];
function line(tag, d, x0, y0, x1, y1) {
P.push({ tag:tag, d:d, kind:'line', x0:x0, y0:y0, x1:x1, y1:y1,
len:Math.hypot(x1 - x0, y1 - y0) });
}
function ring(tag, d, cx, cy, r) {
P.push({ tag:tag, d:d, kind:'ring', cx:cx, cy:cy, r:r, len:2 * Math.PI * r });
}
ring('grid', 0, 0, 0.90, 0.07); /* the grid */
line('interface', 0.07, 0, 0.83, 0, 0.70);
ring('tx', 0.14, 0, 0.655, 0.05); /* down to the collection voltage */
ring('tx', 0.24, 0, 0.575, 0.05);
line('board', 0.34, 0, 0.525, 0, 0.455);
line('bus', 0.42, -0.92, 0.425, 0.92, 0.425); /* the collection busbar */
line('bus', 0.42, -0.92, 0.405, 0.92, 0.405);
var n = BLOCKS_DRAWN;
for (var i = 0; i < n; i++) {
var x = n === 1 ? 0 : -0.82 + 1.64 * i / (n - 1);
var d0 = 0.45 + Math.abs(x); /* further out is further along */
var t = 'b' + i;
line(t, d0, x, 0.395, x, 0.315); /* feeder off the busbar */
ring(t, d0 + 0.09, x, 0.275, 0.035); /* the switch */
ring('sk' + i, d0 + 0.16, x, 0.195, 0.042); /* skid transformer, two rings */
ring('sk' + i, d0 + 0.24, x, 0.118, 0.042);
line(t, d0 + 0.31, x, 0.070, x, 0.030);
ring('inv', d0 + 0.36, x, -0.015, 0.045); /* the inverter, a symbol */
line('dc' + i, d0 + 0.44, x, -0.062, x, -0.150); /* the DC it eats */
var w = 0.072;
line('dc' + i, d0 + 0.50, x - w, -0.150, x + w, -0.150);
/* THE TEETH ARE NOT TAGGED 'pv', AND THAT IS NOT A NAMING WHIM.
sldLayout decides which pieces are SYMBOLS - pieces given a floor of
dots so they read as the thing they are - with a PREFIX match:
t.startsWith('pv'). That was written when a network drawing had one
solar symbol on it. Tagging 32 comb pieces 'pv' claimed 32 symbol
floors, which is 704 of the 896 dots the whole drawing gets, and the
rounding loop cannot take a symbol below its floor. The collection
busbar - the spine of the picture - was left with scraps and did not
appear at all. The blocks hung off nothing. */
for (var j = 0; j < TEETH; j++) { /* teeth are GROUPS of strings */
var tx = x - w + 2 * w * j / (TEETH - 1);
line('sr' + i, d0 + 0.54, tx, -0.150, tx, -0.300);
ring('sr' + i, d0 + 0.62, tx, -0.340, 0.020);
}
}
return P;
}
/* brightness per tag: 0..1 lit, 2 = outside a rating (amber), -1 = dark */
function final(s, tag) {
return tag.map(function (t) {
if (t === 'grid' || t === 'interface' || t === 'bus') return 0.95;
if (t === 'tx' || t === 'board') return 0.90;
if (t.indexOf('sk') === 0) return 0.85;
if (t === 'inv') return s.over_mppt ? 2 : 1; /* the machine's own input */
if (t.indexOf('sr') === 0) return s.over_volts ? 2 : 1; /* the array's voltage */
/* THE DC RUN CARRIES BOTH CURRENT VERDICTS, and it is OR rather than a
precedence on purpose: the renderer has one alarm value, so nesting
them would give identical output by a longer road - and that road is
where a later edit hides the loser. The fuse belongs here because
design_a is what cable and protection are sized to, which is what
these pieces depict; a fuse rating is not a property of the array. */
if (t.indexOf('dc') === 0)
return (s.over_string || s.over_fuse) ? 2 : 0.9;
return 0.55;
});
}
var BOXES = [
{ key:'module_class', label:'module class', kind:'choice',
choices:Object.keys(BINS).map(function (k) { return [k, BINS[k].label]; }) },
{ key:'modules_in_series', label:'modules in series', unit:'',
kind:'number', min:20, max:34, step:1 },
{ key:'rear_gain_pct', label:'rear gain', unit:'%',
kind:'number', min:0, max:30, step:1 },
{ key:'site_min_c', label:'assessment temperature', unit:'C',
kind:'number', min:-20, max:0, step:1 },
{ key:'routing', label:'string routing', kind:'choice',
choices:[['leapfrog', 'leapfrog, go and return alongside each other'],
['one-after-another', 'one after another, return down the row']] }
];
/* THE GUARD. Written the way the sibling string program writes one: a value
the engine cannot hold is refused in words, never defaulted.
DEFAULTING IS WORSE THAN REFUSING, and not as a matter of taste. A typed
word where a number belongs becomes NaN, and every verdict below was
written `v > limit`. NaN > 1500 is false, so the garbage came back as
"inside the 1500 V rating by NaN V" - a PASS, in the voice of an answer.
A refusal is read; a default is obeyed. */
var NUMS = { modules_in_series:'modules in series',
rear_gain_pct:'rear gain, in %',
site_min_c:'the assessment temperature, in C' };
var CHOICE = { module_class:Object.keys(BINS),
routing:['leapfrog', 'one-after-another'] };
function shown(v) { return typeof v === 'string' ? '"' + v + '"' : String(v); }
function guard(inp) {
var bad = [], k, v, x;
for (k in inp) {
if (!Object.prototype.hasOwnProperty.call(inp, k)) continue;
v = inp[k];
if (v === undefined || v === null) continue; /* absent = take the default */
if (!NUMS[k] && !CHOICE[k]) {
bad.push('"' + k + '" is not an input this command has, so it was about '
+ 'to be ignored in silence while its default answered in its place; '
+ 'the inputs are '
+ Object.keys(CHOICE).concat(Object.keys(NUMS)).join(', ') + '.');
continue;
}
if (CHOICE[k]) {
if (CHOICE[k].indexOf(v) < 0)
bad.push(k + ' must be one of ' + CHOICE[k].join(', ')
+ '; you typed ' + shown(v) + '.');
continue;
}
x = typeof v === 'number' ? v
: (typeof v === 'string' && v.trim() !== '' ? Number(v) : NaN);
if (!isFinite(x))
bad.push(NUMS[k] + ' must be a number; you typed ' + shown(v) + '.');
}
return bad.slice(0, 6);
}
F.register('site', 'SITE', function (inputs) {
var stopped = guard(inputs || {});
if (stopped.length) {
return {
numbers: { drawn:'nothing', inputs_refused:stopped.length },
refused: true,
said: 'NOTHING IS DRAWN. ' + stopped.join(' ')
+ ' Refusing beats defaulting because a default still produces a '
+ 'confident number nobody asked for, and a value that is not a '
+ 'number produces NaN, which loses every comparison silently and '
+ 'reads as if the design were inside its rating. Change the input '
+ 'named above and fire again.',
how: 'Every value is read and checked before a coordinate is worked '
+ 'out. A refusal is not a failure: it is the engine declining to '
+ 'draw a plant whose arithmetic it cannot stand behind.',
sld: null
};
}
var id = inputs.module_class && BINS[inputs.module_class] ? inputs.module_class : 'T660';
var b = BINS[id];
var se = inputs.modules_in_series === undefined ? 30 : +inputs.modules_in_series;
var rear = (inputs.rear_gain_pct === undefined ? BNPI_REAR * 100 : +inputs.rear_gain_pct) / 100;
var tmin = inputs.site_min_c === undefined ? -10 : +inputs.site_min_c;
var routing = inputs.routing || 'leapfrog';
var phi = (b.kcorr - 1) / BNPI_REAR;
var kb = 1 + phi * rear; /* rear side adds current */
var kt = 1 + b.alpha / 100 * (tmin - 25); /* cold takes a little back */
var isc_e = b.isc * kb * kt, imp_e = b.imp * kb * kt;
var v = se * b.voc * (1 + b.beta / 100 * (tmin - 25));
/* THREE DIFFERENT TESTS, AND THE SIZING FACTOR BELONGS TO ONLY ONE OF THEM.
An earlier draft multiplied the machine's own input limit by 1.25 and so
failed designs that are inside it. 1.25 is a continuous-current factor
for array cable and overcurrent protection; a manufacturer's input limit
is a limit on the current itself. They are reported separately. */
/* `!(x <= limit)` NOT `x > limit`. On every finite number the two agree -
8,000,132 checks on the card, 0 disagreements - so nothing a real design
does changes. They part on NaN: `>` says false and passes it, `!(<=)`
says true and names it. The guard above should make that unreachable;
this is the second lock on the same door, for the day someone edits
the guard. */
var over_volts = !(v <= V_CEIL); /* equipment rating */
var over_string = !(imp_e <= STRING_INPUT_A); /* string input, working current */
var over_mppt = !(isc_e * STRINGS_PER_MPPT <= MPPT_INPUT_A); /* the machine's input */
var design_a = SIZING * isc_e; /* what cable and OCPD are sized to */
var over_fuse = !(design_a <= b.fuse); /* the sheet's max series fuse */
/* over_fuse WAS COMPUTED, PRINTED IN THE SENTENCE, AND NEVER DRAWN.
It was absent from this object, so finalFor() could not see it and a
design over its maximum series fuse was coloured exactly like one that
passed: the words said OVER, the picture said fine. It could not fire
today only by arithmetic coincidence - the worst reachable design
current is about 28.8 A against 35 A - and it would have gone live in
silence on any bin with a 30 A fuse. */
var s = { over_volts:over_volts, over_string:over_string,
over_mppt:over_mppt, over_fuse:over_fuse };
var head = V_CEIL - v;
var said =
'The whole plant in one drawing: grid, interface, one transformer to the '
+ 'collection busbar, and ' + BLOCKS_DRAWN + ' blocks hanging off it. '
+ se + ' of the ' + b.label + ' in series reaches ' + v.toFixed(1)
+ ' V at ' + tmin + ' C, '
+ (over_volts ? 'OVER the ' + V_CEIL + ' V equipment rating by '
+ (-head).toFixed(1) + ' V'
: 'inside the ' + V_CEIL + ' V rating by ' + head.toFixed(1) + ' V')
+ (!over_volts && head < 25 ? ' - which at a 0 to +5 W tolerance is not a margin, '
+ 'because the module that arrives can be the top bin' : '')
+ '. At ' + (rear * 100).toFixed(1) + '% rear gain, with a bifaciality of '
+ phi.toFixed(3) + (b.bnpi_stated
? ' derived from this sheet\'s own printed rear-irradiance condition, '
: ' derived from this sheet\'s printed current ratio but divided by a rear '
+ 'irradiance THIS SHEET DOES NOT STATE - it heads a column BNPI and '
+ 'defines only STC and NOCT, so that divisor is borrowed from another '
+ 'sheet and this number is an assumption, ')
+ 'the string '
+ 'works at ' + imp_e.toFixed(2) + ' A and shorts at ' + isc_e.toFixed(2) + ' A: '
+ (over_string ? 'OVER the ' + STRING_INPUT_A + ' A string input'
: 'inside the ' + STRING_INPUT_A + ' A string input') + ', '
+ (over_mppt ? 'OVER the ' + MPPT_INPUT_A + ' A machine input on ' + STRINGS_PER_MPPT
+ ' strings' : 'inside the ' + MPPT_INPUT_A + ' A machine input') + ', '
+ 'and cable and protection size to ' + design_a.toFixed(2) + ' A against a '
+ b.fuse + ' A maximum series fuse'
+ (over_fuse ? ' - OVER it' : '')
+ '. Routing is ' + routing + ', which sets the loop and therefore the '
+ 'transient, and reaches neither the voltage nor the current above.';
return {
numbers: {
module_class: id,
bifaciality: +phi.toFixed(3),
bifaciality_is_derived: !!b.bnpi_stated,
modules_in_series: se,
string_voltage_v: +v.toFixed(1),
headroom_to_rating_v: +head.toFixed(1),
working_current_a: +imp_e.toFixed(2),
short_circuit_current_a: +isc_e.toFixed(2),
design_current_a: +design_a.toFixed(2),
rear_gain_pct: +(rear * 100).toFixed(1),
blocks_drawn: BLOCKS_DRAWN
},
said: said,
how: 'The teeth of each comb are GROUPS of strings, not strings: a tube map '
+ 'does not draw every train, and a dot closer than three radii to its '
+ 'neighbour is the one thing this renderer will not draw. Bifaciality is '
+ 'derived from the sheet\'s own K_Corr at its printed rear-irradiance '
+ 'condition, never assumed, and the sheet publishes rear gain to '
+ TABLE_TOP + '%. The 1.25 factor is applied to cable and protection '
+ 'sizing only, never to a manufacturer\'s input limit. NOT MODELLED, '
+ 'and each one makes the real answer worse: the rise in open-circuit '
+ 'voltage with irradiance, uneven rear light along a string, and every '
+ 'transient effect beyond a first-order V = L I / t. Nothing here '
+ 'carries a coordinate, a length, a bearing or a name.',
sld: { kind:'site', pieces:pieces(), state:s, finalFor:final }
};
}, BOXES);
})(typeof window !== 'undefined' ? window : globalThis);Ventus — Wiring Page
A web page in GlobalGrid2050. Published at https://globalgrid2050.com/ventus/wiring/.
renderglobalgrid2050 / ventus/wiring/index.html · lines 1–1 of 1 · Entry point
- What it does
- It draws its content. Side effects: changes the web page (DOM).
- Inputs & outputs
- Out: web page.
- Downstream impact
- Used directly by 2 files: Existing Wiring (graphics-engines-open-source); GlobalGrid2050 Deploy Pages Workflow (globalgrid2050). Reached from 1 other entry point, including Existing Wiring Workflow (graphics-engines-open-source). It is itself an entry point, published at https://globalgrid2050.com/ventus/wiring/.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Imported by GlobalGrid2050 Deploy Pages Workflow. Checked by Existing Wiring.
- Application
- globalgrid2050 · ventus/wiring · page
- Uses
- none found
- Used by
- named by URL in Existing Wiring (estate URL), named by URL in GlobalGrid2050 Deploy Pages Workflow (estate URL)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 ventus/wiring/index.html:1-1 · blob 3bc4ee0ca774b1fe10b501da99effe3fd4cd6aae · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: production_core
<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="refresh" content="0;url=inverter-48.html"><title>VENTUS Wiring</title></head><body><a href="inverter-48.html">VENTUS DC wiring</a> · <a href="inverter-station.html">VENTUS AC station</a></body></html>Public Start
A JavaScript file in the wiring folder of GlobalGrid2050 that works with finite tree (`finiteTree`). Served with the page at https://globalgrid2050.com/ventus/wiring/. It is built from the finite tree helper (`finiteTree`).
renderglobalgrid2050 / ventus/wiring/public-start.js · lines 1–20 of 20 · Entry point · pattern finiteTree (shared by 2 files)
- What it does
- Defines finiteTree. Side effects: changes the web page (DOM).
- Downstream impact
- Used directly by 1 file: Renderer (globalgrid2050, https://globalgrid2050.com/ventus/wiring/renderer.html). It is itself an entry point, published at https://globalgrid2050.com/ventus/wiring/.
- What it achieves
- Generic release bootstrap. Native canvas, camera and string engine remain inherited.
- Why it matters
- Loaded by the Renderer page at https://globalgrid2050.com/ventus/wiring/renderer.html.
- Application
- globalgrid2050 · ventus/wiring · script
- Uses
- none found
- Used by
- loaded by Renderer (script src)
- Produces
- finiteTree
- Defines here
- finiteTree
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 ventus/wiring/public-start.js:1-20 · blob 5fa1501b402c5b3ffa45f1855eb9f488eba5690b · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: production_core
// Generic release bootstrap. Native canvas, camera and string engine remain inherited.
'use strict';
let starts=0;
const start=setInterval(()=>{
if(++starts>300){clearInterval(start);return;}
if(typeof fireCommand==='function'&&typeof N!=='undefined'&&N>0&&window.FIRE){
clearInterval(start);
FIRE_PROGRAM.select={app:'generic-drawing',repository:'generic-scene'};
apps.push({app:'generic-drawing',button:'DRAWING',repo:'generic-scene',prefixes:[],live:'./'});
appWork['generic-drawing']=['synthetic-scene'];
const inheritedFire=FIRE.fire;
FIRE.fire=function(command){
if(!/^fire (?:inverter-48|string|array-lab-table|synthetic-site|whole-site-routes)(?: |$)/.test(command))throw Error('This release exposes drawing geometry only.');
const result=inheritedFire.call(this,command),seen=new WeakSet();
function finiteTree(value){if(typeof value==='number'&&!Number.isFinite(value))throw Error('Drawing calculation returned a non-finite value.');if(value&&typeof value==='object'&&!seen.has(value)){seen.add(value);for(const v of Object.values(value))finiteTree(v);}}
finiteTree(result);return result;
};
fireCommand('fire string {"modules":30,"modules_high":1,"mounting":"fixed","orientation":"portrait","routing":"one-after-another","view":"macro"}',null);
}
},100);