In this section
- Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page render · globalgrid2050 / testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html lines 399–508
- Route State transform · globalgrid2050 / testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/route-state.js lines 1–22
- Reported Project Panel render · globalgrid2050 / testcode/202609060208/reported-project-panel.mjs lines 1–18
- Control Solar Daily MWh Chart energy-data · globalgrid2050 / uk_energy_tracking_v6/generation_history/control_solar_daily_mwh_chart.js lines 1–33
- Render Solar Daily MWh Chart energy-data · globalgrid2050 / uk_energy_tracking_v6/generation_history/render_solar_daily_mwh_chart.js lines 1–33
- Control Solar Daily MWh Chart energy-data · globalgrid2050 / uk_energy_tracking_v6_2/generation_history/control_solar_daily_mwh_chart.js lines 1–27
- Render Solar Daily MWh Chart energy-data · globalgrid2050 / uk_energy_tracking_v6_2/generation_history/render_solar_daily_mwh_chart.js lines 1–29
- Check Solar1000 V924 test · globalgrid2050 / uk_renewables_pipeline/202611161630/tests/check_solar1000_v924.mjs lines 1–20
- Solar1000 V924 render · globalgrid2050 / uk_renewables_pipeline/202611201709/scripts/plugins/solar1000-v924.js lines 1–73
- Inverter 48 Electrical UI electrical · globalgrid2050 / ventus/wiring/inverter-48-electrical-ui.mjs lines 1–56
- Inverter 48 Electrical electrical · globalgrid2050 / ventus/wiring/inverter-48-electrical.mjs lines 1–83
- Inverter 48 Model electrical · globalgrid2050 / ventus/wiring/inverter-48-model.mjs lines 1–63
- Inverter 48 Native electrical · globalgrid2050 / ventus/wiring/inverter-48-native.mjs lines 1–123
Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page
A web page in the layer apps folder of GlobalGrid2050 that reads inputs for loc, mod wp and mod, covering battery storage (BESS), cables, substations and 33kV. Published at https://globalgrid2050.com/testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/.
Set aside from the main view: 100% of its lines are the same as sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html (testcode), which stays. (near-copy-of, proposed by families.py). 99% of lines shared with Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9973 to testcode@a8a215982b13d6e2f6019b40bf0bef5755719773 sandbox/202609052028/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html:1-509 30df4d7eb32d3c14a584c088ea0573be9118c636
- sha256 6bb283ecc6adad3c5749b37933a0027705e8d339154bc388de0735dd6837e79b
- target sha256 8c7fa15728bcd1edf03706b599472089dbdb506bc39e526c9e195a448f354747
- group of 3 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
renderglobalgrid2050 / testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html · lines 399–508 of 508 · version 2026-09-05 20:11 (continued from section 195) · Entry point
- What it does
- It draws battery storage (BESS), cables, substations and 33kV. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'sandbox'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: battery storage (BESS), cables, substations, 33kV, 400kV, 275kV.
- Inputs & outputs
- In: form fields (user input). Out: web page. Voltage levels named: 400kV, 275kV, 132kV, 66kV, 33kV.
- Downstream impact
- Used directly by 1 file: Solar Battery Energy Storage System (BESS) Topology V7 — Module Layout Page (globalgrid2050, https://globalgrid2050.com/testcode/202609051958/layer-apps/solar-bess-topology-v7/module-layout/). It is itself an entry point, published at https://globalgrid2050.com/testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/.
- What it achieves
- Its code works with 33 kV, 0.00 MVA and 132 kV.
- Why it matters
- Loaded by the Module Layout page at https://globalgrid2050.com/testcode/202609051958/layer-apps/solar-bess-topology-v7/module-layout/.
- Application
- globalgrid2050 · testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox · page
- Uses
- GIS Single-Line Diagram (SLD) V5 Config (script src), GIS Single-Line Diagram (SLD) V5 Helpers (script src), GIS Single-Line Diagram (SLD) V5 State (script src), GIS Single-Line Diagram (SLD) V5 Substations (script src), GIS Single-Line Diagram (SLD) V5 (stylesheet), GIS Single-Line Diagram (SLD) V5 Map (script src), GIS Single-Line Diagram (SLD) V5 Calculations (script src), GIS Single-Line Diagram (SLD) V4 Finance (script src), and 5 more, https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js, https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js
- Used by
- linked from Solar Battery Energy Storage System (BESS) Topology V7 — Module Layout Page (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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/index.html:399-508 · blob 3d025b61add03f69b50660d8f9cb4f99ac9bed3a · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
<p>Users remain responsible for checking all inputs, outputs, assumptions and exported data. Any real world project should be reviewed by competent engineers, grid specialists, planners, environmental consultants, land agents, legal advisers, tax advisers, insurance advisers, EPC contractors, Owner's Engineers, lenders and investment committee professionals before committing capital, signing contr … [line shortened here: 449 characters; full line on GitHub]
<p>The sandbox is designed to make assumptions visible, not to remove professional judgement. It should be used to ask better questions, compare scenarios, identify where deeper work is required and support disciplined early stage decision making.</p>
</div>
</div>
<div class="panel panel-right">
<div id="fetch_status"></div>
<div class="gis-map-search" id="gis_map_search">
<input id="gis_search_input" class="gis-search-input" type="text" placeholder="Search site or substation..." autocomplete="off" />
<button id="gis_search_btn" class="map-toggle-btn gis-search-btn">GO</button>
<div id="gis_search_results" class="gis-search-results"></div>
</div>
<div class="map-controls">
<div class="map-toggle-row">
<button id="btn_subs_toggle" class="map-toggle-btn active">SUBS ON</button>
<button id="btn_basemap" class="map-toggle-btn">SATELLITE VIEW</button>
<button id="btn_map_expand" class="map-toggle-btn">MAP MAX</button>
<button id="btn_key_toggle" class="map-toggle-btn active">KEY ON</button>
<button id="btn_array_toggle" class="map-toggle-btn active">ARRAY ON</button>
<button id="btn_print_report" class="map-toggle-btn print-btn">PRINT</button>
</div>
<div class="map-toggle-row voltage-toggle-row">
<button id="btn_atlas_66kv" class="map-toggle-btn active atlas-voltage-btn atlas-66kv" data-atlas-voltage="66kv">66 kV ON</button>
<button id="btn_atlas_132kv" class="map-toggle-btn active atlas-voltage-btn atlas-132kv" data-atlas-voltage="132kv">132 kV ON</button>
<button id="btn_atlas_275kv" class="map-toggle-btn active atlas-voltage-btn atlas-275kv" data-atlas-voltage="275kv">275 kV ON</button>
<button id="btn_atlas_400kv" class="map-toggle-btn active atlas-voltage-btn atlas-400kv" data-atlas-voltage="400kv">400 kV ON</button>
</div>
<div class="map-toggle-row asset-toggle-row asset-filter-row">
<select id="asset_layer_select" class="map-asset-select" title="Energy asset layer">
<option value="off">Energy assets OFF</option>
<option value="all">All technologies</option>
<option value="solar_operational">Solar PV</option>
<option value="bess_operational">BESS</option>
<option value="wind_onshore_operational">Onshore wind</option>
<option value="wind_offshore_operational">Offshore wind</option>
</select>
<select id="asset_status_select" class="map-asset-status-select" title="Project status">
<option value="all">All statuses</option>
<option value="operational">Operational</option>
<option value="under construction">Under construction</option>
<option value="awaiting construction">Awaiting construction</option>
<option value="planning approved">Planning approved</option>
<option value="planning submitted">Planning submitted</option>
<option value="refused">Refused</option>
<option value="withdrawn">Withdrawn</option>
</select>
<input id="asset_min_mw" class="asset-range-input" type="number" min="0" step="1" placeholder="Min MW" title="Minimum project capacity MW" />
<input id="asset_max_mw" class="asset-range-input" type="number" min="0" step="1" placeholder="Max MW" title="Maximum project capacity MW" />
<button id="btn_asset_filter_apply" class="map-toggle-btn">APPLY</button>
</div>
</div>
<div class="crosshair">⌖</div>
<div id="site_intel_panel" class="site-intel-panel collapsed">
<div class="site-intel-header">
<span>Site Intelligence</span>
<button id="site_intel_close" type="button">×</button>
</div>
<div id="site_intel_body" class="site-intel-body">
Click the map to inspect nearby assets, substations and voltage corridors.
</div>
</div>
<div class="map-tool-overlay" id="map_tool_overlay">
<div class="map-toggle-row">
<button id="btn_map_tools_toggle" class="map-toggle-btn active">TOOLS ON</button>
<button id="btn_map_draw" class="map-toggle-btn">DRAW</button>
<button id="btn_map_pick_array" class="map-toggle-btn">PICK ARRAY</button>
<button id="btn_map_drop_pins" class="map-toggle-btn">DROP PINS</button>
<button id="btn_map_draw_route" class="map-toggle-btn">DRAW ROUTE</button>
</div>
<div class="map-toggle-row map-size-row">
<input id="map_target_dc_mwp" class="map-size-input" type="number" min="0.1" step="1" placeholder="MWp DC" />
<button id="btn_map_apply_size" class="map-toggle-btn">SIZE MWp</button>
<span id="map_size_status" class="map-size-status">Whole block sizing</span>
</div>
<div class="map-toggle-row map-tool-row-secondary">
<button id="btn_map_rotate_left" class="map-toggle-btn">ROT -30</button>
<button id="btn_map_rotate_right" class="map-toggle-btn">ROT +30</button>
<button id="btn_map_rotate_90" class="map-toggle-btn">ROT +90</button>
<button id="btn_map_nudge_up" class="map-toggle-btn">↑</button>
<button id="btn_map_nudge_left" class="map-toggle-btn">←</button>
<button id="btn_map_nudge_right" class="map-toggle-btn">→</button>
<button id="btn_map_nudge_down" class="map-toggle-btn">↓</button>
</div>
<div class="map-toggle-row map-tool-row-secondary">
<button id="btn_map_undo_pin" class="map-toggle-btn">UNDO PIN</button>
<button id="btn_map_clear_route" class="map-toggle-btn">CLEAR ROUTE</button>
<button id="btn_map_reset_rotation" class="map-toggle-btn">RESET ROT</button>
<button id="btn_map_reset_array" class="map-toggle-btn">RESET ARRAY</button>
</div>
</div>
<div id="map"></div>
<div class="legend" id="map_legend"></div>
</div>
</div>
<!-- V7 migrated modular app scripts -->
<script src="gis-sld-v5-map.js"></script>
<script src="gis-sld-v5-calculations.js"></script>
<script src="gis-sld-v5-finance.js"></script>
<script src="gis-sld-v5-ui-core.js"></script>
<script src="gis-sld-v5-drawing.js"></script>
<script src="gis-sld-v5-export.js"></script>
<script src="gis-sld-v5-ui.js"></script>
<script src="./route-state.js"></script>
</body>
</html>Route State
A JavaScript file in the GIS SLD financial sandbox folder of GlobalGrid2050 that gets snapshot (`getSnapshot`). Served with the page at https://globalgrid2050.com/testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/.
transformglobalgrid2050 / testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/route-state.js · lines 1–22 of 22 · version 2026-09-05 20:11 · Entry point · pattern freeze (shared by 6 files)
- What it does
- It calculates its inputs. Defines freeze, clone, coordinate, getSnapshot.
- 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 Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page (globalgrid2050, https://globalgrid2050.com/testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/); Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page (testcode). Reached from 1 other entry point, including Solar Battery Energy Storage System (BESS) Topology V7 — Module Layout Page (globalgrid2050, https://globalgrid2050.com/testcode/202609051958/layer-apps/solar-bess-topology-v7/module-layout/). It is itself an entry point, published at https://globalgrid2050.com/testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/.
- What it achieves
- It gets snapshot (`getSnapshot`) and is built from the freeze step (`freeze`) and the clone step (`clone`). Read-only adapter for original GIS SLD route state.
- Why it matters
- Loaded by the GIS Single-Line Diagram (SLD) Financial Sandbox page at https://globalgrid2050.com/testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/ and 1 other page.
- Application
- globalgrid2050 · testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox · script
- Uses
- none found
- Used by
- loaded by Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page (script src), loaded by Solar Battery Energy Storage System (BESS) Topology V7 — GIS Single-Line Diagram (SLD) Financial Sandbox Page (script src)
- Produces
- freeze, clone, coordinate, getSnapshot
- Defines here
- freeze, clone, coordinate, getSnapshot
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609052011/layer-apps/solar-bess-topology-v7/gis-sld-financial-sandbox/route-state.js:1-22 · blob 74fe9418a04a47650dbd34d6e3c01a22a4ae81c8 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: production_core
/* Read-only adapter for original GIS SLD route state. No calculation or mutation. */
(() => {
'use strict';
const freeze=value=>{if(value&&typeof value==='object'){Object.values(value).forEach(freeze);Object.freeze(value);}return value;};
const clone=value=>JSON.parse(JSON.stringify(value));
const coordinate=p=>Array.isArray(p)&&p.length>=2&&Number.isFinite(p[0])&&Number.isFinite(p[1])&&Math.abs(p[0])<=180&&Math.abs(p[1])<=90;
function getSnapshot() {
const source=typeof state==='undefined'?null:state;
if(!source)return freeze({schema:'ventus.gis-route.v1',status:'unavailable'});
const pins=clone(source.cableRoutePins||[]);
const routes=(source.currentGeoJSON?.features||[]).filter(f=>f.properties?.type==='export_cable');
const route=routes.length===1?clone(routes[0]):null;
const editing=Boolean(source.cableRoutePinMode)||(pins.length>0&&!source.cableRouteCommitted);
const valid=route?.geometry?.type==='LineString'&&Array.isArray(route.geometry.coordinates)&&route.geometry.coordinates.length>=2&&route.geometry.coordinates.every(coordinate);
return freeze({schema:'ventus.gis-route.v1',status:editing?'editing':routes.length>1?'ambiguous':valid?'available':routes.length?'invalid':'empty',
route:valid&&!editing?route:null,pins,committed:Boolean(source.cableRouteCommitted),
measurementMethod:valid&&!editing?route.properties.measurement_method:null,
originalLengthKm:valid&&!editing&&Number.isFinite(route.properties.export_cable_length_km)?route.properties.export_cable_length_km:null,
scope:'Read-only original manual route snapshot; no constraint routing, capacity or construction acceptance.'});
}
Object.defineProperty(window,'GisSldRoute',{value:Object.freeze({getSnapshot}),writable:false,configurable:false});
})();Reported Project Panel
A JavaScript module in the testcode folder of GlobalGrid2050. It shows reported project (`showReportedProject`).
renderglobalgrid2050 / testcode/202609060208/reported-project-panel.mjs · lines 1–18 of 18 · version 2026-09-06 02:08 · Not reached from any entry point (candidate for review)
- What it does
- It draws its content. Defines showReportedProject. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- What it achieves
- Defines `showReportedProject`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609060208 · JavaScript module
- Uses
- Reported Project (import)
- Used by
- none found
- Produces
- showReportedProject
- Defines here
- showReportedProject
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609060208/reported-project-panel.mjs:1-18 · blob 87250882f59ef05e49a2c7f5cf32776148e991f9 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unreached_review
import {validateReportedProject} from './reported-project.mjs';
export function showReportedProject(host, input) {
const project=validateReportedProject(input);
const title=document.createElement('h2');title.textContent=project.primary_project+' - reported proposal';
const scope=document.createElement('p');scope.textContent='No name match in the pinned '+project.snapshot_check.rows+'-project Pipeline snapshot. Current national REPD presence and aliases have not been established.';
const list=document.createElement('dl');
for (const claim of project.claims) {
const term=document.createElement('dt'), description=document.createElement('dd');
term.textContent=claim.metric.replaceAll('_',' ');
description.textContent=(claim.value===true?'Reported included':String(claim.value))+(claim.unit?' '+claim.unit:'')+(claim.qualifier?' - '+claim.qualifier:'');
list.append(term,description);
}
const related=document.createElement('p');related.textContent='Separate related project: '+project.related_projects.map(p=>p.name).join(', ')+'. Its capacity and cost are not attributed to '+project.primary_project+'.';
const unknown=document.createElement('p');unknown.textContent='Still unverified or unspecified: '+project.unknowns.join('; ')+'.';
const evidence=document.createElement('p'),link=document.createElement('a');link.href=project.article_url;link.textContent=project.publisher+' source';evidence.append(link,document.createTextNode(' | '+project.evidence_basis));
const caveat=document.createElement('p');caveat.textContent=project.paper_alignment;
host.replaceChildren(title,scope,list,related,unknown,evidence,caveat);
}Control Solar Daily MWh Chart
A JavaScript file in the generation history folder of GlobalGrid2050 that loads fuel daily (`loadFuelDaily`), syncs full period (`syncFullPeriod`) and sets period (`setPeriod`) (units: MWh).
energy-dataglobalgrid2050 / uk_energy_tracking_v6/generation_history/control_solar_daily_mwh_chart.js · lines 1–33 of 33 · Not reached from any entry point (candidate for review) · pattern syncFullPeriod (shared by 2 files)
- What it does
- It draws pvlive solar daily browser and generation daily mwh by technology fuelhh. Defines 16 functions or classes, including cfg, get, load, loadSolarDaily, loadFuelDaily. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Inputs & outputs
- In: JSON file pvlive_solar_daily_browser.json; JSON file generation_daily_mwh_by_technology_fuelhh_2016_2026.json.
- What it achieves
- It loads solar daily (`loadSolarDaily`), loads fuel daily (`loadFuelDaily`) and syncs full period (`syncFullPeriod`). Defines `cfg`, `get`, `load` and 13 more. It responds to change, resize and DOMContentLoaded events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_energy_tracking_v6/generation_history · script
- Uses
- none found
- Used by
- none found
- Produces
- cfg, get, load, loadSolarDaily, loadFuelDaily, periodDays, niceDate, years, srcLabel, srcStatus, rowsFor, get
- Defines here
- cfg, get, load, loadSolarDaily, loadFuelDaily, periodDays, niceDate, years, srcLabel, srcStatus, rowsFor, get, syncFullPeriod, setPeriod, openFull, closeFull
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_energy_tracking_v6/generation_history/control_solar_daily_mwh_chart.js:1-33 · blob 398e8af3ce093aba88df5fd0bc6c79bac8ce4245 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: unreached_review
window.V6ControlSolarDailyMwhChart=(function(){
var cache={};
function cfg(){return window.V6GenerationHistoryConfig||{}}
function get(id){return document.getElementById(id)}
function load(key,url){if(cache[key])return cache[key];cache[key]=fetch(url+'?t='+Date.now(),{cache:'no-store'}).then(function(r){return r.ok?r.json():{rows:[]}}).then(function(d){return d.rows||[]}).catch(function(){return[]});return cache[key]}
function loadSolarDaily(){return load('solar',(cfg().solarDaily||'/uk_energy_tracking_v6/generation_history/pvlive_solar_daily_browser.json'))}
function loadFuelDaily(){return load('fuel','/uk_energy_tracking_v6/generation_history/generation_daily_mwh_by_technology_fuelhh_2016_2026.json')}
function periodDays(p){return{'30d':30,'3m':92,'6m':183,'12m':366,'5y':1827,'10y':3653}[p]||366}
function niceDate(v){var d=v instanceof Date?v:new Date(String(v));return isNaN(d.getTime())?'—':d.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}
function years(rows){var out={};rows.forEach(function(r){if(r&&r.date)out[String(r.date).slice(0,4)]=true});return Object.keys(out).sort()}
function srcLabel(t){return t==='Solar'?'PVLive stored energy':'Elexon FUELHH derived energy'}
function srcStatus(t){return t==='Solar'?'SHEFFIELD SOLAR PVLIVE STORED MWH':'ELEXON FUELHH DERIVED DAILY MWH'}
function techOptions(fuelRows){var el=get('solar-daily-mwh-technology');if(!el||el.dataset.multiReady==='1')return;var seen={Solar:true};fuelRows.forEach(function(r){if(r&&r.technology)seen[String(r.technology)]=true});var pref=['Solar','Wind','Gas','Nuclear','Coal','Hydro','Imports & Exports','Biomass','Storage','Pumped Storage','Other'];var vals=[];pref.forEach(function(t){if(seen[t])vals.push … [line shortened here: 656 characters; full line on GitHub]
function rowsFor(t,solar,fuel){var rows=t==='Solar'?solar:fuel.filter(function(r){return r&&String(r.technology)===t});return rows.filter(function(r){return r&&r.mwh!=null&&!isNaN(Number(r.mwh))}).map(function(r){var x=Object.assign({},r);x.technology=t;x.sourceLabel=srcLabel(t);return x})}
function setYears(rows,t){var y=get('solar-daily-mwh-year'),s=get('solar-daily-mwh-start');if(!y||!s)return;var key=t+'-'+rows.length;if(y.dataset.readyKey===key)return;var old=y.value,ys=years(rows);y.innerHTML='';ys.forEach(function(v){var o=document.createElement('option');o.value=v;o.textContent=v;y.appendChild(o)});y.value=ys.indexOf(old)>=0?old:(ys[ys.length-1]||String(new Date().getUTCFul … [line shortened here: 458 characters; full line on GitHub]
function selectedWindow(rows,t){var y=get('solar-daily-mwh-year'),s=get('solar-daily-mwh-start'),p=get('solar-daily-mwh-period');setYears(rows,t);var period=p?p.value:'12m',st=s&&s.value?s.value:((y&&y.value?y.value:String(new Date().getUTCFullYear()))+'-01-01'),start=new Date(st+'T00:00:00Z'),end;if(period==='all'){var v=rows.filter(function(r){return r&&r.date});start=new Date((v[0]?v[0].date: … [line shortened here: 593 characters; full line on GitHub]
function update(){var panel=get('solar-daily-mwh-panel'),canvas=get('solar-daily-mwh-canvas'),status=get('solar-daily-mwh-status'),techEl=get('solar-daily-mwh-technology');if(!panel||!canvas||!status||!window.V6RenderSolarDailyMwhChart)return;panel.style.display='block';Promise.all([loadSolarDaily(),loadFuelDaily()]).then(function(d){var solar=d[0]||[],fuel=d[1]||[];techOptions(fuel);var t=techE … [line shortened here: 864 characters; full line on GitHub]
function boot(){Promise.all([loadSolarDaily(),loadFuelDaily()]).then(function(d){techOptions(d[1]||[]);update()});['solar-daily-mwh-technology','solar-daily-mwh-year','solar-daily-mwh-start','solar-daily-mwh-period'].forEach(function(id){var el=get(id);if(el)el.addEventListener('change',function(){if(id==='solar-daily-mwh-year'){var s=get('solar-daily-mwh-start');if(s&&el.value)s.value=el.value+ … [line shortened here: 550 characters; full line on GitHub]
return{boot:boot,update:update};
})();
document.addEventListener('DOMContentLoaded',function(){if(window.V6ControlSolarDailyMwhChart)window.V6ControlSolarDailyMwhChart.boot()});
// Solar daily MWh fullscreen and period interaction bridge
(function(){
function get(id){return document.getElementById(id)}
function syncFullPeriod(){var p=get('solar-daily-mwh-period'),fp=get('solar-daily-mwh-fullscreen-period-select');if(p&&fp&&fp.value!==p.value)fp.value=p.value}
function setPeriod(value){var p=get('solar-daily-mwh-period');if(p)p.value=value;syncFullPeriod();if(window.V6ControlSolarDailyMwhChart)window.V6ControlSolarDailyMwhChart.update()}
function nudgePeriod(dir){var s=get('solar-daily-mwh-start'),p=get('solar-daily-mwh-period');if(!s||!p)return;var days={'30d':30,'3m':92,'6m':183,'12m':366,'5y':1827,'10y':3653}[p.value]||366;var d=s.value?new Date(s.value+'T00:00:00Z'):new Date();d=new Date(d.getTime()+dir*days*86400000);s.value=d.toISOString().slice(0,10);var y=get('solar-daily-mwh-year');if(y)y.value=String(d.getUTCFullYear() … [line shortened here: 484 characters; full line on GitHub]
function openFull(){var o=get('solar-daily-mwh-fullscreen-overlay');if(!o)return;syncFullPeriod();o.classList.add('open');document.documentElement.classList.add('v5-chart-open');document.body.classList.add('v5-chart-open');setTimeout(function(){if(window.V6RenderSolarDailyMwhChart&&window.V6RenderSolarDailyMwhChart.redrawFullscreen)window.V6RenderSolarDailyMwhChart.redrawFullscreen()},100)}
function closeFull(){var o=get('solar-daily-mwh-fullscreen-overlay');if(!o)return;o.classList.remove('open');document.documentElement.classList.remove('v5-chart-open');document.body.classList.remove('v5-chart-open')}
function bind(){var btn=get('solar-daily-mwh-fullscreen-btn'),close=get('solar-daily-mwh-fullscreen-close'),fp=get('solar-daily-mwh-fullscreen-period-select'),back=get('solar-daily-mwh-fullscreen-period-back'),forward=get('solar-daily-mwh-fullscreen-period-forward');if(btn&&!btn.dataset.bound){btn.dataset.bound='1';btn.addEventListener('click',openFull)}if(close&&!close.dataset.bound){close.data … [line shortened here: 801 characters; full line on GitHub]
document.addEventListener('DOMContentLoaded',function(){setTimeout(bind,200);setTimeout(bind,1200)});
})();Render Solar Daily MWh Chart
A JavaScript file in the generation history folder of GlobalGrid2050 that draws season (`drawSeasonKey`) and season line (`drawSeasonLine`) and updates inspect (`updateInspect`) (units: MWh), covering solar.
energy-dataglobalgrid2050 / uk_energy_tracking_v6/generation_history/render_solar_daily_mwh_chart.js · lines 1–33 of 33 · Not reached from any entry point (candidate for review) · pattern ensureInspectState (shared by 2 files)
- What it does
- It draws solar. Defines 22 functions or classes, including fmt, niceDate, dateLabel, val, tm. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path 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: solar.
- Inputs & outputs
- Out: canvas drawing.
- What it achieves
- It draws season key (`drawSeasonKey`), draws season line (`drawSeasonLine`) and updates inspect (`updateInspect`). Its name says it renders solar daily MWh chart. Defines `fmt`, `niceDate`, `dateLabel` and 17 more. It responds to click, pointerdown and pointermove events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_energy_tracking_v6/generation_history · script
- Uses
- none found
- Used by
- none found
- Produces
- fmt, niceDate, dateLabel, val, tm, rowsOf, stats, mm, step, points, seasonName, seasonColor
- Defines here
- fmt, niceDate, dateLabel, val, tm, rowsOf, stats, mm, step, points, seasonName, seasonColor, drawSeasonKey, drawSeasonLine, pointer, callout, inspectKey, nearest, ensureInspectState, updateInspect, render, redrawFullscreen
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_energy_tracking_v6/generation_history/render_solar_daily_mwh_chart.js:1-33 · blob 9c5f2dc6ae84a897ad346dda079d56756ed149fd · 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: unreached_review
window.V6RenderSolarDailyMwhChart=(function(){
var lastResult=null, inspectState={};
function fmt(n,d){return n==null||isNaN(Number(n))?'—':Number(n).toLocaleString('en-GB',{minimumFractionDigits:d,maximumFractionDigits:d})}
function niceDate(v){var d=v instanceof Date?v:new Date(String(v).replace(' ','T'));return isNaN(d.getTime())?'—':d.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}
function dateLabel(t,span){var d=new Date(t);return span>45*86400000?d.toLocaleDateString('en-GB',{month:'short',year:'numeric'}):d.toLocaleDateString('en-GB',{day:'2-digit',month:'short'})}
function val(r){return Number(r.mwh)}
function tm(r){return r.date+'T12:00:00Z'}
function rowsOf(result){return (result.rows||[]).filter(function(r){return r&&r.mwh!=null&&!isNaN(Number(r.mwh))})}
function stats(rows){var hi=null,lo=null,total=0,n=0;rows.forEach(function(r){var v=val(r);if(isNaN(v))return;total+=v;n++;if(!hi||v>val(hi))hi=r;if(!lo||v<val(lo))lo=r});return hi&&lo?{hi:hi,lo:lo,hiValue:val(hi),loValue:val(lo),hiDate:niceDate(tm(hi)),loDate:niceDate(tm(lo)),mean:total/n,total:total,range:niceDate(tm(rows[0]))+' to '+niceDate(tm(rows[rows.length-1]))}:null}
function mm(rows){var hi=1;rows.forEach(function(r){var v=val(r);if(!isNaN(v)&&v>hi)hi=v});return{lo:0,hi:hi*1.10}}
function step(span){var raw=span/5,p=Math.pow(10,Math.floor(Math.log10(Math.max(raw,1)))),n=raw/p;if(n<=1)return p;if(n<=2)return 2*p;if(n<=5)return 5*p;return 10*p}
function points(w,h,pad,scale,t0,t1){var pw=w-pad.left-pad.right,ph=h-pad.top-pad.bottom;return{X:function(r){var t=new Date(tm(r)).getTime();return pad.left+((t-t0)/(t1-t0))*pw},Y:function(v){return pad.top+((scale.hi-v)/(scale.hi-scale.lo))*ph}}}
function seasonName(t){var m=new Date(t).getUTCMonth()+1;if(m===12||m<=2)return'Winter';if(m>=3&&m<=5)return'Spring';if(m>=6&&m<=8)return'Summer';return'Autumn'}
function seasonColor(t){var s=seasonName(t);if(s==='Winter')return'#00ffff';if(s==='Spring')return'#00ff88';if(s==='Summer')return'#ffcc00';return'#c79245'}
function drawSeasonKey(g,q,pad){var items=[['Winter','#00ffff'],['Spring','#00ff88'],['Summer','#ffcc00'],['Autumn','#c79245']],x=pad.left,y=pad.top-28*q;g.save();g.font=9*q+'px Courier New';items.forEach(function(it){g.fillStyle=it[1];g.shadowColor=it[1];g.shadowBlur=4*q;g.fillRect(x,y-7*q,8*q,8*q);g.shadowBlur=0;g.fillStyle='#9aa3b6';g.fillText(it[0],x+12*q,y);x+=58*q});g.restore()}
function drawSeasonLine(g,rows,p,q){g.save();g.lineWidth=2.15*q;g.lineCap='round';g.lineJoin='round';for(var i=1;i<rows.length;i++){var a=rows[i-1],b=rows[i],col=seasonColor(tm(b));g.strokeStyle=col;g.shadowColor=col;g.shadowBlur=8*q;g.beginPath();g.moveTo(p.X(a),p.Y(val(a)));g.lineTo(p.X(b),p.Y(val(b)));g.stroke()}g.restore()}
function drawTicks(g,w,h,q,scale,pad,t0,t1){var st=step(scale.hi-scale.lo),span=t1-t0;g.save();g.font=(w/q<520?9:11)*q+'px Courier New';for(var v=0;v<=scale.hi+st*.5;v+=st){var y=pad.top+((scale.hi-v)/(scale.hi-scale.lo))*(h-pad.top-pad.bottom);g.fillStyle='#d8deeb';g.textAlign='left';g.fillText(fmt(v,0)+' MWh',8*q,y+4*q);g.strokeStyle='rgba(255,255,255,.055)';g.beginPath();g.moveTo(pad.left,y); … [line shortened here: 757 characters; full line on GitHub]
function eventBox(g,lines,q,x,y,align){var pad=8*q,lh=17*q,wid=0;g.save();g.font='900 '+13*q+'px Courier New';lines.forEach(function(t){wid=Math.max(wid,g.measureText(t).width)});var bh=lines.length*lh+pad*2,xx=align==='right'?x-wid-pad*2:x;g.fillStyle='rgba(5,7,12,.84)';g.strokeStyle='rgba(0,255,255,.45)';g.beginPath();g.roundRect(xx,y-bh+4*q,wid+pad*2,bh,6*q);g.fill();g.stroke();g.fillStyle='# … [line shortened here: 508 characters; full line on GitHub]
function pointer(g,point,q,x,y){g.save();g.strokeStyle='#ff3333';g.shadowColor='rgba(0,255,255,.55)';g.shadowBlur=7*q;g.setLineDash([]);g.beginPath();g.moveTo(point.x,point.y);g.lineTo(x,y-24*q);g.stroke();g.restore()}
function callout(g,label,value,date,x,y,q,w,h,pad){var right=x>w/2,tx=right?Math.max(pad.left+160*q,x-18*q):Math.min(w-pad.right-160*q,x+18*q),ty=label==='HIGH'?Math.max(pad.top+54*q,y-24*q):Math.min(h-pad.bottom-28*q,y+54*q);pointer(g,{x:x,y:y},q,tx,ty);eventBox(g,[label,fmt(value,1)+' MWh',date],q,tx,ty,right?'right':'left')}
function drawSummary(g,s,q,w,h,pad,isFull){if(isFull&&w/q>h/q)return;var mobile=w/q<620,x=pad.left,bw=w-pad.left-pad.right,y=h-(mobile?116:72)*q,rows=mobile?2:1,cols=mobile?2:4,cellH=mobile?46*q:52*q,col=bw/cols;g.save();g.fillStyle='rgba(5,7,12,.92)';g.strokeStyle='rgba(0,255,255,.42)';g.beginPath();g.roundRect(x,y,bw,rows*cellH,9*q);g.fill();g.stroke();function cell(i,l,v,sub,c){var r=mobile?M … [line shortened here: 1,006 characters; full line on GitHub]
function inspectKey(result){return [result.start&&result.start.toISOString?result.start.toISOString():String(result.start),result.end&&result.end.toISOString?result.end.toISOString():String(result.end),(result.rows||[]).length].join('|')}
function nearest(rows,target){var best=0,bestD=Infinity;for(var i=0;i<rows.length;i++){var d=Math.abs(new Date(tm(rows[i])).getTime()-target);if(d<bestD){bestD=d;best=i}}return best}
function ensureInspectState(canvasId,result,rows){var key=inspectKey(result),st=inspectState[canvasId]||{};if(st.key!==key){st={key:key,index:0,moved:false};if(rows.length){var s=stats(rows);st.index=rows.indexOf(s.hi)}inspectState[canvasId]=st}return st}
function ensureInspectControls(canvasId,result){var c=document.getElementById(canvasId);if(!c||c.dataset.solarInspectControls==='1')return;c.dataset.solarInspectControls='1';var bar=document.createElement('div');bar.id=canvasId+'-inspect-controls';bar.className='solar-mwh-inspect-controls';var prev=document.createElement('button');prev.type='button';prev.textContent='◀ previous day';prev.classNa … [line shortened here: 1,187 characters; full line on GitHub]
function updateInspect(canvasId,result,row,idx,total){var bar=document.getElementById(canvasId+'-inspect-controls'),out=document.getElementById(canvasId+'-inspect-readout');if(!bar)return;bar.style.display='flex';if(out&&row)out.textContent=niceDate(tm(row))+' | '+fmt(val(row),1)+' MWh | point '+(idx+1)+' of '+total.toLocaleString('en-GB')}
function attachInspectEvents(canvasId){var c=document.getElementById(canvasId);if(!c||c.dataset.solarInspectEvents==='1')return;c.dataset.solarInspectEvents='1';function move(ev){if(!lastResult)return;var st=inspectState[canvasId];if(!st||!st.geom)return;var rect=c.getBoundingClientRect(),q=window.devicePixelRatio||1,x=(ev.clientX-rect.left)*q,geo=st.geom;if(x<geo.pad.left||x>geo.w-geo.pad.right … [line shortened here: 841 characters; full line on GitHub]
function drawInspect(g,result,rows,q,w,h,pad,p,canvasId){var st=ensureInspectState(canvasId,result,rows);st.geom={pad:pad,w:w,h:h,t0:result.start.getTime(),t1:result.end.getTime()};if(!st.moved){updateInspect(canvasId,result,null,0,rows.length);return}var idx=Math.max(0,Math.min(rows.length-1,st.index)),r=rows[idx],x=p.X(r),y=p.Y(val(r));g.save();g.strokeStyle='rgba(0,255,255,.72)';g.lineWidth=1 … [line shortened here: 990 characters; full line on GitHub]
function renderTo(canvasId,result){var canvas=document.getElementById(canvasId);if(!canvas)return;lastResult=result;ensureInspectControls(canvasId,result);attachInspectEvents(canvasId);var rows=rowsOf(result),ctx=canvas.getContext('2d'),box=canvas.getBoundingClientRect(),q=window.devicePixelRatio||1,isFull=canvasId==='solar-daily-mwh-fullscreen-canvas',cssW=Math.max(320,Math.floor(box.width||can … [line shortened here: 1,902 characters; full line on GitHub]
function render(canvas,result){if(!canvas||!canvas.id)return;renderTo(canvas.id,result)}
function redrawFullscreen(result){if(result)renderTo('solar-daily-mwh-fullscreen-canvas',result);else if(lastResult)renderTo('solar-daily-mwh-fullscreen-canvas',lastResult)}
return{render:render,redrawFullscreen:redrawFullscreen};
})();Control Solar Daily MWh Chart
A JavaScript file in the generation history folder of GlobalGrid2050 that syncs full period (`syncFullPeriod`), sets period (`setPeriod`) and opens full (`openFull`) (units: MWh), covering pvlive solar daily browser.
energy-dataglobalgrid2050 / uk_energy_tracking_v6_2/generation_history/control_solar_daily_mwh_chart.js · lines 1–27 of 27 · Not reached from any entry point (candidate for review) · pattern syncFullPeriod (shared by 2 files)
- What it does
- It draws pvlive solar daily browser. Defines 11 functions or classes, including cfg, get, loadSolarDaily, periodDays, niceDate. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Inputs & outputs
- In: JSON file pvlive_solar_daily_browser.json.
- What it achieves
- It loads solar daily (`loadSolarDaily`), syncs full period (`syncFullPeriod`) and sets period (`setPeriod`). Defines `cfg`, `get`, `loadSolarDaily` and 8 more. It responds to change, resize and DOMContentLoaded events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_energy_tracking_v6_2/generation_history · script
- Uses
- none found
- Used by
- none found
- Produces
- cfg, get, loadSolarDaily, periodDays, niceDate, years, get, syncFullPeriod, setPeriod, openFull, closeFull
- Defines here
- cfg, get, loadSolarDaily, periodDays, niceDate, years, get, syncFullPeriod, setPeriod, openFull, closeFull
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_energy_tracking_v6_2/generation_history/control_solar_daily_mwh_chart.js:1-27 · blob 80327c1a353d91e1f2ec4d588f3c2a52a2c853dc · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: unreached_review
window.V6ControlSolarDailyMwhChart=(function(){
var cache=null;
function cfg(){return window.V6GenerationHistoryConfig||{}}
function get(id){return document.getElementById(id)}
function loadSolarDaily(){if(cache)return cache;var url=cfg().solarDaily||'/uk_energy_tracking_v6_2/generation_history/pvlive_solar_daily_browser.json';cache=fetch(url+'?t='+Date.now(),{cache:'no-store'}).then(function(r){return r.ok?r.json():{rows:[]}}).then(function(d){return d.rows||[]}).catch(function(){return[]});return cache}
function periodDays(p){return{'30d':30,'3m':92,'6m':183,'12m':366,'5y':1827,'10y':3653}[p]||366}
function niceDate(v){var d=v instanceof Date?v:new Date(String(v));return isNaN(d.getTime())?'—':d.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}
function years(rows){var out={};rows.forEach(function(r){if(r&&r.date)out[String(r.date).slice(0,4)]=true});return Object.keys(out).sort()}
function setDefaultControls(rows){var yEl=get('solar-daily-mwh-year'),sEl=get('solar-daily-mwh-start');if(!yEl||!sEl||yEl.dataset.ready==='1')return;var ys=years(rows);yEl.innerHTML='';ys.forEach(function(y){var o=document.createElement('option');o.value=y;o.textContent=y;yEl.appendChild(o)});var latest=ys[ys.length-1]||String(new Date().getUTCFullYear());yEl.value=latest;sEl.value=latest+'-01-0 … [line shortened here: 425 characters; full line on GitHub]
function selectedWindow(rows){var yEl=get('solar-daily-mwh-year'),sEl=get('solar-daily-mwh-start'),pEl=get('solar-daily-mwh-period');setDefaultControls(rows);var period=pEl?pEl.value:'12m';var startText=sEl&&sEl.value?sEl.value:((yEl&&yEl.value?yEl.value:String(new Date().getUTCFullYear()))+'-01-01');var start=new Date(startText+'T00:00:00Z');var end;if(period==='all'){var valid=rows.filter(func … [line shortened here: 689 characters; full line on GitHub]
function update(){var panel=get('solar-daily-mwh-panel'),canvas=get('solar-daily-mwh-canvas'),status=get('solar-daily-mwh-status'),techEl=get('solar-daily-mwh-technology');if(!panel||!canvas||!status||!window.V6RenderSolarDailyMwhChart)return;var tech=techEl?techEl.value:'Solar';panel.style.display='block';if(tech!=='Solar'){status.textContent='Only Solar is enabled until other daily MWh data is … [line shortened here: 911 characters; full line on GitHub]
function boot(){loadSolarDaily().then(function(rows){setDefaultControls(rows);update()});['solar-daily-mwh-technology','solar-daily-mwh-year','solar-daily-mwh-start','solar-daily-mwh-period'].forEach(function(id){var el=get(id);if(el)el.addEventListener('change',function(){if(id==='solar-daily-mwh-year'){var s=get('solar-daily-mwh-start');if(s&&el.value)s.value=el.value+'-01-01'}setTimeout(updat … [line shortened here: 525 characters; full line on GitHub]
return{boot:boot,update:update};
})();
document.addEventListener('DOMContentLoaded',function(){if(window.V6ControlSolarDailyMwhChart)window.V6ControlSolarDailyMwhChart.boot()});
// Solar daily MWh fullscreen and period interaction bridge
(function(){
function get(id){return document.getElementById(id)}
function syncFullPeriod(){var p=get('solar-daily-mwh-period'),fp=get('solar-daily-mwh-fullscreen-period-select');if(p&&fp&&fp.value!==p.value)fp.value=p.value}
function setPeriod(value){var p=get('solar-daily-mwh-period');if(p)p.value=value;syncFullPeriod();if(window.V6ControlSolarDailyMwhChart)window.V6ControlSolarDailyMwhChart.update()}
function nudgePeriod(dir){var s=get('solar-daily-mwh-start'),p=get('solar-daily-mwh-period');if(!s||!p)return;var days={'30d':30,'3m':92,'6m':183,'12m':366,'5y':1827,'10y':3653}[p.value]||366;var d=s.value?new Date(s.value+'T00:00:00Z'):new Date();d=new Date(d.getTime()+dir*days*86400000);s.value=d.toISOString().slice(0,10);var y=get('solar-daily-mwh-year');if(y)y.value=String(d.getUTCFullYear() … [line shortened here: 484 characters; full line on GitHub]
function openFull(){var o=get('solar-daily-mwh-fullscreen-overlay');if(!o)return;syncFullPeriod();o.classList.add('open');document.documentElement.classList.add('v5-chart-open');document.body.classList.add('v5-chart-open');setTimeout(function(){if(window.V6RenderSolarDailyMwhChart&&window.V6RenderSolarDailyMwhChart.redrawFullscreen)window.V6RenderSolarDailyMwhChart.redrawFullscreen()},100)}
function closeFull(){var o=get('solar-daily-mwh-fullscreen-overlay');if(!o)return;o.classList.remove('open');document.documentElement.classList.remove('v5-chart-open');document.body.classList.remove('v5-chart-open')}
function bind(){var btn=get('solar-daily-mwh-fullscreen-btn'),close=get('solar-daily-mwh-fullscreen-close'),fp=get('solar-daily-mwh-fullscreen-period-select'),back=get('solar-daily-mwh-fullscreen-period-back'),forward=get('solar-daily-mwh-fullscreen-period-forward');if(btn&&!btn.dataset.bound){btn.dataset.bound='1';btn.addEventListener('click',openFull)}if(close&&!close.dataset.bound){close.data … [line shortened here: 801 characters; full line on GitHub]
document.addEventListener('DOMContentLoaded',function(){setTimeout(bind,200);setTimeout(bind,1200)});
})();Render Solar Daily MWh Chart
A JavaScript file in the generation history folder of GlobalGrid2050 that updates inspect (`updateInspect`) and draws on a canvas (units: MWh), covering solar.
energy-dataglobalgrid2050 / uk_energy_tracking_v6_2/generation_history/render_solar_daily_mwh_chart.js · lines 1–29 of 29 · Not reached from any entry point (candidate for review) · pattern ensureInspectState (shared by 2 files)
- What it does
- It draws solar. Defines 18 functions or classes, including fmt, niceDate, dateLabel, val, tm. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path 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: solar.
- Inputs & outputs
- Out: canvas drawing.
- What it achieves
- It updates inspect (`updateInspect`) and is built from the nice date helper (`niceDate`) and the date label helper (`dateLabel`). Its name says it renders solar daily MWh chart. Defines `fmt`, `niceDate`, `dateLabel` and 13 more. It responds to click, pointerdown and pointermove events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_energy_tracking_v6_2/generation_history · script
- Uses
- none found
- Used by
- none found
- Produces
- fmt, niceDate, dateLabel, val, tm, rowsOf, stats, mm, step, points, pointer, callout
- Defines here
- fmt, niceDate, dateLabel, val, tm, rowsOf, stats, mm, step, points, pointer, callout, inspectKey, nearest, ensureInspectState, updateInspect, render, redrawFullscreen
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_energy_tracking_v6_2/generation_history/render_solar_daily_mwh_chart.js:1-29 · blob 9694719f211c4bd062ed1160dd5375c588ecd5ef · 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: unreached_review
window.V6RenderSolarDailyMwhChart=(function(){
var lastResult=null, inspectState={};
function fmt(n,d){return n==null||isNaN(Number(n))?'—':Number(n).toLocaleString('en-GB',{minimumFractionDigits:d,maximumFractionDigits:d})}
function niceDate(v){var d=v instanceof Date?v:new Date(String(v).replace(' ','T'));return isNaN(d.getTime())?'—':d.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}
function dateLabel(t,span){var d=new Date(t);return span>45*86400000?d.toLocaleDateString('en-GB',{month:'short',year:'numeric'}):d.toLocaleDateString('en-GB',{day:'2-digit',month:'short'})}
function val(r){return Number(r.mwh)}
function tm(r){return r.date+'T12:00:00Z'}
function rowsOf(result){return (result.rows||[]).filter(function(r){return r&&r.mwh!=null&&!isNaN(Number(r.mwh))})}
function stats(rows){var hi=null,lo=null,total=0,n=0;rows.forEach(function(r){var v=val(r);if(isNaN(v))return;total+=v;n++;if(!hi||v>val(hi))hi=r;if(!lo||v<val(lo))lo=r});return hi&&lo?{hi:hi,lo:lo,hiValue:val(hi),loValue:val(lo),hiDate:niceDate(tm(hi)),loDate:niceDate(tm(lo)),mean:total/n,total:total,range:niceDate(tm(rows[0]))+' to '+niceDate(tm(rows[rows.length-1]))}:null}
function mm(rows){var hi=1;rows.forEach(function(r){var v=val(r);if(!isNaN(v)&&v>hi)hi=v});return{lo:0,hi:hi*1.10}}
function step(span){var raw=span/5,p=Math.pow(10,Math.floor(Math.log10(Math.max(raw,1)))),n=raw/p;if(n<=1)return p;if(n<=2)return 2*p;if(n<=5)return 5*p;return 10*p}
function points(w,h,pad,scale,t0,t1){var pw=w-pad.left-pad.right,ph=h-pad.top-pad.bottom;return{X:function(r){var t=new Date(tm(r)).getTime();return pad.left+((t-t0)/(t1-t0))*pw},Y:function(v){return pad.top+((scale.hi-v)/(scale.hi-scale.lo))*ph}}}
function drawTicks(g,w,h,q,scale,pad,t0,t1){var st=step(scale.hi-scale.lo),span=t1-t0;g.save();g.font=(w/q<520?9:11)*q+'px Courier New';for(var v=0;v<=scale.hi+st*.5;v+=st){var y=pad.top+((scale.hi-v)/(scale.hi-scale.lo))*(h-pad.top-pad.bottom);g.fillStyle='#d8deeb';g.textAlign='left';g.fillText(fmt(v,0)+' MWh',8*q,y+4*q);g.strokeStyle='rgba(255,255,255,.055)';g.beginPath();g.moveTo(pad.left,y); … [line shortened here: 757 characters; full line on GitHub]
function eventBox(g,lines,q,x,y,align){var pad=8*q,lh=17*q,wid=0;g.save();g.font='900 '+13*q+'px Courier New';lines.forEach(function(t){wid=Math.max(wid,g.measureText(t).width)});var bh=lines.length*lh+pad*2,xx=align==='right'?x-wid-pad*2:x;g.fillStyle='rgba(5,7,12,.84)';g.strokeStyle='rgba(0,255,255,.45)';g.beginPath();g.roundRect(xx,y-bh+4*q,wid+pad*2,bh,6*q);g.fill();g.stroke();g.fillStyle='# … [line shortened here: 508 characters; full line on GitHub]
function pointer(g,point,q,x,y){g.save();g.strokeStyle='#ff3333';g.shadowColor='rgba(0,255,255,.55)';g.shadowBlur=7*q;g.setLineDash([]);g.beginPath();g.moveTo(point.x,point.y);g.lineTo(x,y-24*q);g.stroke();g.restore()}
function callout(g,label,value,date,x,y,q,w,h,pad){var right=x>w/2,tx=right?Math.max(pad.left+160*q,x-18*q):Math.min(w-pad.right-160*q,x+18*q),ty=label==='HIGH'?Math.max(pad.top+54*q,y-24*q):Math.min(h-pad.bottom-28*q,y+54*q);pointer(g,{x:x,y:y},q,tx,ty);eventBox(g,[label,fmt(value,1)+' MWh',date],q,tx,ty,right?'right':'left')}
function drawSummary(g,s,q,w,h,pad,isFull){if(isFull&&w/q>h/q)return;var mobile=w/q<620,x=pad.left,bw=w-pad.left-pad.right,y=h-(mobile?116:72)*q,rows=mobile?2:1,cols=mobile?2:4,cellH=mobile?46*q:52*q,col=bw/cols;g.save();g.fillStyle='rgba(5,7,12,.92)';g.strokeStyle='rgba(0,255,255,.42)';g.beginPath();g.roundRect(x,y,bw,rows*cellH,9*q);g.fill();g.stroke();function cell(i,l,v,sub,c){var r=mobile?M … [line shortened here: 1,006 characters; full line on GitHub]
function inspectKey(result){return [result.start&&result.start.toISOString?result.start.toISOString():String(result.start),result.end&&result.end.toISOString?result.end.toISOString():String(result.end),(result.rows||[]).length].join('|')}
function nearest(rows,target){var best=0,bestD=Infinity;for(var i=0;i<rows.length;i++){var d=Math.abs(new Date(tm(rows[i])).getTime()-target);if(d<bestD){bestD=d;best=i}}return best}
function ensureInspectState(canvasId,result,rows){var key=inspectKey(result),st=inspectState[canvasId]||{};if(st.key!==key){st={key:key,index:0,moved:false};if(rows.length){var s=stats(rows);st.index=rows.indexOf(s.hi)}inspectState[canvasId]=st}return st}
function ensureInspectControls(canvasId,result){var c=document.getElementById(canvasId);if(!c||c.dataset.solarInspectControls==='1')return;c.dataset.solarInspectControls='1';var bar=document.createElement('div');bar.id=canvasId+'-inspect-controls';bar.className='solar-mwh-inspect-controls';var prev=document.createElement('button');prev.type='button';prev.textContent='◀ previous day';prev.classNa … [line shortened here: 1,187 characters; full line on GitHub]
function updateInspect(canvasId,result,row,idx,total){var bar=document.getElementById(canvasId+'-inspect-controls'),out=document.getElementById(canvasId+'-inspect-readout');if(!bar)return;bar.style.display='flex';if(out&&row)out.textContent=niceDate(tm(row))+' | '+fmt(val(row),1)+' MWh | point '+(idx+1)+' of '+total.toLocaleString('en-GB')}
function attachInspectEvents(canvasId){var c=document.getElementById(canvasId);if(!c||c.dataset.solarInspectEvents==='1')return;c.dataset.solarInspectEvents='1';function move(ev){if(!lastResult)return;var st=inspectState[canvasId];if(!st||!st.geom)return;var rect=c.getBoundingClientRect(),q=window.devicePixelRatio||1,x=(ev.clientX-rect.left)*q,geo=st.geom;if(x<geo.pad.left||x>geo.w-geo.pad.right … [line shortened here: 841 characters; full line on GitHub]
function drawInspect(g,result,rows,q,w,h,pad,p,canvasId){var st=ensureInspectState(canvasId,result,rows);st.geom={pad:pad,w:w,h:h,t0:result.start.getTime(),t1:result.end.getTime()};if(!st.moved){updateInspect(canvasId,result,null,0,rows.length);return}var idx=Math.max(0,Math.min(rows.length-1,st.index)),r=rows[idx],x=p.X(r),y=p.Y(val(r));g.save();g.strokeStyle='rgba(0,255,255,.72)';g.lineWidth=1 … [line shortened here: 990 characters; full line on GitHub]
function renderTo(canvasId,result){var canvas=document.getElementById(canvasId);if(!canvas)return;lastResult=result;ensureInspectControls(canvasId,result);attachInspectEvents(canvasId);var rows=rowsOf(result),ctx=canvas.getContext('2d'),box=canvas.getBoundingClientRect(),q=window.devicePixelRatio||1,isFull=canvasId==='solar-daily-mwh-fullscreen-canvas',cssW=Math.max(320,Math.floor(box.width||can … [line shortened here: 2,000 characters; full line on GitHub]
function render(canvas,result){if(!canvas||!canvas.id)return;renderTo(canvas.id,result)}
function redrawFullscreen(result){if(result)renderTo('solar-daily-mwh-fullscreen-canvas',result);else if(lastResult)renderTo('solar-daily-mwh-fullscreen-canvas',lastResult)}
return{render:render,redrawFullscreen:redrawFullscreen};
})();Check Solar1000 V924
A JavaScript module in the tests folder of GlobalGrid2050.
testglobalgrid2050 / uk_renewables_pipeline/202611161630/tests/check_solar1000_v924.mjs · lines 1–20 of 20 · version 2026-11-16 16:30 · Not reached from any entry point (candidate for review)
- What it does
- It tests its inputs. Uses libraries node:assert/strict, node:fs/promises. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
- Inputs & outputs
- In: JSON file candidates.json.
- What it achieves
- Its name says it checks Solar1000. It reads `../solar1000/manifest.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611161630/tests · JavaScript module
- Uses
- GlobalGrid2050 — UK Renewables Pipeline Page (new URL import.meta.url), node:assert/strict, node:fs/promises
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611161630/tests/check_solar1000_v924.mjs:1-20 · blob 3dcc981f673eea98b2b9cd5539d5d823b01b7709 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
const manifest=JSON.parse(await readFile(new URL('../solar1000/manifest.json',import.meta.url)));
const candidates=JSON.parse(await readFile(new URL('../solar1000/candidates.json',import.meta.url)));
assert.equal(manifest.record_count,7775);
assert.equal(manifest.solar_count,3604);
assert.equal(manifest.selection,'numeric-repd-ref-ascending');
assert.equal(manifest.ids.length,1000);
assert.equal(new Set(manifest.ids).size,1000);
assert.equal(manifest.ids[0],'1018');assert.equal(manifest.ids.at(-1),'2325');
assert.equal(candidates.length,2);assert.equal(manifest.independently_verified,0);
assert.equal(manifest.not_researched,998);
assert.ok(manifest.ids.every((id,i,a)=>i===0||+id>+a[i-1]));
assert.deepEqual(candidates.map(c=>c.repd_ref),['1019','1020']);
assert.ok(candidates.every(c=>c.rights_basis==='unknown'&&c.verification==='provisional_candidate_only'));
const html=await readFile(new URL('../index.html',import.meta.url),'utf8');
assert.match(html,/id="evidenceCoverage"/);
assert.ok(!html.includes('id="solar1000Pilot"'), 'Evidence is integrated in project details, not a second project list');
assert.match(html,/solar1000-v924.js/);
console.log('V9.24 Solar-1000 membership and provisional evidence: PASS');Solar1000 V924
A JavaScript module in the plugins folder of GlobalGrid2050 that attaches evidence (`attachEvidence`) and refreshes evidence (`refreshEvidence`), covering the Renewable Energy Planning Database (REPD) register and solar.
renderglobalgrid2050 / uk_renewables_pipeline/202611201709/scripts/plugins/solar1000-v924.js · lines 1–73 of 73 · version 2026-11-20 17:09 · Entry point
- What it does
- It draws the REPD register and solar. Defines attachEvidence, refreshEvidence, start. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register, solar.
- Inputs & outputs
- In: JSON file candidates.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 — UK Renewables Pipeline Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/202611280922/). Reached from 4 other entry points, including GlobalGrid2050 Pipeline Legal Evidence Workflow (globalgrid2050); V923 Public Readback Workflow (neural-link-between-agents); A4 Legal Model (globalgrid2050).
- What it achieves
- It attaches evidence (`attachEvidence`) and refreshes evidence (`refreshEvidence`). V9.25 keeps the V9.24 selection, adding evidence to existing UK records. It reads `solar1000/manifest.json`. It responds to pipeline events.
- Why it matters
- Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611201709/scripts/plugins · JavaScript module
- Uses
- Evidence V925 (import), Canonical Projects V9 5 1 (import)
- Used by
- loaded by GlobalGrid2050 — UK Renewables Pipeline Page (script src)
- Produces
- attachEvidence, refreshEvidence, start
- Defines here
- attachEvidence, refreshEvidence, start
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611201709/scripts/plugins/solar1000-v924.js:1-73 · blob dae14d6e557ab237173736053e505f0b4aabf478 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
// V9.25 keeps the V9.24 selection, adding evidence to existing UK records.
// It does not create another project list or change official filters/exports.
import {loadEvidence, renderEvidence} from './evidence-v925.js';
import {loadCanonicalProjectsV9_5_1} from '../data/canonical-projects-v9-5-1.js';
const coverage = document.getElementById('evidenceCoverage');
const selection = coverage?.querySelector('[data-evidence-selection]');
const status = coverage?.querySelector('[data-evidence-status]');
const state = {loading:true,data:null};
let projects = new Map(), candidates = new Map();
function attachEvidence() {
for (const row of document.querySelectorAll('#tbody > tr[id^="repd-"]')) {
const id = row.id.slice(5), project = projects.get(id);
const details = row.querySelector('.project-record');
if (!project || !details || details.querySelector('[data-integrated-evidence]')) continue;
// Preserve the renderer-owned project name and status (mobile summary).
const desktopLabel = details.querySelector('summary .desktop-details-label');
if (desktopLabel) desktopLabel.textContent = 'PROJECT RECORD · SOURCES';
const host = document.createElement('div');
host.dataset.integratedEvidence = id;
details.appendChild(host);
renderEvidence(host,project,state);
const inherited = candidates.get(id);
if (inherited) {
const note = document.createElement('p');
note.className = 'v925-inherited-source';
note.textContent = 'Inherited V9.24 source candidate - unverified. ';
const url = new URL(inherited.source_url);
if (url.protocol === 'https:' && !url.username && !url.password) {
const link = document.createElement('a');
link.href = url.href;link.target = '_blank';link.rel = 'noopener noreferrer';
link.textContent = inherited.publisher;
note.appendChild(link);
}
host.appendChild(note);
}
}
}
function refreshEvidence() {
document.querySelectorAll('[data-integrated-evidence]').forEach(node=>node.remove());
attachEvidence();
}
async function start() {
if (!coverage) return;
try {
const [manifest,inherited,model] = await Promise.all([
fetch('solar1000/manifest.json').then(r=>{if(!r.ok)throw Error('Manifest unavailable');return r.json();}),
fetch('solar1000/candidates.json').then(r=>{if(!r.ok)throw Error('Inherited candidates unavailable');return r.json();}),
loadCanonicalProjectsV9_5_1()
]);
const ids = manifest.ids.map(String);
if (ids.length!==1000 || new Set(ids).size!==1000 || manifest.selection!=='numeric-repd-ref-ascending' || ids.some((id,i)=>i&&Number(id)<=Number(ids[i-1]))) throw Error('Invalid pinned selection');
const byId = new Map(model.projects.map(p=>[String(p.repd_ref),p]));
projects = new Map(ids.map(id=>[id,byId.get(id)]));
if ([...projects.values()].some(p=>!p||p.technology!=='solar') || model.projects.length!==7775 || inherited.length!==2 || manifest.independently_verified!==0) throw Error('Invalid source identities');
candidates = new Map(inherited.map(c=>[String(c.repd_ref),c]));
coverage.dataset.selectionCount = String(projects.size);
selection.textContent = '1,000 selected of 3,604 solar projects; exact V9.24 membership retained. Evidence is shown inside project record details.';
window.addEventListener('pipeline-projects-rendered',attachEvidence);
attachEvidence();
try {
state.data = await loadEvidence(coverage.dataset.evidencePointer,ids);
status.textContent = 'Evidence snapshot '+state.data.generatedAt+' / '+state.data.count+' provisional matches / 0 verified events / '+state.data.freshnessLabel;
} catch {
status.textContent = 'Evidence unavailable - no validated snapshot is available. Manual review required.';
}
state.loading = false;
refreshEvidence();
} catch {
selection.textContent = 'Evidence selection unavailable. The official UK register remains available.';
status.textContent = 'Evidence unavailable - source identity checks failed. Manual review required.';
}
}
start();Inverter 48 Electrical UI
A JavaScript module in the wiring folder of GlobalGrid2050 that saves field, covering inverter electrical scenario and cables, using IEC 60228 and IEC 62548. Served with the page at https://globalgrid2050.com/ventus/wiring/.
electricalglobalgrid2050 / ventus/wiring/inverter-48-electrical-ui.mjs · lines 1–56 of 56
- What it does
- It draws inverter electrical scenario and cables. Defines 8 functions or classes, including fmt, mountElectrical, $, effective, sync. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'inverter'): 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, 1500V.
- Inputs & outputs
- In: form fields (user input). Out: JSON file inverter-48-electrical-scenario.json; downloaded file inverter-48-electrical-scenario.json. Voltage levels named: 1500V.
- Downstream impact
- Used directly by 1 file: Inverter 48 (globalgrid2050, https://globalgrid2050.com/ventus/wiring/). Reached from 1 other entry point, including GlobalGrid2050 Inverter Flow Check Workflow (globalgrid2050).
- What it achieves
- It saves field (`saveField`) and is built from the mount electrical helper (`mountElectrical`) and the sync step (`sync`). Defines `fmt`, `mountElectrical`, `effective` and 4 more. It responds to input events.
- Why it matters
- Imported by Inverter 48.
- Application
- globalgrid2050 · ventus/wiring · JavaScript module
- Uses
- Inverter 48 Electrical (import)
- Used by
- imported by Inverter 48 (import)
- Produces
- mountElectrical, mount
- Defines here
- fmt, mountElectrical, $, effective, sync, saveField, rows, update
- 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/inverter-48-electrical-ui.mjs:1-56 · blob 4fdf2447b8ab0ac58522438511fcb56316b2b7f1 · 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
import {calculateElectrical,emptyElectricalState,electricalBasis,conductorReference} from './inverter-48-electrical.mjs';
const fmt=(n,d=2)=>n===null||n===undefined?'—':Number(n).toFixed(d);
const cableFields=[['r20','R20 · Ω/km'],['temperature','Conductor · °C'],['alpha','α20 · 1/K'],['baseAmpacity','Base ampacity · A'],['temperatureFactor','Temperature factor'],['groupingFactor','Grouping factor'],['otherFactor','Other factor'],['size','Conductor · mm²'],['conductorClass','Conductor class'],['coating','Coating / material'],['ratingSource','Rating / resistance evidence'],['installati … [line shortened here: 438 characters; full line on GitHub]
const stringFields=[['current','Operating current · A'],['voltage','String source voltage · V'],['designCurrent','Design current · A'],['seriesCopperOhm','All series-lead copper · Ω at temperature']];
export function mountElectrical(container,{getModel,getCableLength=h=>h.routeM,onChange=()=>{}}) {
let state=emptyElectricalState(),report,scope='all',stringScope='all';
container.classList.add('electrical-hud');
container.innerHTML=`<details class="electrical-panel"><summary>DC ANALYSIS <span data-total>INPUTS REQUIRED</span></summary><div class="electrical-body"><p class="electrical-note">Entered scenarios · 48 home cables · 24 complete string loops. Blank values stay unresolved. Expand controls to type values.</p><div data-stats class="electrical-stats"></div><details><summary>Current & string cir … [line shortened here: 3,454 characters; full line on GitHub]
const $=key=>container.querySelector(`[data-${key}]`),inputs={};
for(const [key,label]of cableFields.concat(stringFields)) {
const l=document.createElement('label');l.textContent=label;const input=document.createElement('input');input.dataset.field=key;
input.type=['conductorClass','coating','ratingSource','installation'].includes(key)?'text':'number';if(input.type==='number')input.step='any';
input.placeholder='Enter value';l.append(input);$(cableFields.some(f=>f[0]===key)?'cable-fields':'string-fields').append(l);inputs[key]=input;
input.addEventListener('input',()=>{const cable=cableFields.some(f=>f[0]===key),target=cable?scope:stringScope;const dest=target==='all'?state.defaults:(cable?(state.overrides[target]??={}):(state.stringOverrides[target]??={}));dest[key]=input.value;state.basis='entered scenario';update();});
}
for(const home of getModel().homes)$('cable-scope').add(new Option(home.id,home.id));
for(const s of getModel().strings.filter(s=>s.connected))$('string-scope').add(new Option(s.id,s.id));
const referenceButton=document.createElement('button');referenceButton.type='button';referenceButton.textContent='Use cable 6 mm² reference';
$('cable-fields').before(referenceButton);
const referenceLink=document.createElement('a');referenceLink.href=conductorReference.url;referenceLink.target='_blank';referenceLink.rel='noreferrer';referenceLink.textContent='Generic reference assumptions';referenceButton.after(referenceLink);
const referenceNote=document.createElement('p');referenceNote.className='electrical-note';referenceNote.textContent='cable DC copper cable: class 5 tinned copper, 1500 V DC. The 6 mm² preset uses EN 50618:2014 Table A.3: 57 A, two loaded cables touching on a surface, 60°C ambient, 120°C conductor limit. Temperature factor 1 applies up to 60°C ambient; use 0.92 at 70°C, 0.84 at 80°C or 0.75 at 90 … [line shortened here: 587 characters; full line on GitHub]
referenceButton.onclick=()=>{const selected=scope==='all'?state.defaults:(state.overrides[scope]??={});Object.assign(selected,conductorReference.sizes[1],{alpha:conductorReference.alpha,conductorClass:conductorReference.conductorClass,coating:conductorReference.coating,ratingSource:conductorReference.title+' pp. 1–2; '+conductorReference.url+'; BS EN 50618:2014 Tables A.3/A.4 for ampacity',insta … [line shortened here: 481 characters; full line on GitHub]
for(const key of ['method','resistance','standard','scope'])$(key).textContent=electricalBasis[key];
for(const e of electricalBasis.missingEvidence){const li=document.createElement('li');li.textContent=e;$('evidence').append(li);}
function effective(cable) {const selected=cable?scope:stringScope;return {...state.defaults,...(selected==='all'?{}:(cable?state.overrides[selected]:state.stringOverrides[selected])||{})};}
function sync() {
const c=effective(true),s=effective(false);
for(const [key]of cableFields)inputs[key].value=c[key]??'';
for(const [key]of stringFields)inputs[key].value=s[key]??'';
$('home-contacts').value=c.homeContacts??'';$('series').value=s.seriesContacts??'';
$('clear-cable').disabled=scope==='all';$('clear-string').disabled=stringScope==='all';
}
function saveField(cable,key,value){const selected=cable?scope:stringScope;const target=selected==='all'?state.defaults:(cable?(state.overrides[selected]??={}):(state.stringOverrides[selected]??={}));target[key]=value;update();}
$('cable-scope').onchange=e=>{scope=e.target.value;sync();};$('string-scope').onchange=e=>{stringScope=e.target.value;sync();};
$('home-contacts').oninput=e=>saveField(true,'homeContacts',e.target.value);$('series').oninput=e=>saveField(false,'seriesContacts',e.target.value);
$('fill-series').onclick=()=>{const value=$('series-uniform').value;if(value===''||!Number.isFinite(Number(value))||Number(value)<0){$('error').textContent='Enter a non-negative mΩ value for each series mated pair.';return;}saveField(false,'seriesContacts',Array(29).fill(value).join(', '));sync();};
$('clear-cable').onclick=()=>{if(scope!=='all')delete state.overrides[scope];sync();update();};
$('clear-string').onclick=()=>{if(stringScope!=='all')delete state.stringOverrides[stringScope];sync();update();};
$('stc').onclick=()=>{saveField(false,'current',17.35);saveField(false,'voltage',30*38.1);state.basis='STC module reference: 17.35 A, 30 × 38.1 V; not a solved operating point';sync();update();};
$('save').onclick=()=>{const blob=new Blob([JSON.stringify({state,report},null,2)],{type:'application/json'}),url=URL.createObjectURL(blob),a=document.createElement('a');a.href=url;a.download='inverter-48-electrical-scenario.json';a.click();setTimeout(()=>URL.revokeObjectURL(url),2000);};
function rows(host,data,keys) {host.replaceChildren();for(const row of data){const tr=document.createElement('tr');for(const k of keys){const td=document.createElement('td');const value=row[k];td.textContent=typeof value==='string'?value:fmt(value,k==='totalOhm'?4:2);tr.append(td);}host.append(tr);}}
function update() {
report=calculateElectrical(getModel(),state,getCableLength);const t=report.totals;
$('total').textContent=t.completeLossW===null?`${t.completeStrings}/24 LOOPS`:`${fmt(t.completeLossW,1)} W LOSS`;
$('stats').textContent=`Home loss ${fmt(t.homeLossW,1)} W · complete loss ${fmt(t.completeLossW,1)} W · contact loss ${fmt(t.contactLossW,1)} W · ${t.ampacityExceeded} cable rating exceedances · ${t.unresolvedCables} cables with missing inputs`;
$('basis').textContent=state.basis==='entered'?'Enter operating I and source V. STC reference is an optional comparison, not an operating-point prediction.':state.basis;
rows($('string-results'),report.strings,['id','homeDropV','dropV','dropPercent','lossW','contactLossW','ampacityState']);
rows($('cable-results'),report.cables,['id','lengthM','totalOhm','dropV','lossW','ampacityA','ampacityMarginA']);
const wrong=report.strings.filter(s=>s.seriesCountMatches===false).map(s=>s.id),invalid=report.strings.filter(s=>s.invalidOperatingPoint).map(s=>s.id);
$('error').textContent=[wrong.length?`Review series-pair counts: ${wrong.join(', ')}; model has 29 per string.`:'',invalid.length?`Entered loss exceeds source voltage: ${invalid.join(', ')}.`:''].filter(Boolean).join(' ');
onChange(report);
}
sync();update();
return {refresh(){update();},getState(){return structuredClone(state);},setState(next){state={...emptyElectricalState(),...structuredClone(next)};sync();update();},getReport(){return structuredClone(report);}};
}
export const mount=mountElectrical;Inverter 48 Electrical
A JavaScript module in the wiring folder of GlobalGrid2050 that works with cables, using IEC 60228 and BS EN 50618. Served with the page at https://globalgrid2050.com/ventus/wiring/.
electricalglobalgrid2050 / ventus/wiring/inverter-48-electrical.mjs · lines 1–83 of 83 · pattern contacts (shared by 2 files)
- What it does
- It calculates cables. Defines 6 functions or classes, including emptyElectricalState, number, contactList, sumKnown, contacts.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'inverter'): 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.
- Downstream impact
- Used directly by 1 file: Inverter 48 Electrical UI (globalgrid2050, https://globalgrid2050.com/ventus/wiring/). Reached from 2 other entry points, including Inverter 48 (globalgrid2050, https://globalgrid2050.com/ventus/wiring/); GlobalGrid2050 Inverter Flow Check Workflow (globalgrid2050).
- What it achieves
- It calculates electrical (`calculateElectrical`) and is built from the empty electrical state helper (`emptyElectricalState`) and the number step (`number`). Independent, entered-input DC screening arithmetic. No licensed tables embedded.
- Why it matters
- Imported by Inverter 48 Electrical UI.
- Application
- globalgrid2050 · ventus/wiring · JavaScript module
- Uses
- none found
- Used by
- imported by Inverter 48 Electrical UI (import)
- Produces
- conductorReference, electricalBasis, emptyElectricalState, number, contactList, calculateElectrical
- Defines here
- emptyElectricalState, number, contactList, sumKnown, contacts, calculateElectrical
- 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/inverter-48-electrical.mjs:1-83 · blob 3ed9365c7eb652de7062fd8bf01f7e42b3b592db · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
// Independent, entered-input DC screening arithmetic. No licensed tables embedded.
export const conductorReference = {
title:'cable PV DC copper cable, reference',
url:'#drawing-basis',
sourcePages:'1–2',conductorClass:'5',coating:'Tinned copper',alpha:.00393,
resistanceBasis:'Manufacturer maximum DC resistance at 20°C; independently checked against the IEC 60228:2004, Table 3, class 5 metal-coated wires. Copper temperature coefficient checked against informative Annex B.',
ampacityBasis:'Owner-held BS EN 50618:2014 Table A.3: two loaded cables touching on a surface, 60°C ambient, 120°C maximum conductor temperature. Table A.4 factor is 1 up to 60°C ambient, 0.92 at 70°C, 0.84 at 80°C and 0.75 at 90°C. Additional grouping requires HD 60364-5-52 evidence; the 48-cable grouping is not determined here. Standard notes the limited 20,000-hour operating period at maximum … [line shortened here: 432 characters; full line on GitHub]
sizes:[{size:4,r20:5.09,outerDiameterMm:5.5,baseAmpacity:44},{size:6,r20:3.39,outerDiameterMm:6.1,baseAmpacity:57},{size:10,r20:1.95,outerDiameterMm:7.2,baseAmpacity:79}],
ratedVoltageV:1500,maximumVoltageV:1800,maximumOperatingTemperatureC:120,
minimumBendDiameterFactorFixed:4,minimumBendDiameterFactorMoved:5
};
export const electricalBasis = {
method: 'R(T)=R20 × L/1000 × [1+alpha20 × (T−20)]; ΔV=IR; P=I²R; Iz=Ibase × kTemperature × kGrouping × kOther',
resistance: 'Optional cable class-5 tinned-copper values cite reference and were checked against IEC 60228:2004 Table 3. Its mΩ/m values equal Ω/km numerically. The copper coefficient 0.00393/K follows informative Annex B. This is not a conductor conformity test; cable ampacity requires separate installation evidence.',
standard: 'IEC 62548-1:2023, reference review: 7.2.8.3 installation, 7.2.9 connectors, 7.3.3.3 wiring loops. These calculations do not establish installation compliance.',
scope: '48 home conductors and their entered mated contacts; 29 intermodule mates per connected string. Complete loop result additionally requires the total series-lead copper resistance at operating temperature. Excludes inverter internal loss and module internal resistance.',
missingEvidence: ['Cable size/class/coating and resistance evidence', 'Installation method, segment grouping and thermal rating evidence', 'Maximum design-current basis, including bifacial contribution', 'Connector family compatibility and resistance at relevant condition', 'Cold Voc, equipment ratings, protection/backfeed and earthing', 'Actual operating point and climate/site evidence']
};
export const emptyElectricalState = () => ({defaults:{},overrides:{},stringOverrides:{},basis:'entered'});
export function number(value, {min=0,max=Infinity,exclusive=false}={}) {
if(value===null||value===undefined||String(value).trim()==='')return null;
const n=Number(value);return Number.isFinite(n)&&n<=max&&(exclusive?n>min:n>=min)?n:null;
}
export function contactList(value) {
if(Array.isArray(value))return value.map(v=>number(v));
if(value===null||value===undefined||String(value).trim()==='')return null;
return String(value).split(',').map(v=>number(v));
}
const sumKnown=values=>values.every(v=>v!==null)?values.reduce((a,b)=>a+b,0):null;
function contacts(input) {
const list=contactList(input);return {count:list?.length??null,valuesMilliOhm:list,resistanceOhm:list&&list.every(v=>v!==null)?list.reduce((a,b)=>a+b,0)/1000:null};
}
export function calculateElectrical(model,state=emptyElectricalState(),getCableLength=h=>h.routeM) {
const defaults=state.defaults||{},overrides=state.overrides||{},stringOverrides=state.stringOverrides||{};
const cables=model.homes.map(h=>{
const config={...defaults,...(overrides[h.id]||{})},sconfig={...defaults,...(stringOverrides[h.stringId]||{})};
const lengthM=number(getCableLength(h)),r20=number(config.r20,{exclusive:true}),temp=number(config.temperature,{min:-100,max:250}),alpha=number(config.alpha,{max:.02});
const currentA=number(sconfig.current),designCurrentA=number(sconfig.designCurrent),baseAmpacityA=number(config.baseAmpacity,{exclusive:true});
const factors=['temperatureFactor','groupingFactor','otherFactor'].map(k=>number(config[k],{exclusive:true,max:10}));
const correction=temp!==null&&alpha!==null?1+alpha*(temp-20):null;
const copperOhm=lengthM!==null&&r20!==null&&correction!==null&&correction>0?r20*lengthM/1000*correction:null;
const contact=contacts(config.homeContacts),totalOhm=sumKnown([copperOhm,contact.resistanceOhm]);
const ampacityA=baseAmpacityA!==null&&factors.every(v=>v!==null)?baseAmpacityA*factors.reduce((a,b)=>a*b,1):null;
const missing=[];
if(lengthM===null)missing.push('length');if(r20===null)missing.push('R20');if(correction===null||correction<=0)missing.push('temperature/alpha');
if(contact.resistanceOhm===null)missing.push('mated contact resistance');if(currentA===null)missing.push('operating current');
if(ampacityA===null)missing.push('base ampacity/derating factors');if(designCurrentA===null)missing.push('design current');
return {id:h.id,stringId:h.stringId,polarity:h.sign,lengthM,config,currentA,designCurrentA,copperOhm,contact,totalOhm,
copperDropV:copperOhm!==null&¤tA!==null?currentA*copperOhm:null,
contactDropV:contact.resistanceOhm!==null&¤tA!==null?currentA*contact.resistanceOhm:null,
dropV:totalOhm!==null&¤tA!==null?currentA*totalOhm:null,
lossW:totalOhm!==null&¤tA!==null?currentA*currentA*totalOhm:null,
contactLossW:contact.resistanceOhm!==null&¤tA!==null?currentA*currentA*contact.resistanceOhm:null,
ampacityA,ampacityMarginA:ampacityA!==null&&designCurrentA!==null?ampacityA-designCurrentA:null,
ampacityState:ampacityA===null||designCurrentA===null?'unresolved':ampacityA>=designCurrentA?'within entered rating':'exceeds entered rating',missing};
});
const strings=model.strings.filter(s=>s.connected).map(s=>{
const config={...defaults,...(stringOverrides[s.id]||{})},pair=cables.filter(c=>c.stringId===s.id);
const currentA=number(config.current),voltageV=number(config.voltage,{exclusive:true});
const series=contacts(config.seriesContacts),seriesCopperOhm=number(config.seriesCopperOhm);
const homeCopperOhm=sumKnown(pair.map(c=>c.copperOhm)),homeContactOhm=sumKnown(pair.map(c=>c.contact.resistanceOhm));
const homeLoopOhm=sumKnown([homeCopperOhm,homeContactOhm]);
const allContactOhm=sumKnown([homeContactOhm,series.resistanceOhm]);
const completeLoopOhm=sumKnown([homeLoopOhm,series.resistanceOhm,seriesCopperOhm]);
const homeDropV=currentA!==null&&homeLoopOhm!==null?currentA*homeLoopOhm:null;
const dropV=currentA!==null&&completeLoopOhm!==null?currentA*completeLoopOhm:null;
const lossW=dropV!==null?currentA*dropV:null;
const homeLossW=homeDropV!==null?currentA*homeDropV:null;
return {id:s.id,side:s.side,mppt:s.mppt,currentA,voltageV,series,seriesCopperOhm,homeCopperOhm,homeContactOhm,homeLoopOhm,allContactOhm,completeLoopOhm,homeDropV,homeLossW,dropV,lossW,
homeDropPercent:homeDropV!==null&&voltageV!==null?100*homeDropV/voltageV:null,
dropPercent:dropV!==null&&voltageV!==null?100*dropV/voltageV:null,
deliveredVoltageV:dropV!==null&&voltageV!==null?voltageV-dropV:null,
contactLossW:allContactOhm!==null&¤tA!==null?currentA*currentA*allContactOhm:null,
seriesCountExpected:s.modules.length-1,seriesCountMatches:series.count===null?null:series.count===s.modules.length-1,
invalidOperatingPoint:dropV!==null&&voltageV!==null&&dropV>voltageV,
ampacityState:pair.some(c=>c.ampacityState==='exceeds entered rating')?'exceeds entered rating':pair.every(c=>c.ampacityState==='within entered rating')?'within entered rating':'unresolved'};
});
return {schema:'VENTUS.inverter-48-electrical/1',basis:state.basis||'entered',method:electricalBasis,cables,strings,
totals:{completeStrings:strings.filter(s=>s.lossW!==null).length,homeLossW:sumKnown(strings.map(s=>s.homeLossW)),completeLossW:sumKnown(strings.map(s=>s.lossW)),contactLossW:sumKnown(strings.map(s=>s.contactLossW)),
unresolvedCables:cables.filter(c=>c.missing.length).length,ampacityExceeded:cables.filter(c=>c.ampacityState==='exceeds entered rating').length,
homeMatedPairs:cables.every(c=>c.contact.count!==null)?cables.reduce((a,c)=>a+c.contact.count,0):null,
seriesMatedPairs:strings.every(s=>s.series.count!==null)?strings.reduce((a,s)=>a+s.series.count,0):null}};
}Inverter 48 Model
A JavaScript module in the wiring folder of GlobalGrid2050 that works with physical point (`physicalPoint`) and calculates planar distances. Served with the page at https://globalgrid2050.com/ventus/wiring/.
electricalglobalgrid2050 / ventus/wiring/inverter-48-model.mjs · lines 1–63 of 63 · pattern length (shared by 4 files)
- What it does
- It calculates its inputs. Defines distance, length, build, physicalPoint.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'inverter'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Inverter 48 (globalgrid2050, https://globalgrid2050.com/ventus/wiring/). Reached from 1 other entry point, including GlobalGrid2050 Inverter Flow Check Workflow (globalgrid2050).
- What it achieves
- It is built from the distance step (`distance`), the length step (`length`) and the build step (`build`). Generic geometry only. Physical routes and presentation coordinates are separate. Its code works with 352 kVA, 295 kVA and 320 kVA.
- Why it matters
- Imported by Inverter 48.
- Application
- globalgrid2050 · ventus/wiring · JavaScript module
- Uses
- none found
- Used by
- imported by Inverter 48 (import)
- Produces
- sources, distance, length, build
- Defines here
- distance, length, build, physicalPoint
- 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/inverter-48-model.mjs:1-63 · blob 1f72919de3535f7d8507aaec8d4ac74a894a8617 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
// Generic geometry only. Physical routes and presentation coordinates are separate.
export const sources = {
module: '#drawing-basis',
inverter: '#drawing-basis'
};
export const distance = (a,b) => Math.hypot(...a.map((v,i)=>v-b[i]));
export const length = pts => pts.slice(1).reduce((n,p,i)=>n+distance(pts[i],p),0);
export function build({physicalOffset=2, drawingOffset=30, gap=.02, tilt=8}={}) {
for (const [v,min,max] of [[physicalOffset,.2,100],[drawingOffset,10,100],[gap,0,.5],[tilt,0,60]])
if (!Number.isFinite(v)||v<min||v>max) throw Error('Geometry input outside supported range');
const width=1.303,height=2.384,pitch=width+gap, rowPitch=height+gap;
const faceDepth=5*height+4*gap, ridgeGap=.3, bankGap=6, lanePitch=.8, drawRowPitch=height+1.5+6*lanePitch;
const inverterXYZ=[-physicalOffset,faceDepth*Math.cos(tilt*Math.PI/180)+ridgeGap/2,1];
const modules=[],strings=[],homes=[],links=[],ports=[],mppts=[];
const physicalPoint=(side,x,y)=>[x,y*Math.cos(tilt*Math.PI/180)+(side?faceDepth*Math.cos(tilt*Math.PI/180)+ridgeGap:0),1+(side?faceDepth-y:y)*Math.sin(tilt*Math.PI/180)];
for(let side=0;side<2;side++)for(let row=0;row<5;row++)for(let col=0;col<3;col++) {
const n=side*15+row*3+col+1,id='S'+String(n).padStart(2,'0'),connected=row<4;
const slot=side*12+row*3+col,mppt=connected?Math.floor(slot/2)+1:null,input=connected?slot%2+1:null;
const yD=side*(5*drawRowPitch+bankGap)+row*drawRowPitch;
const s={id,side:side?'WEST':'EAST',row:row+1,column:col+1,connected,destination:connected?'INV-01':'OTHER-INVERTER-OFF-DRAWING',mppt,input,modules:[],kwp:19.8,drawY:yD};
for(let j=0;j<30;j++) {
const x=(col*30+j)*pitch,mId=id+'-M'+String(j+1).padStart(2,'0');
const m={id:mId,stringId:id,side:s.side,physicalOrigin:physicalPoint(side,x,row*rowPitch),
minus:physicalPoint(side,x+width*.35,row*rowPitch+height/2),plus:physicalPoint(side,x+width*.65,row*rowPitch+height/2),
drawing:[[x,yD],[x+width,yD],[x+width,yD+height],[x,yD+height],[x,yD]],
drawMinus:[x+width*.35,yD+height/2],drawPlus:[x+width*.65,yD+height/2]};
modules.push(m);s.modules.push(mId);
}
const ms=modules.slice(-30);
for(let j=0;j<29;j++) {
const a=ms[j],b=ms[j+1];
links.push({id:id+'-L'+(j+1),stringId:id,connected,from:a.id+'+',to:b.id+'-',physical:[a.plus,b.minus],routeM:distance(a.plus,b.minus),drawing:[a.drawPlus,[a.drawPlus[0]+.12,yD+height*.64],[b.drawMinus[0]-.12,yD+height*.64],b.drawMinus]});
}
s.minus=ms[0].drawMinus;s.plus=ms.at(-1).drawPlus;
if(connected)for(const [k,sign] of ['-','+'].entries()) {
const portId='MPPT'+String(mppt).padStart(2,'0')+'-'+input+sign;
const terminal=sign==='-'?ms[0].minus:ms.at(-1).plus, drawTerminal=sign==='-'?s.minus:s.plus;
// Distinct routing lanes are spread on the drawing only. The physical route
// follows the supporting row to a common assumed mounting point at its end.
const rowY=row*rowPitch+height+.08+k*.04;
const p1=physicalPoint(side,terminal[0],rowY),p2=physicalPoint(side,-.15,rowY);
const physical=[terminal,p1,p2,[-physicalOffset,p2[1],p2[2]],inverterXYZ];
const routeM=length(physical),lane=yD+height+.7+(2*col+k)*lanePitch;
const portY=2+side*(5*drawRowPitch+bankGap)+row*drawRowPitch+(2*col+k)*lanePitch,port=[-drawingOffset,portY];
const laneX=-1-(23-slot)*((drawingOffset-3)/25)-k*.15;
const drawing=[drawTerminal,[drawTerminal[0],lane],[laneX,lane],[laneX,portY],port];
const h={id:id+sign,stringId:id,sign,mppt,input,portId,physical,drawing,routeM,from:id+sign,to:portId,
electronDirection:sign==='-'?'string-to-inverter':'inverter-to-string'};
homes.push(h);ports.push({id:portId,stringId:id,sign,mppt,input,drawing:port});
}
strings.push(s);
}
for(let i=1;i<=12;i++)mppts.push({id:i,strings:strings.filter(s=>s.mppt===i).map(s=>s.id),kwp:39.6});
return {layout:{lanePitch,drawRowPitch,bankGap,westY:5*drawRowPitch+bankGap},schema:'VENTUS.inverter-48/1',sources,width,height,gap,tilt,physicalOffset,drawingOffset,inverterXYZ,
modules,strings,homes,links,ports,mppts,faceDepth,arrayWidth:90*width+89*gap,
inverterDrawing:{x:-drawingOffset-15,y:-3,width:15,height:2*5*drawRowPitch+bankGap+5},
totals:{modules:900,strings:30,connectedStrings:24,spareStrings:6,connectedKwp:475.2,spareKwp:118.8,installedKwp:594,acKva:352,
homeRouteM:homes.reduce((n,h)=>n+h.routeM,0),seriesRouteM:links.reduce((n,l)=>n+l.routeM,0)},
assumptions:['2D developed view; rows separated for cable legibility.','Port order and positions illustrative; not manufacturer mechanical coordinates.',
'Physical route estimate follows entered module dimensions and assumed support routing to one mounting point; excludes slack, connector bodies and obstacles.',
'Animation illustrates electron direction in an assumed operating circuit; no MPPT operating point or drift speed is solved.',
'352 kVA inverter 12-MPPT variant; 352 kVA at 30 C, 320 kVA at 40 C, 295 kVA at 50 C.']};
}Inverter 48 Native
A JavaScript module in GlobalGrid2050 that builds native walks, draws electron flow, creates native adapter and calculates planar distances, covering cables. Served with the page at https://globalgrid2050.com/ventus/wiring/.
electricalglobalgrid2050 / ventus/wiring/inverter-48-native.mjs · lines 1–123 of 123 · Entry point · pattern sizes (shared by 3 files)
- What it does
- It draws cables. Defines 9 functions or classes, including map, close, reversed, esc, buildNativeWalks. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'inverter'): 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: SVG drawing.
- Downstream impact
- Used directly by 2 files: Inverter 48 (globalgrid2050, https://globalgrid2050.com/ventus/wiring/); GlobalGrid2050 Inverter Flow Check Workflow (globalgrid2050). It is itself an entry point, published at https://globalgrid2050.com/ventus/wiring/.
- What it achieves
- It builds native walks (`buildNativeWalks`), draws electron flow (`drawElectronFlow`) and creates native adapter (`createNativeAdapter`). Native multi-string flow adapter. Original renderer files are untouched.
- Why it matters
- Imported by Inverter 48. Run by GlobalGrid2050 Inverter Flow Check Workflow.
- Application
- globalgrid2050 · ventus/wiring · JavaScript module
- Uses
- none found
- Used by
- imported by Inverter 48 (import), run by GlobalGrid2050 Inverter Flow Check Workflow (workflow run)
- Produces
- buildNativeWalks, drawElectronFlow, createNativeAdapter
- Defines here
- map, close, reversed, esc, buildNativeWalks, drawElectronFlow, path, createNativeAdapter, sizes
- 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/inverter-48-native.mjs:1-123 · blob 26576cf84d34ccd1d732b5f7355d72a102ac0d58 · 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
/* Native multi-string flow adapter. Original renderer files are untouched.
*
* const adapter = await createNativeAdapter(rendererWindow);
* const walks = adapter.build(model); // rebuild when geometry changes
* adapter.drawFlow(ctx, walks, elapsedSeconds, {selected: 'S01'});
* adapter.drawConnectors(ctx, model); // after flow, using screen-pixel context
* adapter.svgConnectors(model, projectToSvgPixels) // portable sourced profiles
*
* Every circuit is validated by the inherited buildStringWalk. Its traversal is
* INV- -> modules 1..30 -> INV+; electron heads run BACKWARDS, from INV+ through
* module 30..1 to INV-. The inverter's internal conversion is outside this drawing.
* Clock and spacing are illustrative; they do not express current or drift speed.
* generic profiles are the existing local family reference drawings. Polarity,
* gender assignment and placement are schematic; no mating approval is implied.
*/
const map = p => [p[0] * .01, -p[1] * .01];
const close = (a,b) => Math.hypot(a[0]-b[0],a[1]-b[1]) < 1e-8;
const reversed = pts => pts.slice().reverse();
const esc = s => String(s).replaceAll('&','&').replaceAll('"','"').replaceAll('<','<');
export function buildNativeWalks(w, model) {
const walks=[];
for (const string of model.strings.filter(s=>s.connected)) {
const mods=string.modules.map(id=>model.modules.find(m=>m.id===id));
const homes=model.homes.filter(h=>h.stringId===string.id);
const negative=homes.find(h=>h.sign==='-'),positive=homes.find(h=>h.sign==='+');
const links=model.links.filter(l=>l.stringId===string.id);
if (!negative||!positive||mods.length!==30||links.length!==29) throw Error(string.id+': incomplete circuit');
if (!close(negative.drawing[0],mods[0].drawMinus)||!close(positive.drawing[0],mods.at(-1).drawPlus)) throw Error(string.id+': disconnected home cable');
if(homes.some(h=>h.shortM>0)){walks.push({stringId:string.id,open:true,reason:'insufficient supplied cable',legs:[],total:0});continue;}
const shapes=mods.map((m,i)=>({role:'module',module:i+1,node:m.id,pts:m.drawing.map(map),electronPath:[m.drawMinus,m.drawPlus].map(map)}));
shapes.push({role:'cable',node:negative.id,home:true,from:'INV-',to:'M1-',pts:reversed(negative.drawing).map(map),open:!!negative.open});
for(let i=0;i<29;i++) {
const link=links.find(l=>l.from===mods[i].id+'+'&&l.to===mods[i+1].id+'-');
if(!link||!close(link.drawing[0],mods[i].drawPlus)||!close(link.drawing.at(-1),mods[i+1].drawMinus)) throw Error(string.id+': disconnected series link '+(i+1));
shapes.push({role:'cable',node:link.id,from:'M'+(i+1)+'+',to:'M'+(i+2)+'-',pts:link.drawing.map(map),open:!!link.open});
}
shapes.push({role:'cable',node:positive.id,home:true,from:'M30+',to:'INV+',pts:positive.drawing.map(map),open:!!positive.open});
const native=w.buildStringWalk({shapes});
if (!native) { walks.push({stringId:string.id,open:true,legs:[],total:0}); continue; }
// Retain the inherited length allocations, module-outline treatment and leg order.
walks.push({stringId:string.id,open:false,...native});
}
return walks;
}
export function drawElectronFlow(w, ctx, walks, clock, {selected=null, spacingPx=150, speedPx=48}={}) {
const scale=w.shapeScale(),stats={strings:0,homePaths:0};
const path=pts=>{ctx.beginPath();pts.map(w.shapePoint).forEach((p,i)=>i?ctx.lineTo(...p):ctx.moveTo(...p));};
ctx.save();ctx.globalCompositeOperation='lighter';ctx.shadowColor='#7ff0ff';
for(const walk of walks) {
if(walk.open||!walk.total||walk.operatingCurrentA===0||walk.invalidOperatingPoint)continue;
// Optional entered current uses the native renderer's restrained glow-weight
// emphasis. Null/unknown remains illustrative and supplies no physical value.
const currentWeight=Number.isFinite(walk.operatingCurrentA)&&walk.operatingCurrentA>0?1+.5*Math.min(1,walk.operatingCurrentA/20):1;
stats.strings++;
const phase=(Number(walk.stringId.slice(1))*.38196601125)%1;
// One circuit trace plus a trace on each home conductor, so both polarities
// remain visibly animated even when the full circuit is much longer.
const pulses=[{legs:walk.legs,start:0,end:1,phase},...walk.legs.filter(l=>l.s?.home).map((leg,i)=>({legs:[leg],start:leg.u0,end:leg.u1,phase:(phase+i*.5)%1,home:true}))];
for(const pulse of pulses) {
if(pulse.home)stats.homePaths++;
const range=pulse.end-pulse.start,pixels=walk.total*scale*range;
const tail=Math.min(.12,18/Math.max(1,pixels));
const head=((pulse.phase-clock*speedPx/Math.max(1,pixels))%1+1)%1;
const spans=(head+tail>1?[[head,1],[0,head+tail-1]]:[[head,head+tail]]).map(([a,b])=>[pulse.start+a*range,pulse.start+b*range]);
for(const leg of pulse.legs)for(const [a0,b0]of spans) {
const a=Math.max(leg.u0,a0),b=Math.min(leg.u1,b0);if(b<=a)continue;
const d=Math.max(1e-9,leg.u1-leg.u0),pts=leg.s?.pts||leg.mod?.electronPath;
if(!pts)continue;
const segment=w.polySlice(pts,(a-leg.u0)/d,(b-leg.u0)/d);if(segment.length<2)continue;
const weight=(leg.s?.home?2.2:1.5)*(selected===walk.stringId?1.25:1)*currentWeight;
// Same two-pass cyan casing and white core as native drawSldShapes 3b.
ctx.shadowBlur=weight*2.6;path(segment);ctx.lineWidth=weight*2.1;ctx.strokeStyle='rgba(86,214,255,0.22)';ctx.stroke();
path(segment);ctx.lineWidth=weight;ctx.strokeStyle='rgba(224,250,255,0.92)';ctx.stroke();
if(leg.mod){ctx.shadowBlur=7*currentWeight;path(leg.mod.pts);ctx.closePath();ctx.lineWidth=1.4*currentWeight;ctx.strokeStyle='rgba(120,232,255,0.55)';ctx.stroke();}
}
}
}
ctx.restore();return stats;
}
export async function createNativeAdapter(w, {}={}) {
const profiles={};
for(const kind of ['plug','socket']) {
const source='<svg xmlns="http://www.w3.org/2000/svg" width="100" height="28" viewBox="0 0 100 28"><g fill="white" stroke="black" stroke-width="2"><path d="M2 9h16V4h48v4h16v4h16v4H82v4H66v4H18v-5H2z"/><path d="M26 5v18m8-18v18m8-18v18m32-15v12"/></g></svg>';
const data='data:image/svg+xml;base64,'+btoa(source),image=new w.Image();image.src=data;await image.decode();
profiles[kind]={entry:{id:'generic-'+kind,label:'Schematic '+kind},image,data,aspect:100/28};
}
// This page paints its enlarged source profiles after the cable layer. Suppress
// only its generic native plug fallback; other inherited drawings retain it.
if(!w.__inverter48PortProfileHook){const previous=w.drawManufacturerConnector;
w.drawManufacturerConnector=function(ctx,shape,drawing){if(drawing?.inverter48)return true;return previous?.call(this,ctx,shape,drawing)||false;};
w.__inverter48PortProfileHook=true;
}
function sizes(model,project,desired) {
const points=model.ports.map(p=>project(p.drawing));
const pitch=Math.min(...points.slice(1).map((q,i)=>Math.hypot(q[0]-points[i][0],q[1]-points[i][1])));
return {length:desired||Math.max(8,Math.min(48,pitch*.64*Math.min(profiles.plug.aspect,profiles.socket.aspect))),points};
}
return {
profiles,
build:model=>buildNativeWalks(w,model),
drawFlow:(ctx,walks,clock,options)=>drawElectronFlow(w,ctx,walks,clock,options),
drawConnectors(ctx,model,{lengthPx}={}) {
const {length,points}=sizes(model,p=>w.shapePoint(map(p)),lengthPx);
ctx.save();ctx.globalCompositeOperation='screen';ctx.filter='invert(1)';
model.ports.forEach((port,i)=>{const profile=profiles[port.sign==='+'?'plug':'socket'],q=points[i],height=length/profile.aspect;
// Both manufacturer profiles have their cable gland at the right edge.
// That edge is anchored to the existing home cable endpoint at the inverter.
ctx.drawImage(profile.image,q[0]-length,q[1]-height/2,length,height);
});ctx.restore();return model.ports.length;
},
svgConnectors(model,project,{lengthPx}={}) {
const {length,points}=sizes(model,project,lengthPx);
const filter='<defs><filter id="generic-profile-ink" color-interpolation-filters="sRGB"><feComponentTransfer><feFuncR type="table" tableValues="1 0"/><feFuncG type="table" tableValues="1 0"/><feFuncB type="table" tableValues="1 0"/></feComponentTransfer></filter>'+Object.entries(profiles).map(([kind,p])=>'<image id="generic-source-'+kind+'" width="'+p.image.naturalWidth+'" height="'+p.image. … [line shortened here: 458 characters; full line on GitHub]
return filter+model.ports.map((port,i)=>{const profile=profiles[port.sign==='+'?'plug':'socket'],q=points[i],height=length/profile.aspect;
const kind=port.sign==='+'?'plug':'socket',factor=length/profile.image.naturalWidth;
return '<use data-port="'+esc(port.id)+'" data-profile="'+esc(profile.entry.id)+'" transform="translate('+(q[0]-length)+' '+(q[1]-height/2)+') scale('+factor+')" filter="url(#generic-profile-ink)" href="#generic-source-'+kind+'"><title>'+esc(profile.entry.label)+' — schematic family reference</title></use>';
}).join('');
}
};
}