Sea routing: Suez and Panama crossings, great circles, fastest design back on par
After #133 the coastline router treated Egypt and Panama as solid land, so Marseille–Singapore sailed round Africa (21,440 km instead of 12,175) and Miami–Lima round Cape Horn (17,700 km for a 4,220 km hop). Real systems cross both by land: Port Said to Suez beside the canal, and Panama (PAN AM). These are now overland edges in the sea graph, priced as the distance they cover. The Red Sea Crisis shuts Suez, and routes are cached per set of open passages, also in the survey worker. Long open-water legs follow the great circle where it stays at sea, instead of a straight line on the map. The low-latency design may land further off and backhaul overland, and may follow the corridor of the fastest in-service cable on the pair when that is shorter, so it matches Hibernia again (London–New York 25.3 ms, Halifax–London 20.9 ms) and beats cables that take detours (Lagos–Bude 32.2 against 37.6 ms). Tests: main's expectations restored where #133 had loosened them (Marseille–Singapore needs no upgrades, New York–Sydney needs terminals, express equals the fastest cable); the marine check knows the passages; new checks for Suez, Panama, the crisis and the corridor rule.
This commit is contained in:
parent
656e904e05
commit
56f2d446ea
5 changed files with 105 additions and 39 deletions
|
|
@ -708,7 +708,7 @@ test('subsea cable designs trade construction cost and time for previewed latenc
|
|||
assert.ok(quotes[1].cost >= quotes[0].cost * 3 && quotes[2].cost >= quotes[0].cost * 7);
|
||||
assert.ok(quotes[1].days >= Math.round(quotes[0].days * 1.3) && quotes[2].days >= Math.round(quotes[0].days * 1.7));
|
||||
assert.ok(quotes[2].days < 3 * 365, 'a low-latency Atlantic cable takes years, not most of a decade');
|
||||
assert.equal(quotes[2].km, ev("seaLength(seaRoutes('lon','nyc')[2].pts)"), 'express length follows its surveyed marine path');
|
||||
assert.equal(quotes[2].ms, ev("Math.min(...cablesFor('lon','nyc').map(c=>linkLat({kind:'wave',km:c.km,cable:c.cid})))"), 'express competes with Hibernia');
|
||||
for (const q of quotes) assert.ok(dom.window.document.getElementById('modalCard').textContent.includes(q.ms.toFixed(1) + ' ms one-way'), 'every latency is visible before ordering');
|
||||
for (const [i, design] of ['standard', 'optimized', 'express'].entries()) {
|
||||
ev("UI.lmode='df';UI.dfSrc='cable';openLinkModal('lon','nyc')");
|
||||
|
|
@ -842,22 +842,22 @@ test('own subsea cables after #78: refunds of what was paid, upgrades a route ne
|
|||
assert.equal(ev('UI.seaDesign'), 'standard', 'the next order starts from the standard design');
|
||||
// its latency is worked out once per route, and stays the same
|
||||
const ms = ev('linkLat(S.links.at(-1))'); assert.equal(ev('linkLat(S.links.at(-1))'), ms); assert.ok(ev('SEA_XF.size') >= 1);
|
||||
// New York to Sydney needs optical engineering: the screen says so and will not order without them
|
||||
// New York to Sydney needs premium terminals: the screen says so and will not order without them
|
||||
open('nyc', 'syd');
|
||||
assert.match(q('.why'), /Add Optical engineering/);
|
||||
assert.match(q('.why'), /Add Premium submarine terminals/);
|
||||
assert.doesNotMatch(ev("document.getElementById('modalCard').textContent"), /A leased .* wave on this route/, 'no leased wave reaches that far, so no comparison with one');
|
||||
assert.equal(ev("document.querySelector('#modalCard [data-act=orderCable]').disabled"), true);
|
||||
const n = ev('S.links.length'); ev('ACT.orderCable()'); assert.equal(ev('S.links.length'), n, 'the order itself checks too');
|
||||
ev("document.querySelector('#modalCard [data-act=seaPackage][data-args*=engineering]').click()");
|
||||
assert.equal(q('.why'), null); assert.match(q('[data-act=seaPackage][data-args*=engineering]'), /\+180 days/);
|
||||
ev("document.querySelector('#modalCard [data-act=seaPackage][data-args*=terminal]').click()");
|
||||
assert.equal(q('.why'), null); assert.match(q('[data-act=seaPackage][data-args*=terminal]'), /\+30 days/);
|
||||
// leaving and coming back to another route starts fresh
|
||||
open('lon', 'nyc'); assert.equal(ev('!!UI.seaengineering'), false);
|
||||
open('nyc', 'syd'); ev("document.querySelector('#modalCard [data-act=seaPackage][data-args*=engineering]').click();ACT.orderCable()");
|
||||
open('lon', 'nyc'); assert.equal(ev('!!UI.seaterminal'), false);
|
||||
open('nyc', 'syd'); ev("document.querySelector('#modalCard [data-act=seaPackage][data-args*=terminal]').click();ACT.orderCable()");
|
||||
const syd = JSON.parse(ev("JSON.stringify(S.links.at(-1))"));
|
||||
assert.equal(syd.b, 'syd'); assert.equal(syd.subengineering, syd.ready);
|
||||
ev('S.day=S.links.at(-1).ready'); assert.equal(ev("optG('tp16',S.links.at(-1))"), 400, 'lit across the surveyed marine route');
|
||||
assert.equal(syd.b, 'syd'); assert.equal(syd.subterminal, syd.ready);
|
||||
ev('S.day=S.links.at(-1).ready'); assert.equal(ev("optG('tp16',S.links.at(-1))"), 400, 'lit across 18,387 km');
|
||||
// upgrades bought later count toward the price; sanitize keeps a sane price and drops junk
|
||||
ev("S.links.at(-1).subterminal=undefined;ACT.subUpgrade({id:S.links.at(-1).id,k:'terminal'})");
|
||||
ev("S.links.at(-1).subengineering=undefined;ACT.subUpgrade({id:S.links.at(-1).id,k:'engineering'})");
|
||||
assert.ok(ev('S.links.at(-1).paid') > syd.paid);
|
||||
ev("S.links.at(-1).paid='lots';S.links[0].paid=-5;S=sanitize(S)");
|
||||
assert.equal(ev('S.links.at(-1).paid'), undefined); assert.equal(ev('S.links[0].paid'), undefined);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue