# Project Log — Smart Emergency Alert Broadcasting in VANET (NS-3) Running record of everything done on this project, newest entries at the bottom. Anyone on the team (or any AI assistant) should read this first to get full context. --- ## Project at a glance | Item | Detail | |---|---| | Course | Network Programming — Alternate Assessment Tool (AAT), 2026-27 | | College | B.M.S. College of Engineering, Dept. of CSE (cover page template says ISE on certificate — check with faculty) | | Guide / Course coordinator | Dr. Sowmya K S | | HOD (certificate) | Dr. Selva Kumar S | | Title | Smart Emergency Alert Broadcasting Application in VANET Using NS-3 | | Simulator | ns-3.45 (C++) | | Team | NAME 1..4 / USN 1..4 — **to be filled in** | ## Files in this folder | File | What it is | |---|---| | `AAT Report Guidelines-2026-27.docx` | Official report format (11 chapters, 20–25 pages, A4, 1.5 spacing) | | `Outer_page and Certificate.docx` | Cover page + certificate template (placeholders AAAA / NAME / USN) | | `vanet-emergency-alert.cc` | **v1** code written by ChatGPT. Never compiled by ChatGPT. Kept untouched for reference. | | `PROJECT_LOG.md` | This file | ## Report requirements (summary of the guidelines) 1. Abstract (150–200 words) · 2. Objectives · 3. Introduction (2 pp) · 4. Literature Review (**min 12 IEEE/ACM/Springer/Elsevier papers**) · 5. Research Gap · 6. Problem Statement · 7. Methodology/Implementation (architecture, math model, algorithm, socket implementation, 3–6 pp) · 8. Performance Evaluation (setup + metrics) · 9. Output & Results (comparative analysis, PDR, delay, throughput, jitter; 3–5 pp) · 10. Conclusion · 11. References. Formatting: A4, 1.5/double spacing, margins L 1.25″ R 1″ T/B 0.75″, soft binding, 20–25 pages, 2 copies. --- ## Log ### 2026-10-29 — Session 1: picked up from ChatGPT, simulation upgrade begins **Background (from the earlier ChatGPT chat, "NS3 WiFi Performance Project"):** - Faculty asked for "an actual network application implemented and executed on NS-3". - ChatGPT first suggested TCP-vs-UDP comparison, then switched to **Smart Emergency Alert Broadcasting in VANET**. - It produced `vanet-emergency-alert.cc` (v1) + a README, but stated it had **not compiled or run it**. - v1 behaviour: 5 parked vehicles, 10 m apart, Wi-Fi 802.11b ad hoc, Vehicle 0 sends **one** UDP broadcast to 10.1.1.255:4040, others print it. No mobility, no multi-hop, no metrics. **Why v1 is not enough for the report:** the guidelines demand a research gap, a proposed approach compared with a baseline, and measured PDR / delay / throughput / jitter. v1 has nothing to compare or measure. **Decision — v2 design:** - 2 km, 4-lane highway (2 lanes each direction), 20–100 moving vehicles (ns-3 ConstantVelocity mobility). - A vehicle crashes; it re-broadcasts an accident alert every second (UDP broadcast, custom `AlertHeader`). - Vehicles behind the crash queue up; we log whether each driver was warned *before* reaching the queue. - Multi-hop relaying implemented at the application layer (socket programming), three schemes: 1. **Blind flooding** (baseline) — every vehicle rebroadcasts on first reception → broadcast storm. 2. **Probabilistic gossip** (second baseline) — rebroadcast with probability p. 3. **Smart Relay (proposed)** — distance-based contention: farther vehicles wait less, and a vehicle cancels its rebroadcast if it hears a vehicle *further along the propagation direction* relay first. - Background periodic beacons (CAM-like) load the channel realistically. - Outputs: CSV metrics, JSON trace for the custom animation, optional NetAnim XML. - Metrics: PDR/reachability, end-to-end delay, jitter, throughput, rebroadcast overhead, PHY collisions, hop count, warning lead time, unwarned vehicles. **Environment:** this Mac (Apple Silicon, macOS 26). Installing cmake + ninja via Homebrew and ns-3.45 at `~/ns3/ns-allinone-3.45`. **Done in session 1 (verified on this Mac):** - ns-3.45 installed at `~/ns3/ns-allinone-3.45/ns-3.45` (optimized build, modules wifi/mobility/internet/applications/netanim/flow-monitor/propagation). - Gotcha: `./ns3` breaks on Python 3.14 → use `python3.11 ./ns3 ...` (run.sh does this). - Gotcha: ns-3 CommandLine stops string values at spaces and our folder is `NP Project ` (trailing space) → run the binary from inside the output folder with relative file names (scripts do this). - **v1** (`vanet-emergency-alert.cc`) compiled and ran: Vehicle 0 broadcast, vehicles 1–4 received at t=1.5012 s. ✅ - **v2** written: `simulation/vanet-smart-alert.cc` (~1100 lines). Key design facts: - 802.11p ad hoc, 10 MHz, 6 Mb/s, 23 dBm, log-distance (exp 2.5) + Nakagami fading, 5 Hz × 200 B beacons. - Custom `AlertHeader` (40 B) + text payload; UDP broadcast 10.1.255.255:4040. `AlertTag` marks alert frames for PHY traces. - Smart Relay: 5 slots × 2 ms, slot = floor(5·(1−d/300)), +0–0.5 ms jitter; cancel if a duplicate comes from a vehicle at/beyond us in the propagation direction. - Crash at t=3 s, x=1600 m; alert every 1 s; eastbound cars brake (6 m/s²) into a queue; cars within 150 m are "eyewitnesses". - Metrics scored over a **Region of Interest** = vehicles on the 0–2000 m section at alert generation (cars in the 150 m recycle buffers at each end were sparse edge cases; ROI is standard practice). - **Experiments**: `simulation/run_experiments.py` → 6 densities (20–120) × 3 schemes × 10 seeds = 180 runs, ~1.7 min on 8 cores. Output `results/density_sweep.csv`, means in `results/summary_means.csv`. - **Figures**: `simulation/plot_results.py` → 9 PNGs in `results/figures/` (300 dpi, B/W-print safe). - **Visualizer**: `visualizer/index.html` + `traces.js` (made by `simulation/make_visualizer_data.py`, 60 vehicles, seed 1). Three synchronized highway strips, automatic slow motion during alert waves, zoom/pan, live counters. Open with a local server: `cd visualizer && python3 -m http.server 8931` → http://127.0.0.1:8931 (port 8765 is used by another local site on this Mac). - **Literature**: 16 verified papers in `docs/literature_review_sources.md` (checked against Crossref DOIs). **Key results (means of 10 seeds):** | Vehicles | PDR flood / gossip / smart | Tx per alert flood → smart | Lost frames/alert flood → smart | Mean delay flood / smart | |---|---|---|---|---| | 40 | 53 / 45 / 78 % | 19 → 16 | 240 → 14 | 1.3 / 10.8 ms | | 60 | 71 / 56 / 96 % | 39 → 25 | 804 → 45 | 1.6 / 10.0 ms | | 80 | 85 / 65 / 99 % | 63 → 29 | 1841 → 97 | 1.8 / 8.4 ms | | 120 | 94 / 83 / 99.3 % | 107 → 35 | 5084 → 254 | 1.8 / 5.8 ms | Trade-off: Smart Relay adds a few ms of contention delay (still ≪ 100 ms safety budget) and its delay falls with density. At 20 vehicles all schemes are low (~30 %) because the road is disconnected (network partition), not because of the protocol. "Unwarned braking" metric was 0 for every scheme (alerts arrive in ms, far before cars reach the queue) → mention only briefly. **Report (done, same session):** `Report/AAT_Report_Smart_Emergency_Alert_VANET.docx` + `.pdf` — 40 pages (cover + certificate from the college template, acknowledgement, contents, lists of figures/tables, 11 chapters, 35 numbered pages, 20 figures, 4 tables, 18 references). Built by `docs/build_report.py` from `docs/report_content.md`; the builder renders a PDF with LibreOffice and writes real page numbers into the contents. Diagrams/terminal screenshots come from `docs/figures_src/make_figures.py` (headless Chrome). **Presentation (done):** 19-slide deck as a claude.ai Slides artifact (downloads as .pptx or PDF): https://claude.ai/artifact/8UEcfGM7ptw8avegndP7V3 — private until shared from its Share menu. Every slide has speaker notes. Source copy in `Presentation/deck_source/`. **PowerPoint files (done, fixed 2026-10-29 after a broken preview was reported):** - `Presentation/Smart_Emergency_Alert_VANET.pptx` — MAIN file. 19 slides, each one full-slide picture of the finished slide, with all speaker notes and sections. Looks identical in PowerPoint, Keynote, Google Slides and macOS Quick Look. Text is not editable (regenerate after changing the editable deck). - `Presentation/Smart_Emergency_Alert_VANET_editable.pptx` — fully editable text (titles, names, bullets, table, notes). Correct in PowerPoint/LibreOffice; macOS Quick Look may still mis-draw it (see below). - `Presentation/Smart_Emergency_Alert_VANET.pdf` — backup/handout, renders everywhere. - Rebuild all three: `cd Presentation/pptx_build && NODE_PATH="$PWD/node_modules" node build_pptx.js && NODE_PATH="$PWD/node_modules" node make_flat.js` (set `PPTX_SKILL_DIR` to the pptx skill folder to also apply the theme colours). **Why the editable deck broke on the Mac (investigated, reproducible):** macOS Quick Look (the Finder preview, also used by the ChatGPT app's preview) mis-renders .pptx files that are not written by PowerPoint itself: 1. Ovals and rounded rectangles are swapped with shapes from two slides earlier (also happens with python-pptx output). 2. Pictures are cached by relationship id (`rId1` on every slide) → fixed by making rIds deck-unique. 3. Decks with custom slide layouts show slide 1's background on every slide. 4. Even with 1–3 fixed, slides with many text boxes still occasionally get another slide's picture (a race inside Quick Look). Verified fix: one picture per slide + unique rIds + no custom layouts → 0 wrong slides in 3 Quick Look runs. QA tools used: `qlmanage -p -o` exports Quick Look's rendering as HTML; compared each slide's pictures with the deck's media. **Still needed from the team:** - Names and USNs (cover page, certificate, slides 1 and 19 show `[Name 1]`… placeholders). - Course code and course title (guidelines ask for them on the cover; the template has no slot — confirm with faculty). - Certificate page says "Department of Information Science and Engineering" while the cover says CSE — template issue, ask faculty. - Optional: NetAnim GUI (needs Qt) if the faculty wants NetAnim specifically; the program already writes NetAnim XML with `--netanim=file.xml`. ### 2026-10-29 — Visualizer enlarged - Replay is now full width; each strip's height adapts to the screen (all three strips + controls fit on one screen at 1920×1080 and 1440×900). Lanes up to ~46 px, cars ~50 % larger, larger labels and counters. - Strip name and live counters moved into an overlay above the road; direction shown by chevrons painted on the lanes. - Local site: `python3 serve.py` → http://127.0.0.1:8931/ (home page `index.html`, replay at `/visualizer/`). ### 2026-10-29 — Pushed to GitHub, ready for Hostinger - Repository: https://github.com/Fortimark-co/NP-BMSCE (private), branch `main`. - Added `server.js` (dependency-free Node static server, listens on `$PORT`, gzip, blocks dotfiles/.venv/node_modules/ pptx_build, path-traversal safe), `package.json` (`npm start`, Node >= 18) and `.gitignore` (.venv, node_modules, .DS_Store, scratch traces). - Hostinger hPanel: Node.js Apps → import Git repo → branch `main`, entry `server.js`, start `npm start`, Node 20/22. - The ns-3 simulation runs locally (needs ns-3 installed); the website serves results, replay, report and slides. ### 2026-10-29 — Full-width home page, phone fixes (deployed site: np.xplearn.org) - Home page (`index.html`) is now full width; hero uses a fresh capture of the enlarged replay (`visualizer/preview.jpg`). - Replay page: added the mobile viewport tag (it rendered as a shrunken 980 px desktop page on phones); on screens ≤ 700 px the counters sit above the road and the controls scroll with the page instead of covering half the screen. - Checked with real phone emulation (390 px, Chrome DevTools protocol): no horizontal overflow on either page.