In this section
- Pilot Estate geodesy · cosmic / tools/explore/theme/pilot-estate.js lines 701–1185
- Pilot Goto render · cosmic / tools/explore/theme/pilot-goto.css lines 1–43
Pilot Estate
A JavaScript file in the theme folder of Cosmic covering substations and solar, using SHA-256 and haversine, and uses data from the GridAtlas repository.
geodesycosmic / tools/explore/theme/pilot-estate.js · lines 701–1185 of 1185 (continued from section 1145) · Entry point · pattern circleApproximationError (shared by 2 files)
- What it does
- It lists and searches substations, solar, the REPD register and cables. Defines 41 functions or classes, including curvatureKm, localScaleKm, distanceKm, distanceEllipsoidalKm, pathLengthKm. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain terms in the code: substations, solar, the REPD register, cables, 750kV, 400kV.
- Inputs & outputs
- Coordinate systems named: WGS84 / EPSG:4326. Voltage levels named: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV, 11kV.
- Downstream impact
- Used directly by 2 files: Pilot Vicinity (cosmic); Pilot (cosmic, https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html).
- What it achieves
- It audits project rows (`auditProjectRows`), builds deep link (`buildDeepLink`) and parses deep link (`parseDeepLink`). Pilot module "estate" (W10 / CAPSTAN-41): estate originals vendored VERBATIM, as PILOT.estate. Its code works with 750 kV.
- Why it matters
- Loaded by the Pilot page at https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html. Also imported by Pilot Vicinity.
- Application
- cosmic · tools/explore/theme · script
- VEDIC
- MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
- VEDIC
- BEARING (GG2050-VEDIC-000005): GridAtlas / Geodesy · Mathematics / Trigonometry. coordinate_pair, coordinate_pair → bearing_deg
- VEDIC
- DESTINATION (GG2050-VEDIC-000004): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, distance_km, bearing_deg → coordinate_pair
- Uses
- GridAtlas — Atlas Page (estate URL), GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL)
- Used by
- required by Pilot Vicinity (require), loaded by Pilot (script src)
- Produces
- curvatureKm, localScaleKm, distanceKm, distanceEllipsoidalKm, pathLengthKm, initialBearingDeg, destinationPoint, distanceToSegmentKm, distanceToLineKm, geodesicCircle, circleApproximationError, polygonAreaKm2
- Defines here
- layerIdForBucket, bucketHasLayer, isRetiredReceiver, strip, auditProjectRows, buildDeepLink, parseDeepLink, get, num, finite, validPoint, optical, rowLocation, positive, capacityOf, solarProject, solarMarkerRadiusPx, createLightningContextEngine, postEventDiligence, lightningElectricalScenario
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/theme/pilot-estate.js:701-1185 · blob 03c3ac3fbe5e2ea2e16c065b91b47684889b4c46 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
* The project is identified by repd_ref. NOT repd_id. Both names appear in
* the estate and they are not interchangeable; the emitter sends repd_ref
* and the receiver reads repd_ref, and the proof asserts that they agree
* rather than leaving it to memory.
*/
const IDENTITY_PARAM = 'repd_ref';
/* ── Parameters the link carries ─────────────────────────────────────────── */
const PARAMS = Object.freeze({
repd_ref: { type: 'string', required: true, note: 'REPD reference; the project identity' },
technology: { type: 'string', required: true, note: 'a bucket from BUCKETS, not a layer id' },
latitude: { type: 'number', required: false, units: 'degrees north' },
longitude: { type: 'number', required: false, units: 'degrees east' },
zoom: { type: 'number', required: false, note: 'MapLibre zoom level' }
});
/* ── The bucket vocabulary the emitter may send ───────────────────────────
* These are Pipeline News' technology names. They are NOT the engine's layer
* ids, and the difference is the whole bug.
*/
const BUCKETS = Object.freeze([
'solar', 'wind_onshore', 'wind_offshore', 'bess', 'biomass', 'hydro',
'hydrogen', 'tidal', 'geothermal', 'flywheel', 'caes', 'act', 'other'
]);
/* ── The engine's real layer ids ──────────────────────────────────────────
* Verbatim from REPD_IDS, ventus-corev8engine-exact-repd-delegation.js:66.
* Note what is absent: there is no `wind_onshore`, no `wind_offshore`, and
* no `other`. There is one `wind`.
*/
const REPD_LAYER_IDS = Object.freeze([
'solar', 'solar_operational', 'solar_roof', 'wind',
'wind_onshore_operational', 'wind_offshore_operational',
'bess', 'bess_operational', 'biomass', 'tidal', 'hydrogen',
'hydro', 'flywheel', 'act', 'geothermal', 'caes'
]);
/* ── The table that fixed it ──────────────────────────────────────────────
* Introduced in gridatlas generation 202609041244 (v9.109); first carried to
* production in generation 202609041330 (v9.111), because live had been
* sitting on v9.108.
*
* What it replaced: a set-membership test. The old code asked "is
* wind_onshore one of the project technologies?", got true, and reported
* technology_layer.enabled = true — while the DOM lookup for a checkbox
* literally named `wind_onshore` failed every single time, because no such
* control has ever existed. Measured blast radius: 2,508 of 7,680 register
* rows, a third of the register, reporting green while the layer sat off.
*
* `other` maps to null deliberately. No layer exists for it. A caller must
* say so rather than search for one and then quietly claim success — that
* short-circuit is the honest branch, and the proof asserts it stays honest.
*/
const LAYER_ID_FOR_BUCKET = Object.freeze({
wind_onshore: 'wind',
wind_offshore: 'wind',
other: null
});
/**
* The engine layer id a Pipeline News bucket resolves to.
* Returns null when no layer exists (the `other` case) — never a guess.
* Any bucket not in the table maps to itself, which is correct for every
* bucket whose name already matches a real layer id.
*/
function layerIdForBucket(tech) {
const id = String(tech == null ? '' : tech);
return Object.prototype.hasOwnProperty.call(LAYER_ID_FOR_BUCKET, id)
? LAYER_ID_FOR_BUCKET[id] : id;
}
/** True when this bucket resolves to a layer the engine can actually show. */
function bucketHasLayer(tech) {
const id = layerIdForBucket(tech);
return id !== null && REPD_LAYER_IDS.includes(id);
}
/**
* Which receiver a deep link must be built against.
*
* The contract used to take the base from the caller and say nothing about
* which one was right. Every consumer therefore chose its own, and on
* 2026-09-05 the MAP button in Pipeline News v9.7 was measured pointing at the
* V8 overlay -- a page that still serves, so nothing 404'd, but which carries
* no cartridge and no current.json, so no arrival there could ever compute a
* nearest substation. The route was hard-coded in the consumer and the engine
* published nothing for it to disagree with.
*
* These are the same values as deeplink/receivers.json, which is the published
* form for anything that cannot import this module. The proof asserts the two
* agree, so they cannot drift apart.
*/
const CANONICAL_RECEIVER = 'https://ventusltd.github.io/gridatlas/atlas/';
const RETIRED_RECEIVERS = Object.freeze([
'https://globalgrid2050.com/repd_grid_atlasv8/'
]);
/**
* True if a base is a receiver that cannot honour a deep link.
*
* Trailing slashes and query strings are ignored: a consumer that appends its
* own parameters must still be caught, and the fault this exists to prevent
* would have slipped past an equality test.
*/
function isRetiredReceiver(base) {
if (!base) return false;
const strip = (value) => String(value).split('?')[0].split('#')[0].replace(/\/+$/, '');
const target = strip(base);
return RETIRED_RECEIVERS.some((route) => strip(route) === target);
}
/**
* The query: every project row that carries an REPD identity, and the link it
* should have.
*
* "define a query that targets all project rows on pipeline news that have an
* REPD id and if they do then the algorithm or spiders or git via cvaa needs to
* auto update each of those links" -- the architect, 2026-09-05.
*
* It is defined HERE, once, rather than in the updater, so that the thing which
* proves the links offline and the workflow which rewrites them are running the
* same code. An audit that uses different logic from the fix it gates is not a
* gate.
*
* Returns one entry per row. `linkable` is false for a row with no REPD
* identity or no usable geometry -- those are reported, never silently skipped,
* because a row that quietly gets no link is exactly how 28 projects in the
* v9.5.1 corpus ended up with a dead MAP button that nobody saw.
*
* @param {Array<object>} rows
* @param {object} [options] { requireGeometry: true }
*/
function auditProjectRows(rows, options) {
const requireGeometry = !options || options.requireGeometry !== false;
const list = Array.isArray(rows) ? rows : [];
const entries = list.map((row) => {
const identity = row ? row[IDENTITY_PARAM] : null;
const hasIdentity = identity !== undefined && identity !== null && identity !== '';
const hasGeometry = Boolean(row)
&& row.latitude !== undefined && row.latitude !== null && row.latitude !== ''
&& row.longitude !== undefined && row.longitude !== null && row.longitude !== '';
const linkable = hasIdentity && (!requireGeometry || hasGeometry);
return {
[IDENTITY_PARAM]: hasIdentity ? identity : null,
has_identity: hasIdentity,
has_geometry: hasGeometry,
linkable,
current_href: row && row.href ? String(row.href) : null,
current_is_retired: Boolean(row && row.href && isRetiredReceiver(row.href)),
expected_href: linkable ? buildDeepLink(row) : null
};
});
return {
total: entries.length,
with_identity: entries.filter((e) => e.has_identity).length,
linkable: entries.filter((e) => e.linkable).length,
no_geometry: entries.filter((e) => e.has_identity && !e.has_geometry).length,
on_retired_receiver: entries.filter((e) => e.current_is_retired).length,
needs_update: entries.filter((e) => e.linkable && e.current_href && e.current_href !== e.expected_href).length,
entries
};
}
/**
* Build a deep link. The emitter's job, expressed once.
*
* Call it with one argument and the contract supplies the canonical receiver,
* which is the form every consumer should use. The two-argument form is kept
* for a caller that genuinely needs another base -- a local harness, a staged
* copy -- and it REFUSES a retired receiver rather than quietly building a
* link that lands somewhere inert.
*
* @param {string|object} base the receiver, or the project when omitted
* @param {object} [project] { repd_ref, technology, latitude, longitude, zoom }
* @returns {string}
*/
function buildDeepLink(base, project) {
if (project === undefined && base && typeof base === 'object') {
project = base;
base = CANONICAL_RECEIVER;
}
if (!project || project[IDENTITY_PARAM] == null || project[IDENTITY_PARAM] === '') {
throw new Error('buildDeepLink: ' + IDENTITY_PARAM + ' is required and is the project identity');
}
if (isRetiredReceiver(base)) {
throw new Error(
'buildDeepLink: ' + base + ' is a retired receiver and carries no engine; '
+ 'a link built against it cannot compute anything. Use the canonical receiver '
+ CANONICAL_RECEIVER + ' (call buildDeepLink(project) and the contract supplies it).'
);
}
const url = new URL(base);
for (const key of Object.keys(PARAMS)) {
const value = project[key];
if (value === undefined || value === null || value === '') continue;
url.searchParams.set(key, String(value));
}
return url.toString();
}
/**
* Parse a deep link. The receiver's job, expressed once.
*
* Returns what the link asked for AND what the engine can honour, separately.
* `layer_id` is the resolved engine layer; `layer_exists` says whether one
* exists at all. A receiver that conflates those two is the v9.108 bug.
*/
function parseDeepLink(href) {
const url = new URL(href);
const get = (k) => url.searchParams.get(k);
const num = (k) => {
const raw = get(k);
if (raw === null || raw.trim() === '') return null;
const n = Number(raw);
return Number.isFinite(n) ? n : null;
};
const technology = get('technology');
return {
repd_ref: get(IDENTITY_PARAM),
technology,
latitude: num('latitude'),
longitude: num('longitude'),
zoom: num('zoom'),
layer_id: technology === null ? null : layerIdForBucket(technology),
layer_exists: technology === null ? false : bucketHasLayer(technology),
known_bucket: technology !== null && BUCKETS.includes(technology)
};
}
// <<< deeplink end
return { IDENTITY_PARAM: IDENTITY_PARAM, PARAMS: PARAMS, CANONICAL_RECEIVER: CANONICAL_RECEIVER, RETIRED_RECEIVERS: RETIRED_RECEIVERS, isRetiredReceiver: isRetiredReceiver, buildDeepLink: buildDeepLink, parseDeepLink: parseDeepLink };
})();
// ==== lightning: Ventusltd/ventus-grid-engine@69b4e88c8464f0310bd67e47ec83ee8afa9e1921 engine/lightning-click-context.js (verbatim, export keywords removed)
var lightning = (function () {
// >>> lightning begin
/**
* Lightning -> real-grid and solar-project context, proof-of-concept engine seam.
*
* Source optical flash != confirmed ground strike. Nearby != connected/affected.
* Reuses Grid Engine's actual geodesy, nearest search and MAP deep-link contract.
* No DOM/network, no solver, no attempt to modify GridAtlas or Pipeline News.
*/
const { distanceKm, voltagesKv, representativePoint } = engine;
const { index: indexSubstations } = nearest;
const { buildDeepLink } = deeplink;
const schema = 'ventus-grid-engine.lightning-click-context.v1';
const caveat = 'Satellite optical lightning detection, NOT a confirmed ground strike. Proximity does not establish a strike, electrical coupling, physical fault, network connectivity or solar-farm damage.';
const finite = (x) => typeof x === 'number' && Number.isFinite(x);
const validPoint = (lon,lat) => finite(lon) && finite(lat)
&& lon >= -180 && lon <= 180 && lat >= -90 && lat <= 90;
const optical = f => {
if (f?.type !== 'Feature' || f?.geometry?.type !== 'Point'
|| !Array.isArray(f.geometry.coordinates)) throw new Error('Expected optical-flash GeoJSON Point');
const [lon,lat] = f.geometry.coordinates;
if (!validPoint(lon,lat) || f.geometry.coordinates.length < 2)
throw new Error('Invalid optical-flash coordinates');
if (f.properties?.observation_kind !== 'optical_lightning_flash')
throw new Error('Not an optical lightning flash');
if (f.id === undefined || f.id === null || !String(f.id).trim())
throw new Error('Missing authentic optical flash id');
const timeMs=Date.parse(f.properties?.time_utc);
if (!Number.isFinite(timeMs)) throw new Error('Missing genuine optical UTC time');
return {id:String(f.id),lon,lat,time_utc:new Date(timeMs).toISOString(),
kind:'optical_lightning_flash',source:'EUMETSAT MTG LI L2-LFL'};
};
const rowLocation = (row) => {
const p=row?.location, geom=row?.geometry;
// Reuse the estate's existing polygon/MultiPolygon representative-point
// contract. The original GridAtlas OSM substation layer is GeoJSON and
// cannot be presumed to consist entirely of Point features.
const centre=representativePoint(geom);
const lon=p?.lon ?? p?.longitude ?? centre?.[0] ?? row?.longitude;
const lat=p?.lat ?? p?.latitude ?? centre?.[1] ?? row?.latitude;
return validPoint(lon,lat)?{lon,lat}:null;
};
const positive = n => finite(n) && n>0;
const capacityOf = project => {
if (project?.capacity_mw == null || project?.capacity_mw === '') return null;
const n=Number(project.capacity_mw);
return positive(n)?n:null;
};
const solarProject = (project) => {
// Real Pipeline News solar-part-00X.geojson has source fields inside
// Feature.properties; the compact project index has them at the root.
// Both are allowed, but identity and coordinates must genuinely exist.
const p=project?.type==='Feature' ? project.properties : project;
const t=String(p?.technology||p?.repd_technology||'').toLowerCase();
if(!t.includes('solar'))return null;
const location=rowLocation(project);
if(!location || (p?.geometry_status && p.geometry_status!=='valid'))return null;
const repdRef=String(p?.repd_ref??'').trim();
if(!/^[0-9]+$/.test(repdRef))return null;
const mw=capacityOf(p);
return {repd_ref:repdRef,name:String(p.name||'Unnamed REPD solar project'),
location,capacity_mw:mw,technology:'solar'};
};
/**
* Size represents registered capacity (MW), NOT real hectares, lightning intensity
* or electrical susceptibility. Minimum touch target must be supplied by the UI.
*/
function solarMarkerRadiusPx(capacityMw) {
return positive(capacityMw)?Math.min(16,Math.max(5,5+2*Math.sqrt(capacityMw/10))):5;
}
const lightningMarker = Object.freeze({
visible_radius_px:7,touch_target_diameter_css_px:44,
note:'Draw a larger invisible hit layer; never change the real lon/lat.'
});
/** Index genuine available data ONCE; never download a 35.7MB register to handle click. */
function createLightningContextEngine({substations=[],solarProjects=[]}={}) {
if(!Array.isArray(substations)||!Array.isArray(solarProjects))
throw new TypeError('Expected bounded arrays of actual data');
const locatedSubstations=substations.map(p=>{
// Accept the existing GridAtlas substation GeoJSON as well as the
// normalised Grid Engine point contract. Do not infer kV from magnitude.
const location=rowLocation(p);
if(!location)return null;
const meta=p.type==='Feature'?p.properties||{}:p;
const kv=Array.isArray(meta.voltages_kv)?meta.voltages_kv:voltagesKv(meta);
return {...meta,name:meta.name||p.name||null,code:meta.code||p.id||null,
location,voltages_kv:kv};
}).filter(Boolean);
const subIndex=indexSubstations(locatedSubstations);
const solar=solarProjects.map(solarProject).filter(Boolean);
return Object.freeze({
dataset_summary:Object.freeze({
total_substations:substations.length,located_substations:subIndex.located,
total_solar_records:solarProjects.length,locatable_repd_solar_projects:solar.length
}),
selectFlash(feature,{radiusKm=20,substationLimit=5,solarLimit=15,minimumKv=0}={}) {
const event=optical(feature);
if(!positive(radiusKm)||radiusKm>500||!Number.isInteger(substationLimit)||substationLimit<1
||substationLimit>25||!Number.isInteger(solarLimit)||solarLimit<1||solarLimit>50
||!finite(minimumKv)||minimumKv<0)
throw new RangeError('Invalid bounded location search options');
const nearest=subIndex.nearest(event.lon,event.lat,{minimumKv,limit:substationLimit});
const matches=(Array.isArray(nearest)?nearest:(nearest?[nearest]:[])).map(x=>({
name:x.point.name||null,
source_site_id:x.point.code||x.point.site_code||null,
voltages_kv:x.point.voltages_kv,
km:x.km,
location:x.point.location,
note:'Straight-line proximity only; no known electrical connection, protection path or risk.'
}));
const nearby=solar.map(p=>({...p,km:distanceKm(event.lon,event.lat,p.location.lon,p.location.lat)}))
.filter(p=>p.km<=radiusKm)
.sort((a,b)=>a.km-b.km||a.repd_ref.localeCompare(b.repd_ref))
.slice(0,solarLimit)
.map(p=>{
// The established GridAtlas receiver knows these genuine project
// parameters; repd_ref remains the identity, never a flash ID.
const url=new URL(buildDeepLink({
repd_ref:p.repd_ref,technology:p.technology,
latitude:p.location.lat,longitude:p.location.lon,zoom:12
}));
url.searchParams.set('project',p.name);
if(p.capacity_mw!==null)url.searchParams.set('capacity_mw',String(p.capacity_mw));
return {...p,marker_radius_px:solarMarkerRadiusPx(p.capacity_mw),
gridatlas_project_url:url.href,
note:'Registered project centroid/point; distance does not establish a strike or fault.'};
});
return {schema,event,substations:matches,nearby_solar:nearby,
search:{radius_km:radiusKm,minimum_substation_kv:minimumKv,
scanned_geolocated_substations:subIndex.located,
scanned_repd_solar_projects:solar.length},
status:'GEOGRAPHICAL_CONTEXT_ONLY',warning:caveat};
}
});
}
/**
* Post-event diligence prompt, NOT evidence of damage or a diagnosed fault.
* Works only with a real optical observation and actually located source
* records. No site topology, overhead line or weather is inferred from pixels.
*/
function postEventDiligence(context,{
selectedRepdRef=null,overheadLineProximity='unknown',wetWeather='unknown'
}={}) {
if(!context?.event||context.event.kind!=='optical_lightning_flash')
throw new Error('Diligence requires actual selected optical-flash context');
if(!['unknown','nearby','not_reported_nearby'].includes(overheadLineProximity))
throw new RangeError('overheadLineProximity');
if(!['unknown','wet','dry'].includes(wetWeather))throw new RangeError('wetWeather');
const site=selectedRepdRef==null?null:context.nearby_solar
.find(p=>p.repd_ref===String(selectedRepdRef));
if(selectedRepdRef!=null&&!site)throw new Error('Select a genuine nearby REPD project');
const actions=[
'Review IMD alarm/event logs and insulation-resistance trend, where an IMD is installed.',
'Review inverter RCMU/residual-current and protection-trip logs around the observation time.',
'Check SPD status indicators and surge counters; inspect and replace operated units under site procedures.',
'Consider safe, suitably authorised insulation-resistance testing of DC strings and AC feeders.',
'Check earthing and bonding continuity, especially long AC runs and known overhead-line interfaces.',
'Inspect connectors and cable terminations; use thermography where appropriate.',
'Record weather and moisture conditions and compare with site-specific PV-to-earth leakage/capacitance history.'
];
return {
schema:'ventus-grid-engine.post-event-diligence.v1',
observation:context.event,
site:site?{repd_ref:site.repd_ref,name:site.name,distance_km:site.km}:null,
assumed_inputs:{overheadLineProximity,wetWeather},
actions,
recommendation:'Observed lightning activity near a mapped asset: consider a post-event inspection as engineering diligence, not as a diagnosis.',
overhead_note:overheadLineProximity==='nearby'
?'Overhead line/pylon proximity was explicitly supplied; consider earth-potential rise and conducted surge paths.'
:'Overhead line/pylon proximity UNKNOWN or not reported; it is NOT inferred from the optical flash.',
weather_note:wetWeather==='wet'
?'Wet conditions explicitly supplied; review site-specific leakage and capacitance, not a universal multiplier.'
:'Weather not established by the optical observation; do not infer moisture or PV-to-earth capacitance.',
solver_status:'NOT_RUN',
causation_established:false,
other_possible_causes:['Grid switching transients','Equipment failure',
'Insulation ageing/degradation','Moisture ingress','Second IT earth fault'],
disclaimer:'EUMETSAT optical flash, NOT necessarily a ground strike or evidence any asset was hit. Other sources may cause surges, currents or damage. Inspection is a diligence recommendation, NOT a fault diagnosis.'
};
}
/**
* Scenario SETUP, not an electrical calculation. A user must specify the actual
* inverter earthing topology and hypothetical surge. Never infer from LI pixels.
*/
function lightningElectricalScenario(context,{
acEarthing='unspecified',dcReference='unspecified',
inverterIsolation='unspecified',selectedRepdRef=null
}={}) {
if(!context?.event||context.event.kind!=='optical_lightning_flash')
throw new Error('Scenario requires actual selected optical-flash context');
if(!['IT','TN','TT','unspecified'].includes(acEarthing))throw new RangeError('acEarthing');
if(!['floating','functional_earthed','unspecified'].includes(dcReference))
throw new RangeError('dcReference');
if(!['transformerless','isolated','unspecified'].includes(inverterIsolation))
throw new RangeError('inverterIsolation');
const selected=selectedRepdRef==null?null:context.nearby_solar
.find(p=>p.repd_ref===String(selectedRepdRef));
if(selectedRepdRef!=null&&!selected)throw new Error('Select a genuine nearby REPD project');
const base=['Actual installation SLD, voltage classes, inverter manufacturer/model and galvanic isolation',
'Cable circuit lengths/geometry, sheath/screen/PE connections, insulation withstand and locations',
'Transformer windings, earth electrode/bonding impedances incl. impulse/frequency dependence',
'SPD types, placement, protective ratings and equipment withstand curves',
'Assumed surge injection point, waveform/current magnitude and return path — NOT from satellite data'];
const scenarios=[
{id:'induced_surge',label:'Hypothetical nearby induced surge',needs:[
'Mutual electromagnetic coupling, conductor loop areas and cable/shield transients',...base]},
{id:'earth_potential_rise',label:'Assumed attachment and earth potential rise',needs:[
'Manually defined hypothetical attachment location and soil/earth-grid impedance',...base]},
{id:'it_ac_first_second_fault',label:'IT AC first and second earth fault',applicable:acEarthing==='IT',
needs:['IMD function and setpoints, first-fault current return paths, second independent earth fault',
'Isolation/disconnection protection, anti-PID functional earthing interactions',...base]},
{id:'floating_dc_string',label:'Floating DC string-to-earth and second fault',
applicable:dcReference==='floating',
needs:['DC polarity-to-PE leakage/capacitance, module frame/structures and combiner protection',
'Arc/insulation monitoring; inverter common-mode model when actually available',...base]},
{id:'ac_dc_coupled',label:'Hypothetical AC/inverter/DC/PE transient coupling',
needs:['Manufacturer-validated inverter common-mode and DC/AC isolation equivalent circuits',...base]}
];
return {schema:'ventus-grid-engine.lightning-electrical-scenario.v1',
source_observation:context.event,
site:selected?{repd_ref:selected.repd_ref,name:selected.name,capacity_mw:selected.capacity_mw}:null,
assumed_configuration:{acEarthing,dcReference,inverterIsolation},
candidate_scenarios:scenarios,
solver_status:'NOT_RUN',results:null,causation_established:false,
disclaimer:'Parametric thought experiment only: NOT a measured strike, diagnosed site fault, protection study, safety/compliance assessment or asset risk score.'};
}
// <<< lightning end
return { schema: schema, caveat: caveat, solarMarkerRadiusPx: solarMarkerRadiusPx, lightningMarker: lightningMarker, createLightningContextEngine: createLightningContextEngine, postEventDiligence: postEventDiligence, lightningElectricalScenario: lightningElectricalScenario };
})();
// ==== glue (W10): PILOT-order helpers and wiring; no maths of its own
geo.SOURCE = 'Ventusltd/grid-distance-maths@8e91b07d8312acca5bcaef43e839f06a3b1d642a src/geodesy.mjs';
geo.EARTH_NOTE = 'Distances use a sphere of radius 6378.137 km (as GridAtlas and the Ventus Grid Engine): a screening approximation, about 0.1 % from the ellipsoid.';
// PILOT order is lat-first; the estate's functions are lon-first. distM/bearing use the ENGINE's own distanceKm /
// initialBearingDeg (families 511 / 8770; 1-ulp parity with GridAtlas and the engine).
geo.distM = function (lat1, lon1, lat2, lon2) { return engine.distanceKm(lon1, lat1, lon2, lat2) * 1000; };
geo.bearing = function (lat1, lon1, lat2, lon2) { return engine.initialBearingDeg(lon1, lat1, lon2, lat2); };
geo.caveatText = function (keys) { return (keys || ['distance', 'coverage']).map(function (k) { return geo.STRAIGHT_LINE_CAVEAT[k]; }).join(' '); };
var estate = { geo: geo, voltagesKv: engine.voltagesKv, engine: engine, nearest: nearest, deeplink: deeplink, lightning: lightning };
if (typeof module !== 'undefined' && module.exports) module.exports = estate;
if (typeof window === 'undefined' || !window.PILOT) return;
var P = window.PILOT;
P.module('estate', { version: '1', owner: 'W10' });
P.estate = estate;
P.geo = geo;
P.dist = geo.distM; // one earth radius for every module (review finding 2)
P.bearing = geo.bearing;
})();Pilot Goto
A style sheet in the theme folder of Cosmic.
rendercosmic / tools/explore/theme/pilot-goto.css · lines 1–43 of 43 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Downstream impact
- Used directly by 1 file: Pilot (cosmic, https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html).
- What it achieves
- Pilot module "goto" (W02 / WAYPOINT-27).
- Why it matters
- Loaded by the Pilot page at https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html.
- Application
- cosmic · tools/explore/theme · style sheet
- Uses
- none found
- Used by
- loaded by Pilot (stylesheet)
- 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
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/theme/pilot-goto.css:1-43 · blob f6d11e3fb6d7081b1578bfbb38385584bad1cc9c · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
/* Pilot module "goto" (W02 / WAYPOINT-27). Every selector prefixed p-goto-; colours follow pilot.css tokens. */
.p-goto-form { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.p-goto-lab, .p-goto-cap { font-size: 10px; letter-spacing: .12em; color: var(--dim, #a6adbb); margin: 0; }
.p-goto-row { display: flex; gap: 6px; align-items: center; min-width: 0; flex-wrap: wrap; }
.p-goto-q { flex: 1 1 160px; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 0 10px; font: 16px ui-monospace, Menlo, Consolas, monospace;
color: #fff; background: #05080d; border: 1px solid var(--line, #2f343d); border-radius: 6px; }
.p-goto-q:focus { border-color: var(--acc, #00ffff); outline: none; }
.p-goto-go { flex: 0 0 auto; min-width: 64px; }
.p-goto-status { margin: 2px 0; color: var(--dim, #a6adbb); overflow-wrap: anywhere; }
.p-goto-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.p-goto-res { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: 44px; box-sizing: border-box; padding: 6px 10px; text-align: left;
font: 12px ui-monospace, Menlo, monospace; color: #fff; background: var(--panel, rgba(11, 14, 20, .86)); border: 1px solid var(--line, #2f343d); border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
.p-goto-res:hover, .p-goto-res:focus-visible { border-color: var(--acc, #00ffff); }
.p-goto-res b { color: var(--acc, #00ffff); font-weight: 600; }
.p-goto-res span { color: #d8dde6; } .p-goto-res small { color: var(--dim, #a6adbb); font-size: 10px; }
.p-goto-recent { margin-top: 6px; } .p-goto-recent .p-goto-row { justify-content: space-between; }
.p-goto-dim { color: var(--dim, #a6adbb); } .p-goto-foot { font-size: 10px; margin: 8px 0 0; }
.p-goto-ll { overflow-wrap: anywhere; }
.p-goto-chip { display: flex; align-items: center; gap: 6px; max-width: 100%; box-sizing: border-box; padding: 4px 4px 4px 10px; background: var(--panel, rgba(11, 14, 20, .86));
border: 1px solid var(--acc, #00ffff); border-radius: 6px; }
.p-goto-chipt { flex: 1 1 auto; min-width: 0; font-size: 11px; color: #fff; overflow-wrap: anywhere; }
.p-goto-fly { color: #000; background: var(--acc, #00ffff); border-color: var(--acc, #00ffff); font-weight: 600; }
.p-goto-os { color: var(--acc, #00ffff); white-space: nowrap; }
/* overview map picker */
.p-goto-ov { position: fixed; inset: 0; z-index: 40; background: #0b0e14; overflow: hidden; outline: none; }
.p-goto-ov[hidden] { display: none; }
.p-goto-tiles { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.p-goto-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; user-select: none; -webkit-user-select: none; pointer-events: none; }
.p-goto-cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; }
.p-goto-cross::before, .p-goto-cross::after { content: ''; position: absolute; background: #000a; }
.p-goto-cross::before { left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; } .p-goto-cross::after { top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; }
.p-goto-me { position: absolute; left: -9px; top: -9px; width: 0; height: 0; pointer-events: none; border: 9px solid transparent; border-bottom: 18px solid #ff2d95; border-top: 0; transform-origin: 9px 9px; filter: drop-shadow(0 0 2px #000); }
.p-goto-pin { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; box-sizing: border-box; border: 3px solid #00ffff; border-radius: 50%; background: #0008; pointer-events: none; box-shadow: 0 0 0 2px #000; }
.p-goto-ovbar { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; display: flex; gap: 6px; }
.p-goto-ovbar .p-goto-ovclose { margin-right: auto; }
.p-goto-ovinfo { position: absolute; left: 8px; right: 8px; bottom: calc(34px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: center;
padding: 6px 6px 6px 10px; background: var(--panel, rgba(11, 14, 20, .9)); border: 1px solid var(--line, #2f343d); border-radius: 6px; }
.p-goto-ovtxt { flex: 1 1 auto; min-width: 0; margin: 0; color: #fff; overflow-wrap: anywhere; }
.p-goto-ovfly[disabled] { opacity: .45; cursor: default; }
.p-goto-ovfly:not([disabled]) { color: #000; background: var(--acc, #00ffff); border-color: var(--acc, #00ffff); font-weight: 600; }
.p-goto-attr { position: absolute; right: 0; bottom: env(safe-area-inset-bottom, 0px); margin: 0; padding: 4px 8px; font-size: 11px; background: #fffd; color: #222; }
.p-goto-attr a { color: #0645ad; }
@media (min-width: 900px) { .p-goto-ovinfo { left: auto; width: 460px; } }