https://github.com/techysphinx/gps_simulation_intel_unnati
Show drafts volume_up This Python project simulates a GPS-based toll booth system for India's highways. Imagine ANPR cameras capturing license plates and virtual GPS units tracking vehicles. The program then calculates tolls electronically based on distance traveled, showcasing a future with smoother traffic flow, fairer tolls, and reduced costs.
https://github.com/techysphinx/gps_simulation_intel_unnati
Last synced: 3 months ago
JSON representation
Show drafts volume_up This Python project simulates a GPS-based toll booth system for India's highways. Imagine ANPR cameras capturing license plates and virtual GPS units tracking vehicles. The program then calculates tolls electronically based on distance traveled, showcasing a future with smoother traffic flow, fairer tolls, and reduced costs.
- Host: GitHub
- URL: https://github.com/techysphinx/gps_simulation_intel_unnati
- Owner: techySPHINX
- Created: 2024-06-27T13:54:20.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-11T17:53:21.000Z (10 months ago)
- Last Synced: 2024-12-18T13:13:02.091Z (4 months ago)
- Language: Python
- Homepage:
- Size: 81.1 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
"Transforming Innovation into Efficiency: A Python-powered GPS Toll Simulation"This project bridges the gap between creative ideas and real-world impact. By simulating GPS-based toll systems in Python, we gain valuable insights into optimizing traffic flow, reducing congestion, and streamlining toll collection. This simulation will serve as a powerful tool for:
⦿ Testing and evaluating new toll strategies before implementation.
⦿ Identifying potential bottlenecks in existing toll systems.
⦿ Designing more efficient and user-friendly toll experiences.## GPS Toll Booth Simulation (Python)
This project simulates a basic GPS-based toll booth system using Python. It aims to provide a foundation for exploring and understanding how toll collection might work using real-time location data.
**Functionality**:
⦿ Simulates vehicles traveling on a highway with a toll booth.
⦿ Vehicles are assigned random speeds and arrival times.
⦿ When a vehicle reaches the toll booth location, a toll is charged based on its axle count.
⦿ The simulation tracks total revenue collected and average travel time.**Benefits**:
⦿ Provides a basic model for exploring GPS-based toll systems.
⦿ Helps visualize potential impacts on traffic flow and revenue collection.
⦿ Serves as a platform for further development and experimentation.Requirements:
Python 3.x (https://www.python.org/downloads/)
Libraries:
This project utilizes minimal libraries to keep it simple and focused.
Clone or download the project repository.
```
git clone https://github.com/techySPHINX/gps-toll-simulation.git
```Open a terminal window and navigate to the project directory.
```
cd gps-toll-simulation
```Run the simulation script using python main.py.
```
python main.py
```This Python code simulates a basic GPS-based toll booth system. It defines classes for vehicles (with arrival time, speed, axle count, and travel time) and _toll booths_ (with location, revenue collected, and vehicles processed). The generate_vehicles function creates a list of random vehicles with arrival times within the last hour, speeds, and axle counts. The _run_simulation_ function processes each vehicle by calculating its travel time to the toll booth (based on location and speed) and its toll (based on axle count with a customizable pricing logic). It then updates the toll booth's revenue and processed vehicles. Finally, it calculates and prints the total revenue collected and average travel time for all simulated vehicles.
```
"""
GPS Toll Booth Simulation (Python)This project simulates a basic GPS-based toll booth system...
"""import random
from datetime import datetimeclass Vehicle:
"""
Represents a vehicle with arrival time, speed, axle count, and travel time.
"""def __init__(self, arrival_time, speed, axle_count):
self.arrival_time = arrival_time
self.speed = speed
self.axle_count = axle_count
self.travel_time = None # Initially unknown, calculated during simulationclass TollBooth:
"""
Represents a toll booth with location, total revenue collected, and number of vehicles processed.
"""def __init__(self, location):
self.location = location
self.total_revenue = 0
self.vehicles_processed = 0def process_vehicle(self, vehicle):
"""
Processes a vehicle by calculating travel time, toll, and updating statistics.
"""travel_time = (self.location - vehicle.arrival_time) / vehicle.speed
vehicle.travel_time = travel_timetoll = self.calculate_toll(vehicle.axle_count)
self.total_revenue += toll
self.vehicles_processed += 1def calculate_toll(self, axle_count):
"""
Calculates the toll based on the axle count. You can customize the pricing logic here.This example uses a simple base toll and additional toll per axle.
"""base_toll = 5 # Replace with your desired base toll amount
additional_toll = 2 # Replace with your desired additional toll per axle
return base_toll + (axle_count - 1) * additional_tolldef generate_vehicles(num_vehicles):
"""
Generates a list of vehicles with random arrival times, speeds, and axle counts.
"""vehicles = []
for _ in range(num_vehicles):
arrival_time = datetime.now() - datetime.timedelta(seconds=random.randint(0, 3600)) # Simulate arrival times within the last hour
speed = random.randint(40, 80) # Simulate random speeds within a reasonable range (km/h)
axle_count = random.randint(2, 6) # Simulate random axle counts (2-6)
vehicle = Vehicle(arrival_time, speed, axle_count)
vehicles.append(vehicle)
return vehiclesdef run_simulation(vehicles, toll_booth):
"""
Simulates the toll booth operation by processing each vehicle and calculating statistics.
"""for vehicle in vehicles:
toll_booth.process_vehicle(vehicle)# Calculate average travel time (assuming all vehicles have been processed)
average_travel_time = sum(vehicle.travel_time for vehicle in vehicles if vehicle.travel_time is not None) / len(vehicles)print("Total Revenue Collected:", toll_booth.total_revenue)
print("Average Travel Time:", average_travel_time)if __name__ == "__main__":
num_vehicles = 20 # Number of vehicles to simulate
toll_booth = TollBooth(10) # Simulate toll booth location at 10 km on the highway
vehicles = generate_vehicles(num_vehicles)
run_simulation(vehicles, toll_booth)```
This project acts as a springboard for further exploration and experimentation with GPS-based toll systems.
### 𝚂𝚑𝚘𝚠 𝚜𝚘𝚖𝚎 ❤️ 𝚋𝚢 𝚜𝚝𝚊𝚛𝚛𝚒𝚗𝚐 𝚜𝚘𝚖𝚎 𝚘𝚏 𝚝𝚑𝚎 𝚛𝚎𝚙𝚘𝚜𝚒𝚝𝚘𝚛𝚒𝚎𝚜!