# Trace unicast and broadcast delivery

This lab uses four Contiki-NG motes under Cooja's UDGM simulated radio. The
payload labels `U1`, `B1`, `B2`, and `B3` are synthetic fixed inputs, not
measurements from hardware. The four node positions and seed 1 are fixed in
`cooja-wsn-unicast-broadcast.csc`.

## Run

On Linux x86-64 with Docker and X11, extract `lab-files.tar.gz` in a fresh
directory. The included launcher follows the existing Cooja lab convention.

```bash
tar -xzf lab-files.tar.gz
git clone --depth 1 --branch release/v4.9 https://github.com/contiki-ng/contiki-ng.git contiki-ng
test "$(git -C contiki-ng rev-parse HEAD)" = c20b12cd2db707d6c07918f8b26cfeb52cf298ca
git -C contiki-ng submodule update --init --depth 1 tools/cooja
test "$(git -C contiki-ng/tools/cooja rev-parse HEAD)" = 33d41ae9f8acd6075fb903b0bcd5b4122bad8d8f
mkdir -p jdk17 home/contiki-ng
curl -fL 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.20.1%2B1/OpenJDK17U-jdk_x64_linux_hotspot_17.0.20.1_1.tar.gz' -o jdk17.tar.gz
echo '3808d1d15e3ec6bd5b84057fb5d84c33d8a1536a258146bcea2e603fc726e08e  jdk17.tar.gz' | sha256sum -c -
tar -xzf jdk17.tar.gz --strip-components=1 -C jdk17
xhost +si:localuser:$(id -un)
bash cooja-wsn-unicast-broadcast/docker-launch.sh
```

The launcher uses the pinned `contiker/contiki-ng` image in
`docker-launch.sh` and mounts the packet at `/lab`. Close Cooja and revoke the
temporary X11 access with `xhost -si:localuser:$(id -un)`.

The ScriptRunner pauses the GUI at simulated 30, 45, 55, 65, 75, and 95 s.
Click **Start/Pause** at each stop. Headless mode runs straight through to
`TEST OK` at 110 s. `expected-output.txt` is the raw headless log from the
same CSC, not a predicted result. Cooja's **Network**, **Radio messages**, and
**Mote output** windows show the independent topology, frame, and application
observations.

## Observed seed-1 run

| Simulated event | Application observation |
|---|---|
| `U1` at 40.550 s | Only mote 2 logged `unicast_rx=1` at 40.577 s. |
| `B1` at 50.551 s | Motes 2, 3, and 4 each logged one receipt at 50.582 s. |
| Mote 4 radio off at 60.971 s | `B2` at 70.552 s reached motes 2 and 3, not mote 4. |
| Mote 4 radio on at 80.971 s | `B3` at 90.553 s reached all three receivers. |

The headless ScriptRunner counted distinct application recipients:
`COUNTS U1=1 B1=3 B2=2 B3=3`. The Radio messages window counted 6 frames
by the unicast pause and 8 by the first broadcast pause; those totals also
include RPL/control frames, so their difference is not a clean MAC cost per
application packet. A unicast can trigger link acknowledgements and the radio
window is the place to inspect them. The application counts are the delivery
claim.

This simulated radio result does not establish field RF range, hardware
energy use, or reliable delivery under interference.
