Try Add remote delay and link loss to the 5 ms loop.
Observe Compare how many commands meet the loop deadline on the local and remote paths.
Explain Explain why time-critical control stays local while the dashboard path carries evidence only.
Technical boundaries. Expected-value model with a fixed delay: it has no jitter, queueing or retransmission, although the chapter says remote delay is uncertain. The 5 ms PLC loop comes from the chapter; the remote delay, link loss and command count are hypothetical. Not a control-system validation.
Times are in milliseconds. Command counts are expected values (loss percentage times commands sent), not outcomes observed for individual commands, so they can be fractional (one command at 50% loss gives 0.5 lost and 0.5 arriving). The chapter gives only a 5 ms PLC loop: it does not give a separate measured local execution time or deadline, so Chapter case sets both to 5 ms. The delay, loss and command count are hypothetical; Chapter case sets delay and loss to zero.
viewof period = Inputs.range([1,50], {value:5,step:0.5,label:"Local PLC loop time (ms; chapter: 5)"})viewof deadline = Inputs.range([1,50], {value:5,step:0.5,label:"Deadline (ms; the chapter gives only the 5 ms loop)"})viewof delay = Inputs.range([0,500], {value:0,step:1,label:"Hypothetical extra delay on the remote dashboard path (ms)"})viewof loss = Inputs.range([0,100], {value:0,step:1,label:"Hypothetical remote link loss (%)"})viewof sent = Inputs.range([1,10000], {value:1000,step:1,label:"Hypothetical commands sent"}){const button =html`<button type="button">Chapter case</button>` button.addEventListener("click", () => { (viewof period).value=5; (viewof period).dispatchEvent(newEvent("input", {bubbles:true})); (viewof deadline).value=5; (viewof deadline).dispatchEvent(newEvent("input", {bubbles:true})); (viewof delay).value=0; (viewof delay).dispatchEvent(newEvent("input", {bubbles:true})); (viewof loss).value=0; (viewof loss).dispatchEvent(newEvent("input", {bubbles:true})); (viewof sent).value=1000; (viewof sent).dispatchEvent(newEvent("input", {bubbles:true})); })return button}
localMeets = period <= deadlineremoteTotal = period + delayremoteMeets = remoteTotal <= deadlinecyclesLate = remoteMeets ?0:Math.ceil((remoteTotal - deadline) / period)// exact counts in hundredths (sent and loss are whole numbers), so lost + late + on time = sent exactlylostC = sent * lossarrC = sent *100- lostConTimeC = remoteMeets ? arrC :0lateC = remoteMeets ?0: arrCfmt = n => n.toFixed(1)cnt = c => { const v = c /100;returnNumber.isInteger(v) ? v.toLocaleString("en-US") : v.toFixed(2).replace(/0$/,"") }remoteLine = loss ===100?"Remote path: no command arrives at 100% loss, so there is no arrival time to compare":`Remote path if a command arrives: ${fmt(remoteTotal)} ms, ${remoteMeets ?"meets":"misses"} the ${fmt(deadline)} ms deadline${cyclesLate >0?` by ${fmt(remoteTotal - deadline)} ms (the exact lateness; counted in whole ${fmt(period)} ms loop cycles and rounded up, any part of a cycle counts as a full one, that is ${cyclesLate} loop cycle${cyclesLate ===1?"":"s"})`:""}`html`<div aria-live="polite"><p><strong>Local path:</strong> ${fmt(period)} ms, ${localMeets ?"meets":"misses"} the ${fmt(deadline)} ms deadline for all ${cnt(sent *100)} commands (no link loss modelled locally)</p><p><strong>${remoteLine}</strong></p><p><strong>Expected remote commands on time:</strong> ${cnt(onTimeC)} of ${cnt(sent *100)}</p><p><strong>Expected remote commands late:</strong> ${cnt(lateC)}</p><p><strong>Expected remote commands lost:</strong> ${cnt(lostC)}</p></div>`