This project demonstrates and compares circuit-switched and packet-switched networks for real-time applications, focusing on VoIP and video streaming. It includes a SimPy-based simulation engine, CSV exports, and visualizations for delay, jitter, packet loss, bandwidth utilization, and QoS.
- Demonstrate and compare circuit switching vs packet switching
- Focus on VoIP and video streaming performance
- Metrics: delay, jitter, packet loss, bandwidth utilization, QoS
- Backend: Python (SimPy for discrete-event simulation)
- Visualization: matplotlib + seaborn
- Optional UI: Streamlit dashboard
CN/
README.md
requirements.txt
src/
run_simulation.py
simulation/
network_models.py
traffic.py
visualization/
plotting.py
images/
data/
- Circuit-switched model: dedicated bandwidth per flow, constant delay, no packet loss. Measures utilization efficiency when reserved bandwidth exceeds actual usage.
- Packet-switched model: shared link with queueing, variable delay (jitter), potential packet loss on buffer overflow, efficient bandwidth usage.
- Traffic generators: VoIP flows (RTP/UDP-like) at 20 ms intervals; Video flows (adaptive streaming-like) at 30 fps with variable packet sizes.
- Create a Python environment and install dependencies:
pip install -r requirements.txt
- Run the simulation (generates CSVs and plots):
python src/run_simulation.py
- Open the Streamlit dashboard (optional):
streamlit run app_streamlit.py
- CSVs in
data/:voip_circuit.csv,voip_packet.csv,video_circuit.csv,video_packet.csvsummary.csv(aggregated metrics)
- Plots in
visualization/images/:delay_comparison.png,jitter_comparison.png,loss_rate.png,bandwidth_utilization.png
- Delay comparison: box plot comparing delay distributions of Circuit vs Packet for VoIP and Video.
- Jitter comparison: bar chart of delay standard deviation (proxy for jitter) by network type and stream type.
- Packet loss rate: bar chart of loss ratio for VoIP and Video in packet-switched network (expected 0 in circuit switching).
- Bandwidth utilization: overall link utilization (packet) vs reserved bandwidth utilization (circuit).
- Simulation duration: 30 s
- Link bandwidth (packet): 10 Mbps
- Buffer capacity (packet): 100 packets
- Base propagation delay: 15 ms
- Jitter (packet): mean 5 ms, std 2 ms
- VoIP: 10 calls, 240 B per packet, 20 ms interval, 64 kbps reserved in circuit
- Video: 2 streams, ~5 KB average packet, 33 ms interval, 4 Mbps reserved in circuit
- VoIP β RTP over UDP with small periodic packets and tight jitter/delay constraints.
- Video streaming β adaptive bitrate over UDP/TCP, variable packet sizes, tolerant to some jitter/loss through buffering.
In our simulation, circuit switching consistently provided bounded delay and no packet loss for both VoIP and video streams, at the cost of potentially poor bandwidth utilization due to static reservations. Packet switching achieved more efficient bandwidth usage but introduced variable delay (jitter) and loss under high load or insufficient buffering, impacting real-time QoS. For VoIP, packet switching requires QoS mechanisms (e.g., priority queuing, DSCP, traffic shaping) to meet delay/jitter constraints. For video, packet switching generally suffices, leveraging buffering and adaptive bitrate. Overall, packet-switched networks are more scalable and efficient; circuit switching guarantees performance at the expense of flexibility and utilization.
- If plots are not generated, check
data/CSVs exist and run the simulation again. - On Windows, if Streamlit port is busy, use
--server.port=8502.
Educational demo for academic use and GitHub showcasing.