From 3deb7cf8593d6a8e3590cbf473e5e611ceddd8e3 Mon Sep 17 00:00:00 2001 From: Simone <26844016+simonebortolin@users.noreply.github.com> Date: Wed, 11 Jan 2023 20:21:52 +0100 Subject: fix (#99) Co-authored-by: Simone Bortolin --- _tools/speed-gpon-eth.md | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/_tools/speed-gpon-eth.md b/_tools/speed-gpon-eth.md index 2a1b333..a180c72 100644 --- a/_tools/speed-gpon-eth.md +++ b/_tools/speed-gpon-eth.md @@ -61,15 +61,18 @@ layout: default -

Gpon calculator

+

XG(S)-PON/GPON calculator

- - + +
@@ -96,9 +99,13 @@ layout: default
+
+ + +
- +
@@ -156,10 +163,10 @@ layout: default var mtu = formdata.get('mtu'); var mss = mtu - coverheadip; var overhead = overheadtcp + overheadeth + overheadfcs + overheadgap[formdata.get('speed')] + preamble + coverheadip; - document.getElementById('overhead').value = overhead/mss * 100; + document.getElementById('overhead').value = ((1-mss /(overhead + mss)) * 100).toFixed(2); var th = mss /(overhead + mss); - document.getElementById('maxSpeed').value = th * formdata.get('speed'); + document.getElementById('maxSpeed').value = (th * formdata.get('speed')).toFixed(2); } [...form.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true)); }); @@ -197,15 +204,21 @@ layout: default var cip = formdata.get('gpon-ip'); var coverheadip = formdata.get('gpon-ip') === '4' ? overheadipv4[formdata.get('gpon-ipv4protocol')] : overheadipv6[formdata.get('gpon-ipv6protocol')]; var overheadframeeth = overheadtcp + overheadeth + overheadfcs + coverheadip; - var overheadgtc = overheadgem + formdata.get('gpon-gem') * (overheadpcbd+overheadframeeth); - var payload = gtc - overheadgtc; - document.getElementById('gpon-average-packet-size').value = payload/formdata.get('gpon-gem'); + var gem, overheadgtc, payload; + for(gem = 0; gem < 40; gem++) { + overheadgtc = overheadgem + gem * (overheadpcbd+overheadframeeth); + payload = gtc - overheadgtc; + if(payload/gem < 1500) break; + } + + document.getElementById('gpon-gem-real').value = gem; + document.getElementById('gpon-average-packet-size').value = (payload/gem).toFixed(2); - document.getElementById('gpon-overhead').value = overheadgtc/payload * 100; + document.getElementById('gpon-overhead').value = ((1-payload/(payload+overheadgtc)) * 100).toFixed(2); var th = payload /gtc; - document.getElementById('gpon-maxSpeed').value = th * 2.48832; + document.getElementById('gpon-maxSpeed').value = (th * formdata.get('gpon-speed')).toFixed(2); } [...formgpon.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true)); }); -- cgit v1.2.3