${tr('Capacity')}
${tr('{n} of {max} channels lit',{n:(l.ch||[]).length,max:sysD.max})}${soldSlots(l)?` · ${tr('{n} sold as alien waves',{n:soldSlots(l)})}`:''}${fmtG(load)} / ${fmtG(cap)}
+ h+=`${tr('Capacity')}
${tr('{n} of {max} channels lit',{n:(l.ch||[]).length,max:chMax(l)})}${soldSlots(l)?` · ${tr('{n} sold as alien waves',{n:soldSlots(l)})}`:''}${fmtG(load)} / ${fmtG(cap)}
${tr('Latency')}${tr('{ms} ms one-way',{ms:linkLat(l).toFixed(1)})}
${l.own?tr('Right-of-way upkeep'):tr('IRU lease')}${tr('{price}/mo',{price:fmt$(l.mo)})}
${tr('{n} amp huts',{n:amps})}${tr('{price}/mo',{price:fmt$(amps*AMP_MO)})}
${!bld&&!(l.ch||[]).length?`${tr('This fiber is dark. Add optics below to carry traffic.')}
`:''}`;
h+=`${tr('Optics')}
${tr('Each channel is a pair of optics, one per end. ZR+ optics plug straight into your routers. Transponders sit on a shelf.')}
`;
for(const k of Object.keys(OPT)){const O=OPT[k],n=(l.ch||[]).filter(x=>x===k).length,why=chWhy(l,k);
@@ -3065,7 +3071,7 @@ function dfPanel(l){
{const st=Object.keys(OPT).filter(k=>spareN(k)>0);h+=`${tr('Unplugged optics go on the spares shelf and are used first next time.')}
`;if(st.length)h+=`${tr('Spares shelf')}
`+st.map(k=>`${spareN(k)} × ${OPT[k].n}
${btn(tr('Sell one
{price}',{price:fmt$(spareValue(k))}),'sellSpare',{o:k},'ghost sm')}
`).join('');}
const rg=l.regen|0,rgAdd=REGEN_COST+Math.round((l.ch||[]).reduce((a,c)=>a+optCost(c),0)*REGEN_CH);
h+=`${tr('Line system')}
${esc(sysD.n)}${tr('{n} amplifiers',{n:amps})}
- ${tr('Regen sites')}${rg?tr('{n} · optical spans of {km} km',{n:rg,km:spanKm(l).toLocaleString()}):tr('none')}
${tr('A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.',{price:fmt$(REGEN_MO)})}
${rg
{price}',{price:fmt$(rgAdd)}),'regen',{id:l.id,d:1},'sm',S.cash${esc(sysD.blurb)}
${l.sys!=='roadm'?btn(lvl()>=3?tr('Upgrade to ROADMaster 9000 {price}',{price:fmt$(DF_SYS.roadm.cost)}):tr('ROADMaster 9000 level 3'),'upSys',{id:l.id},'sm',lvl()<3||S.cash{price}/mo',{price:fmt$(Math.round(150+(l.ch||[]).length*80))}),'spares',{id:l.id},l.spares?'green sm':'sm')}
${tr('Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.')}
`;
+ ${tr('Regen sites')}${rg?tr('{n} · optical spans of {km} km',{n:rg,km:spanKm(l).toLocaleString()}):tr('none')}
${tr('A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.',{price:fmt$(REGEN_MO)})}
${rg
{price}',{price:fmt$(rgAdd)}),'regen',{id:l.id,d:1},'sm',S.cash${esc(sysD.blurb)}
${l.sys!=='roadm'?btn(lvl()>=3?tr('Upgrade to ROADMaster 9000 {price}',{price:fmt$(DF_SYS.roadm.cost)}):tr('ROADMaster 9000 level 3'),'upSys',{id:l.id},'sm',lvl()<3||S.cash{price}/mo',{price:fmt$(Math.round(150+(l.ch||[]).length*80))}),'spares',{id:l.id},l.spares?'green sm':'sm')}
${tr('Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.')}
`;
{const sib=pairLinks(l.a,l.b).filter(x=>x!==l&&x.kind!=='vxc');h+=`${tr('Redundancy')}
${sib.length?tr('Other links between these cities:'):tr('This is the only link between these cities. Add a parallel one, or a path through another city.')}
${sib.map(x=>`${esc(capName(x))} ${linkDown(x)?''+tr('CUT')+'':''}
${(x.trench||x.id)===(l.trench||l.id)?tr('same trench'):tr('diverse route')}
${btn(tr('Open'),'selLink',{id:x.id},'ghost sm')}
`).join('')}${btn(tr('Add parallel link'),'addParallel',{id:l.id},'pink sm')}
`;}
h+=`${trafficSection(l)}${metricSection(l)}${btn(UI.confirm===l.id?tr('Really give it up?'):(l.own?tr('Abandon the fiber'):tr('Cancel the IRU')),'rmLink',{id:l.id},'ghost sm')} `;
return h;
diff --git a/tests/issues.test.js b/tests/issues.test.js
index 9b27d5f..13b30b8 100644
--- a/tests/issues.test.js
+++ b/tests/issues.test.js
@@ -515,3 +515,27 @@ test('#45 unplugged optics go on a spares shelf, get reused for free, or sold fo
assert.deepEqual(JSON.parse(ev('JSON.stringify(S.spares)')), { [o]: 2 });
assert.deepEqual(errors, []);
});
+
+test('#35 your own trench can light another fiber pair once a ROADMaster is full', () => {
+ const { ev, errors } = load();
+ base(ev);
+ ev("S.lvl=4;ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=RG.length-1;S.pops.fra.routers=S.pops.ams.routers=RMAX;S.links.push({id:'own1',a:'fra',b:'ams',kind:'df',own:true,km:450,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0});compute()");
+ assert.equal(ev("chMax(S.links[0])"), 64);
+ ev("ACT.addPair({id:'own1'})");
+ assert.equal(ev("S.links[0].pairs||1"), 1, 'not before the first pair is full');
+ ev("S.links[0].ch=Array(64).fill('zr4');compute()");
+ assert.match(ev("chWhy(S.links[0],'zr4')"), /full/);
+ const c0 = ev('S.cash'), mo0 = ev('R.cost.optical');
+ ev("ACT.addPair({id:'own1'})");
+ assert.equal(ev('S.links[0].pairs'), 2);
+ assert.equal(ev('chMax(S.links[0])'), 128);
+ assert.equal(c0 - ev('S.cash'), ev('pairCost(S.links[0])'), 'a ROADMaster plus a chain of amplifiers');
+ assert.ok(ev('R.cost.optical') > mo0, 'the new amplifier huts cost monthly');
+ assert.ok(!/full/.test(ev("chWhy(S.links[0],'zr4')")), 'room for more channels');
+ // leased fiber and the smaller line system stay at one pair
+ ev("S.links.push({id:'iru',a:'fra',b:'ams',kind:'df',own:false,km:450,sys:'roadm',ch:Array(64).fill('zr4'),ready:0,mo:500,day:0,cut:0});ACT.addPair({id:'iru'})");
+ assert.equal(ev("S.links[1].pairs||1"), 1);
+ ev("S.links[0].pairs=99;S=migrate(JSON.parse(JSON.stringify(S)))");
+ assert.equal(ev('S.links[0].pairs'), 4, 'saves are clamped to four pairs');
+ assert.deepEqual(errors, []);
+});