Tiered Gateway Fleet Calculator
Try Change the number of sensors or gateways, or choose the chapter case.
Observe Compare the average sensors per gateway with the scenario's 100-sensor sizing figure and read the device hardware cost.
Explain Explain what happens to the gateway count and hardware cost as the fleet grows.
Technical boundaries. Counts device hardware only: no cloud services, installation, networking or support. The 500 sensors, 5 gateways, $200, $2 and 100 sensors per gateway come from the chapter's scenario assumptions, not from pricing guarantees.
Prices are in US dollars. Chapter case restores the factory example: 500 sensors behind 5 gateways.
viewof sensors = Inputs. range ([0 , 5000 ], {value : 500 , step : 1 , label : "Sensors" })
viewof gateways = Inputs. range ([0 , 100 ], {value : 5 , step : 1 , label : "Gateways" })
viewof gwPrice = Inputs. range ([0 , 2000 ], {value : 200 , step : 1 , label : "Price per gateway ($)" })
viewof sensorPrice = Inputs. range ([0 , 100 ], {value : 2 , step : 0.5 , label : "Price per sensor ($)" })
{
const button = html `<button type="button">Chapter case</button>`
button. addEventListener ("click" , () => {
(viewof sensors). value = 500 ;
(viewof sensors). dispatchEvent (new Event ("input" , {bubbles : true }));
(viewof gateways). value = 5 ;
(viewof gateways). dispatchEvent (new Event ("input" , {bubbles : true }));
(viewof gwPrice). value = 200 ;
(viewof gwPrice). dispatchEvent (new Event ("input" , {bubbles : true }));
(viewof sensorPrice). value = 2 ;
(viewof sensorPrice). dispatchEvent (new Event ("input" , {bubbles : true }));
})
return button
}
capacity = 100
needed = Math . ceil (sensors / capacity)
gwCost = gateways * gwPrice
sensorCost = sensors * sensorPrice
total = gwCost + sensorCost
usd = n => "$" + n. toLocaleString ("en-US" , {minimumFractionDigits : Number . isInteger (n) ? 0 : 2 , maximumFractionDigits : 2 })
base = gateways > 0 ? Math . floor (sensors / gateways) : 0
extra = gateways > 0 ? sensors % gateways : 0
heaviest = extra > 0 ? base + 1 : base
avgText = gateways === 0 ? "not defined without gateways" : extra === 0 ? ` ${ base} each` : ` ${ + (sensors / gateways). toFixed (2 )} on average; assigned as evenly as possible, ${ extra} gateway ${ extra === 1 ? " carries" : "s carry" } ${ base + 1 } and ${ gateways - extra} ${ gateways - extra === 1 ? "carries" : "carry" } ${ base} `
fit = gateways === 0 ? (sensors === 0 ? "No sensors to aggregate" : "No gateways: nothing aggregates the sensors" ) : heaviest <= capacity ? `Busiest gateway carries ${ heaviest} , within the scenario's ${ capacity} -sensor figure` : `Busiest gateway carries ${ heaviest} , over the scenario's ${ capacity} -sensor figure by ${ heaviest - capacity} `
html `<div aria-live="polite"><p><strong>Sensors per gateway:</strong> ${ avgText} </p><p><strong>Against the scenario's 100-sensor figure:</strong> ${ fit} </p><p><strong>Gateways needed if each carries ${ capacity} sensors:</strong> ${ needed} (a sizing target from the scenario, not a gateway rating)</p><p><strong>Gateway hardware:</strong> ${ usd (gwCost)} </p><p><strong>Sensor hardware:</strong> ${ usd (sensorCost)} </p><p><strong>Total device hardware:</strong> ${ usd (total)} </p></div>`
Back to the chapter