Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Performance Analysis of Circuit Switching and Packet Switching for VoIP and Video Streaming

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.

Purpose

  • Demonstrate and compare circuit switching vs packet switching
  • Focus on VoIP and video streaming performance
  • Metrics: delay, jitter, packet loss, bandwidth utilization, QoS

Tech Stack

  • Backend: Python (SimPy for discrete-event simulation)
  • Visualization: matplotlib + seaborn
  • Optional UI: Streamlit dashboard

Folder Structure

CN/
  README.md
  requirements.txt
  src/
    run_simulation.py
  simulation/
    network_models.py
    traffic.py
  visualization/
    plotting.py
    images/
  data/

How It Works

  • 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.

Quick Start

  1. Create a Python environment and install dependencies:
pip install -r requirements.txt
  1. Run the simulation (generates CSVs and plots):
python src/run_simulation.py
  1. Open the Streamlit dashboard (optional):
streamlit run app_streamlit.py

Outputs

  • CSVs in data/:
    • voip_circuit.csv, voip_packet.csv, video_circuit.csv, video_packet.csv
    • summary.csv (aggregated metrics)
  • Plots in visualization/images/:
    • delay_comparison.png, jitter_comparison.png, loss_rate.png, bandwidth_utilization.png

Screenshots & Graph Explanation

  • 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).

Parameters (Defaults)

  • 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

Real-world Mapping

  • 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.

Academic-style Conclusion

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.

Troubleshooting

  • 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.

License

Educational demo for academic use and GitHub showcasing.

About

πŸ“‘ Computer Networks Lab & Analysis β€” Performance analysis of Circuit vs Packet Switching for VoIP, ARP/RARP protocols, and Java socket chat.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages