A plug-in optic too short for a subsea cable is no longer sent to upgrades that cannot stretch it (closes #253)
On an own subsea cable, the hint under an optic that cannot reach the route said "Consider submarine terminals or optical engineering" for every optic. Those upgrades only lengthen the Sienna WaveMagic 1.6T and 3.2T transponder modes (optModes()); the 400ZR+ and 800ZR+ plug-ins gain nothing, also with both upgrades in service. Perth to Cape Town (8,891 km) showed it: 800ZR+ reaches 5,400 km and the advice was to buy $17M of upgrades that change nothing. chWhy() now asks whether the optic would reach with both upgrades in service (withSubUps()). If so, the advice stays. If not, the hint says the upgrades do not stretch this optic and names the optics that do reach the route. A consortium seat and a leased line keep their own message.
This commit is contained in:
parent
66aaaec5f1
commit
0bf27a66c7
10 changed files with 93 additions and 1 deletions
|
|
@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- A plug-in optic that is too short for your subsea cable no longer sends you to submarine terminals and optical engineering, which cannot stretch it (#253). The hint now names the optics that do reach, such as the Sienna WaveMagic 1.6T for Perth to Cape Town. Optics the upgrades can stretch still get the advice.
|
||||
|
||||
- 400G cache boxes: a POP whose routers have 400G or faster ports now gets 400G boxes, at $1,000 a month instead of $400 for 100G, so big caches need fewer boxes and cost less per Gbps. Boxes you already have stay as they are.
|
||||
- Pick a standard POP: in any POP's Infra tab, make its routers the standard, and every new POP gets that model and number of routers right away, while it is still empty (#240).
|
||||
- Clarovision now peers only over paid PNIs, like the real carrier, and free only with networks at customer level 11 or above (#213). A PNI you already have with it starts paying the fee.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"action_helpers.this_channel_reaches_max_km_on":"Dieser Kanal reicht auf diesem Kabel {max} km weit; die Strecke ist {span} km lang. Denk über Unterwasser-Terminals oder optisches Engineering nach.",
|
||||
"action_helpers.too_far_even_at_its_slowest":"Zu weit, selbst in der langsamsten Einstellung: Ein optischer Abschnitt ist hier {span} km lang, die Reichweite beträgt {max} km. Füge einen Regenerator-Standort hinzu (Line System).",
|
||||
"action_helpers.unlocks_at_customer_level_n":"Wird ab Kundenlevel {n} freigeschaltet.",
|
||||
"action_helpers.upgrades_cannot_stretch_this_optic":"Dieser Kanal reicht auf diesem Kabel {max} km weit; die Strecke ist {span} km lang. Unterwasser-Terminals und optisches Engineering verlängern diese Optik nicht. Diese reichen so weit: {optics}.",
|
||||
"actions.your_router_can_t_take_a":"<b>Dein Router kann keinen {port}-Port aufnehmen.</b><br>Rüste ihn im Tab Infra auf.",
|
||||
"architect.anchor":"🐒 Platsch!",
|
||||
"architect.architect_runs":"Architekt-Runs",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"action_helpers.this_channel_reaches_max_km_on":"Este canal llega a {max} km en este cable; la ruta mide {span} km. Considera terminales submarinas o ingeniería óptica.",
|
||||
"action_helpers.too_far_even_at_its_slowest":"Demasiado lejos incluso en su ajuste más lento: aquí un tramo óptico mide {span} km y el alcance es de {max} km. Añade un sitio regenerador (Sistema de línea).",
|
||||
"action_helpers.unlocks_at_customer_level_n":"Se desbloquea en el nivel de cliente {n}.",
|
||||
"action_helpers.upgrades_cannot_stretch_this_optic":"Este canal llega a {max} km en este cable; la ruta mide {span} km. Las terminales submarinas y la ingeniería óptica no alargan esta óptica. Estas sí llegan: {optics}.",
|
||||
"actions.your_router_can_t_take_a":"<b>Tu router no admite un puerto de {port}.</b><br>Mejóralo en la pestaña Infra.",
|
||||
"architect.anchor":"🐒 ¡Chof!",
|
||||
"architect.architect_runs":"Partidas de arquitecto",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"action_helpers.this_channel_reaches_max_km_on":"Ce canal porte à {max} km sur ce câble ; le tracé fait {span} km. Pense aux terminaux sous-marins ou à l’ingénierie optique.",
|
||||
"action_helpers.too_far_even_at_its_slowest":"Trop loin, même au débit le plus lent : ici une portée optique fait {span} km et l’optique va jusqu’à {max} km. Ajoute un site de régénération (Système de ligne).",
|
||||
"action_helpers.unlocks_at_customer_level_n":"Se débloque au niveau client {n}.",
|
||||
"action_helpers.upgrades_cannot_stretch_this_optic":"Ce canal porte à {max} km sur ce câble ; le tracé fait {span} km. Les terminaux sous-marins et l’ingénierie optique n’allongent pas cette optique. Celles-ci y arrivent : {optics}.",
|
||||
"actions.your_router_can_t_take_a":"<b>Ton routeur ne supporte pas de port {port}.</b><br>Mets-le à niveau dans l’onglet Infra.",
|
||||
"architect.anchor":"🐒 Plouf !",
|
||||
"architect.architect_runs":"Parties d’architecte",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"action_helpers.this_channel_reaches_max_km_on":"Questo canale raggiunge {max} km su questo cavo; il percorso è di {span} km. Valuta terminali sottomarini o ingegneria ottica.",
|
||||
"action_helpers.too_far_even_at_its_slowest":"Troppo lontano anche alla velocità più bassa: qui una tratta ottica è di {span} km e l’ottica arriva a {max} km. Aggiungi un sito di rigenerazione (Sistema di linea).",
|
||||
"action_helpers.unlocks_at_customer_level_n":"Si sblocca al livello cliente {n}.",
|
||||
"action_helpers.upgrades_cannot_stretch_this_optic":"Questo canale raggiunge {max} km su questo cavo; il percorso è di {span} km. Terminali sottomarini e ingegneria ottica non allungano quest’ottica. Ci arrivano: {optics}.",
|
||||
"actions.your_router_can_t_take_a":"<b>Il tuo router non regge una porta {port}.</b><br>Aggiornalo nella scheda Infra.",
|
||||
"architect.anchor":"🐒 Splash!",
|
||||
"architect.architect_runs":"Partite da architetto",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"action_helpers.this_channel_reaches_max_km_on":"Este canal alcança {max} km neste cabo; a rota tem {span} km. Considere terminais submarinos ou engenharia óptica.",
|
||||
"action_helpers.too_far_even_at_its_slowest":"Longe demais até na configuração mais lenta: um span óptico aqui tem {span} km e ela alcança {max} km. Adicione um site de regeneração (Line system).",
|
||||
"action_helpers.unlocks_at_customer_level_n":"Desbloqueia no nível de cliente {n}.",
|
||||
"action_helpers.upgrades_cannot_stretch_this_optic":"Este canal alcança {max} km neste cabo; a rota tem {span} km. Terminais submarinos e engenharia óptica não esticam esta óptica. Estas chegam lá: {optics}.",
|
||||
"actions.your_router_can_t_take_a":"<b>Seu router não aguenta uma porta {port}.</b><br>Faça upgrade na aba Infra.",
|
||||
"architect.anchor":"🐒 Tchibum!",
|
||||
"architect.architect_runs":"Partidas de arquiteto",
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ function optModes(o,l){return (OPT[o].modes||[[OPT[o].g,OPT[o].reach]]).map(([g,
|
|||
}
|
||||
return [g,reach];});}
|
||||
function optMode(o,l){const km=spanKm(l);for(const [g,r] of optModes(o,l))if(km<=r)return {g,reach:r,full:g===OPT[o].g};return null;}
|
||||
// The same cable with both subsea upgrades in service: if an optic still falls short, no upgrade can stretch it.
|
||||
const withSubUps=l=>({...l,subterminal:0,subengineering:0});
|
||||
// The longest subsea span any optic lights with these upgrades in service, and the cheapest upgrades a length needs
|
||||
// (null: nothing can light it). The length limit, the order screen and refunds all use these, so they agree.
|
||||
const SUBR=[],subReach=(t,e)=>SUBR[(t?1:0)+(e?2:0)]??(SUBR[(t?1:0)+(e?2:0)]=Math.max(...Object.keys(OPT).flatMap(o=>optModes(o,{kind:'df',own:true,sub:true,subterminal:t?0:undefined,subengineering:e?0:undefined}).map(m=>m[1])))),
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@ function optCost(o){return Math.round(OPT[o].cost*techMul(OPT[o].lvl)*hwMul('opt
|
|||
const sysNext=l=>l.sys==='lite'?'roadm':l.sys==='roadm'?'cl':null,sysUpCost=l=>{const t=sysNext(l);return t?sysCost(t)*(t==='cl'&&l.own?Math.max(1,l.pairs|0):1):0;};
|
||||
function pairBtn(l){if(!l.own||!isRdm(l.sys)||l.ready>S.day)return '';const n=Math.max(1,l.pairs|0);if(n>=pairsMax(l))return `<span class="meta" style="align-self:center">${tr('action_helpers.n_fiber_pairs_lit_the_trench',{n})}</span>`;
|
||||
const full=(l.ch||[]).length+soldSlots(l)>=chMax(l),c=pairCost(l);return btn(l.sub?tr('action_helpers.light_fiber_pair_n_price',{n:n+1,price:fmt$(c)}):tr('action_helpers.light_fiber_pair_n_price_mo',{n:n+1,price:fmt$(c),mo:fmt$(ampCount(l.km)*AMP_MO)}),'addPair',{id:l.id},full?'pink sm':'ghost sm',!full||S.cash<c);}
|
||||
function chWhy(l,o){const O=OPT[o];if(!techOk('opt',o,O.lvl))return tr('action_helpers.unlocks_at_customer_level_n',{n:O.lvl});if(O.sys==='roadm'&&!isRdm(l.sys))return tr('action_helpers.needs_a_roadmaster_9000_line_system');if(!optMode(o,l)){const mx=optModes(o,l).at(-1)[1];if(l.sub&&l.own&&!l.seat)return tr('action_helpers.this_channel_reaches_max_km_on',{max:mx.toLocaleString(),span:spanKm(l).toLocaleString()});return tr('action_helpers.too_far_even_at_its_slowest',{span:spanKm(l).toLocaleString(),max:mx.toLocaleString()});}
|
||||
function chWhy(l,o){const O=OPT[o];if(!techOk('opt',o,O.lvl))return tr('action_helpers.unlocks_at_customer_level_n',{n:O.lvl});if(O.sys==='roadm'&&!isRdm(l.sys))return tr('action_helpers.needs_a_roadmaster_9000_line_system');if(!optMode(o,l)){const mx=optModes(o,l).at(-1)[1];if(l.sub&&l.own&&!l.seat){const v={max:mx.toLocaleString(),span:spanKm(l).toLocaleString()};
|
||||
// Terminals and engineering only stretch the long-haul transponders: where they cannot help this optic, say what reaches instead.
|
||||
if(!optMode(o,withSubUps(l))){const alt=Object.keys(OPT).filter(x=>(OPT[x].sys!=='roadm'||isRdm(l.sys))&&optMode(x,withSubUps(l))).map(x=>OPT[x].n);if(alt.length)return tr('action_helpers.upgrades_cannot_stretch_this_optic',{...v,optics:alt.join(', ')});}
|
||||
return tr('action_helpers.this_channel_reaches_max_km_on',v);}return tr('action_helpers.too_far_even_at_its_slowest',{span:spanKm(l).toLocaleString(),max:mx.toLocaleString()});}
|
||||
if((l.ch||[]).length+soldSlots(l)>=chMax(l))return soldSlots(l)?tr('action_helpers.sys_is_full_max_channels_sold',{sys:DF_SYS[l.sys].n,max:chMax(l),sold:soldSlots(l)}):tr('action_helpers.sys_is_full_max_channels',{sys:DF_SYS[l.sys].n,max:chMax(l)});
|
||||
for(const c of [l.a,l.b]){const p=S.pops[c];if(p&&RG[p.rgen||0].cls<O.rg)return tr('action_helpers.needs_routers_with_pn_ports_or',{pn:RG[mainRG(O.rg)].pn,city:CITY[c].name});}return '';}
|
||||
function bbCost(c){return 15000+CITY[c].P*20;}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
"action_helpers.this_channel_reaches_max_km_on":"This channel reaches {max} km on this cable; the route is {span} km. Consider submarine terminals or optical engineering.",
|
||||
"action_helpers.too_far_even_at_its_slowest":"Too far even at its slowest setting: an optical span here is {span} km and it reaches {max} km. Add a regen site (Line system).",
|
||||
"action_helpers.unlocks_at_customer_level_n":"Unlocks at customer level {n}.",
|
||||
"action_helpers.upgrades_cannot_stretch_this_optic":"This channel reaches {max} km on this cable; the route is {span} km. Submarine terminals and optical engineering do not stretch this optic. These reach it: {optics}.",
|
||||
"actions.your_router_can_t_take_a":"<b>Your router can't take a {port} port.</b><br>Upgrade it in the Infra tab.",
|
||||
"architect.anchor":"🐒 Splash!",
|
||||
"architect.architect_runs":"Architect runs",
|
||||
|
|
|
|||
79
tests/sea-optic-hint.test.js
Normal file
79
tests/sea-optic-hint.test.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
// An own subsea cable between Perth and Cape Town (8,891 km with the standard design), lit and ready, with its two POPs.
|
||||
function cable(opts = {}) {
|
||||
const g = load(opts);
|
||||
g.ev(`ACT.start({});S.cash=1e10;S.lvl=13;for(const g of GOALS)S.done[g.id]=0;S.won=true;ACT.launchBB({city:'fra'});
|
||||
for(const c of ['per','cpt']){ACT.buildPop({city:c});S.pops[c].rgen=RG.length-1;}
|
||||
const q=seaQuote('per','cpt','standard');
|
||||
S.links.push({id:'sea1',a:'per',b:'cpt',kind:'df',own:true,sub:true,seaDesign:'standard',seaPath:q.pts.map(p=>p.slice()),sys:'roadm',ch:[],km:q.km,cable:null,cname:'Test',mo:1,trench:'own:sea1',cut:0,day:S.day,ready:0,spares:false,pairs:1});compute()`);
|
||||
g.km = g.ev('S.links[0].km');
|
||||
g.why = (o) => g.ev(`chWhy(S.links[0],'${o}')`);
|
||||
return g;
|
||||
}
|
||||
|
||||
test('a plug-in optic that is too short for a subsea cable is not sent to upgrades that cannot stretch it (#253)', () => {
|
||||
const { ev, why, km, errors } = cable();
|
||||
assert.equal(km, 8891, 'Perth to Cape Town');
|
||||
for (const [o, max] of [['zr8', '5,400'], ['zr4', '4,500']]) {
|
||||
const w = why(o);
|
||||
assert.match(w, new RegExp(`reaches ${max} km on this cable; the route is 8,891 km`), `${o}: still says how far it reaches`);
|
||||
assert.doesNotMatch(w, /Consider submarine terminals/, `${o}: no advice that cannot help`);
|
||||
assert.match(w, /do not stretch this optic/, `${o}: says so`);
|
||||
assert.match(w, /These reach it: Sienna WaveMagic 1\.6T, Sienna WaveMagic 3\.2T\./, `${o}: and names what does reach`);
|
||||
}
|
||||
assert.equal(why('tp16'), '', 'the 1.6T transponder lights it, in its 800G mode');
|
||||
assert.equal(ev("optMode('tp16',S.links[0]).g"), 800);
|
||||
// The upgrades change nothing for the plug-ins, installed or not.
|
||||
ev("S.links[0].subterminal=0;S.links[0].subengineering=0");
|
||||
assert.match(why('zr8'), /do not stretch this optic/, 'with both upgrades installed the advice is the same');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('an optic the upgrades can stretch still gets the advice to consider them, and the advice stops once they are in', () => {
|
||||
const { ev, why, errors } = cable();
|
||||
// A route of 21,000 km: the 1.6T needs engineering (22,500 km at 400G) or both upgrades; terminals alone reach 20,000.
|
||||
ev("S.links[0].km=21000");
|
||||
assert.match(why('tp16'), /Consider submarine terminals or optical engineering\./);
|
||||
assert.doesNotMatch(why('tp16'), /do not stretch/);
|
||||
assert.match(why('zr8'), /do not stretch this optic/, 'the plug-in on the same cable is told something else');
|
||||
ev("S.links[0].subengineering=0");
|
||||
assert.equal(why('tp16'), '', 'with optical engineering in service it is lit');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a consortium seat and a leased line keep their own message', () => {
|
||||
const { ev, why, errors } = cable();
|
||||
ev("S.links[0].seat=true");
|
||||
assert.match(why('zr8'), /Too far even at its slowest setting/);
|
||||
ev("S.links[0].seat=false;S.links[0].own=false");
|
||||
assert.match(why('zr8'), /Too far even at its slowest setting/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the optics list on the cable shows the new hint under the plug-in and none under the transponder', () => {
|
||||
const { ev, dom, errors } = cable();
|
||||
ev("ACT.selLink({id:'sea1'})");
|
||||
const html = dom.window.document.getElementById('panelBody').innerHTML;
|
||||
const rows = html.split('<div class="row">').filter((r) => /Sizzle 800ZR\+|Ackackia 400ZR\+|Sienna WaveMagic 1\.6T/.test(r));
|
||||
const row = (n) => rows.find((r) => r.includes('<div class="nm">' + n)) || ''; // by the optic's own name: other rows name it in their hint
|
||||
assert.match(row('Sizzle 800ZR+'), /do not stretch this optic/);
|
||||
assert.match(row('Ackackia 400ZR+'), /do not stretch this optic/);
|
||||
assert.doesNotMatch(row('Sienna WaveMagic 1.6T'), /do not stretch|Consider submarine/);
|
||||
assert.doesNotMatch(dom.window.document.getElementById('panelBody').textContent, /Consider submarine terminals/, 'no wrong advice anywhere on the panel');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the hint reads right in every language', () => {
|
||||
for (const lang of ['it', 'pt', 'fr', 'es', 'de']) {
|
||||
const { why, errors } = cable({ lang });
|
||||
const w = why('zr8');
|
||||
assert.ok(!/\{[a-z]+\}|action_helpers\./.test(w), `${lang}: no raw placeholders or labels: ${w}`);
|
||||
assert.ok(w.includes('5.400') || w.includes('5,400') || w.includes('5 400') || w.includes('5 400'), `${lang}: the reach is in it: ${w}`);
|
||||
assert.ok(w.includes('Sienna WaveMagic 1.6T'), `${lang}: names the optics that reach`);
|
||||
assert.notEqual(w, cable().why('zr8'), `${lang}: translated`);
|
||||
assert.deepEqual(errors, [], lang);
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue