400G cache boxes behind 400G or faster router ports
This commit is contained in:
parent
6b8791c605
commit
7202441716
21 changed files with 55 additions and 29 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* ================= CONSTANTS ================= */
|
||||
const W=2000, H=1000, KM=14;
|
||||
const POP_COST=20000, POP_MO=1500, EYE_RATE=150, CACHE_CAP=100, CACHE_MO=400;
|
||||
const POP_COST=20000, POP_MO=1500, EYE_RATE=150, CACHE_CAP=100, CACHE_MO=400, CACHE_BIG=400, CACHE_BIG_MO=1000;
|
||||
const DAY_MS=2500, ROUTER_COST=15000, ROUTER_MO=1500, GEN_COST=12000, GEN_MO=600, DIVERSE=1.4;
|
||||
const RU_BOX=40000, RU_BOX_MO=2000;
|
||||
const UAE_LIC=15000,KSA_LIC=25000;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ const PORT_SLOT=i=>i===0?0.25:1;
|
|||
// (a 3.2T port takes 32), per site (#252).
|
||||
const portG=g=>{const s=RG[g].pn;return parseFloat(s)*(s.endsWith('T')?1000:1);};
|
||||
const cachePerPort=(c,g)=>{const p=S.pops[c];return p?Math.max(1,Math.floor(portG(g===undefined?(p.rgen||0):g)/CACHE_CAP)):1;};
|
||||
function cachePorts(c,extra=[],g){const n={a:0,b:0};for(const x of S.caches)if(x.city===c)n[x.site==='b'?'b':'a']++;for(const x of extra)n[x.site==='b'?'b':'a']++;
|
||||
const k=cachePerPort(c,g);return Math.ceil(n.a/k)+Math.ceil(n.b/k);}
|
||||
// Boxes come in 100G and, behind 400G or faster router ports, 400G: cheaper per Gbps.
|
||||
const cacheG=x=>x.g===CACHE_BIG?CACHE_BIG:CACHE_CAP,cacheMo=x=>x.g===CACHE_BIG?CACHE_BIG_MO:CACHE_MO,cachesMo=()=>S.caches.reduce((a,x)=>a+cacheMo(x),0);
|
||||
const cacheBox=c=>{const p=S.pops[c];return p&&portG(p.rgen||0)>=CACHE_BIG?{g:CACHE_BIG}:{};};
|
||||
function cachePorts(c,extra=[],g){const n={a:0,b:0};for(const x of S.caches)if(x.city===c)n[x.site==='b'?'b':'a']+=cacheG(x);for(const x of extra)n[x.site==='b'?'b':'a']+=cacheG(x);
|
||||
const p=S.pops[c],k=p?portG(g===undefined?(p.rgen||0):g):CACHE_CAP;return Math.ceil(n.a/k-1e-9)+Math.ceil(n.b/k-1e-9);}
|
||||
const cachePortsAdd=(c,adds)=>cachePorts(c,adds)-cachePorts(c);
|
||||
function portsUsed(c,g){let u=0;
|
||||
for(const l of S.links){if(l.a!==c&&l.b!==c||l.kind==='vxc')continue;u+=l.kind==='df'?(l.ch||[]).length:1;}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue