Given parameters:
Firmware size: 128 KB = 131,072 bytes
Block size: 64 bytes (Zigbee OTA Cluster payload limit)
Block interval: 2 seconds (battery device sleep-wake cycle)
Device count: 100 devices
Router count: 36 (always-on, no sleep delays)
End device count: 64 (battery, 2-second sleep cycles)
Step 1: Calculate blocks per device.
Total blocks = ceil(131,072 / 64) = 2,048 blocks
Step 2: Time per device type.
Router (no sleep delay):
Effective throughput = 64 bytes / 0.05s = 1,280 bytes/sec
(0.05s = 20ms TX + 20ms ACK + 10ms processing)
Time per router = 131,072 / 1,280 = 102 sec = ~1.7 minutes
End device (2s sleep cycle):
Effective throughput = 64 bytes / 2.0s = 32 bytes/sec
Time per end device = 131,072 / 32 = 4,096 sec = ~68 minutes
Step 3: Sequential update total.
36 routers x 1.7 min = 61 minutes
64 end devices x 68 min = 4,352 minutes = 72.5 hours
Total sequential: 61 min + 4,352 min = 4,413 min = ~73.5 hours = 3.1 days
Step 4: Optimized with multicast groups of 10.
Phase 1 -- Routers (multicast groups of 6):
6 groups x 1.7 min = 10.2 minutes
Phase 2 -- End devices (multicast groups of 10):
7 groups (64/10 rounded up) x 68 min = 476 minutes = 7.9 hours
Optimized total: 10 min + 476 min = 486 min = ~8.1 hours
Improvement: 73.5 hours / 8.1 hours = 9.1x faster
Step 5: Real-world adjustments.
Add 20% for retransmissions (wireless packet loss):
8.1 hours x 1.2 = 9.7 hours
Add 10% for mesh congestion during updates:
9.7 hours x 1.1 = 10.7 hours
Schedule across 3 maintenance windows (2am-5am):
Night 1: 36 routers (10 min) + 20 end devices (2.3 hours)
Night 2: 24 end devices (2.7 hours)
Night 3: 20 end devices (2.3 hours) + verification
Cost of failure (no rollback):
If 5% of devices brick (5 out of 100):
Truck roll per device: $150 (technician + travel)
Total recovery cost: 5 x $150 = $750
Plus 2 days of lost sensor data
Dual-partition boot saves: $750 in recovery costs per update cycle
Implementation cost: ~$0.50 extra flash per device = $50 total
ROI: Pays for itself on first failed update