Esempio n. 1
0
 def keepTrackOfNewVehicle(self):
     # Keep track of loaded vehicle
     listOfNewVehicleLoaded = traci.simulation.getLoadedIDList()
     if listOfNewVehicleLoaded:
         for vehicle in listOfNewVehicleLoaded:
             if not vehicle in self.listOfVehicle:
                 # previous changeLane Mode = 64
                 self.listOfVehicle.append(Vehicle(vehicle,256))
Esempio n. 2
0
            object1 = None
            if (entrygate_status and available_slots == 0):
                print("No slot is available right now")

            elif (entrygate_status and available_slots > 0
                  and available_slots < 1001):
                #car_palte = object2.detect_car_plate()
                car_plate = input("enter the car plate number: ")
                driver_name = input("enter driver name: ")
                print("gate opened")
                time.sleep(2)
                print("gate closed")
                entry_time = datetime.datetime.now()
                object1 = Sensor_manager(entry_time, None, driver_name,
                                         car_plate)
                object3 = Vehicle(entry_time, None, driver_name, car_plate)
                object3.Store()
                veichle_list[car_plate] = object1
                _id += 1
                slot_no = object2.get_slot()
                object2.slot_list[slot_no] = True
                veichle_slot_list[car_plate] = slot_no
                object1.detectVeichle(True)
                count = object2.update_available_slot(True)
                print("Current available slots is {}".format(count))

            else:
                pass

            veichle_detected = bool(
                int(input("veichle detected at entry gate? : ")))
Esempio n. 3
0
 def __init__(self,entry_time,exit_time,driver_name,car_plate_number):
     Slot.__init__(self)
     Vehicle.__init__(self,entry_time,exit_time,driver_name,car_plate_number)
Esempio n. 4
0
 def test_if_true(self):
     obj = Vehicle("11:30:30", None, "abcd", "ABCD123456")
     result = obj.vehicle()
     self.assertEqual(result, "true")
Esempio n. 5
0
 def test_car_plate_number_if_not_valid(self):
     obj = Vehicle("11:30:30", None, "abcd", "Ab1234")
     result = obj.vehicle()
     self.assertEqual(result, "enter a valid car plate number")
Esempio n. 6
0
 def test_car_plate_number_if_none(self):
     obj = Vehicle("11:30:30", None, "abcd", None)
     result = obj.vehicle()
     self.assertEqual(result, "car plate number cannot be None")
Esempio n. 7
0
 def test_driver_name_if_number(self):
     obj = Vehicle("11:30:30", None, "1234", "ABCD123456")
     result = obj.vehicle()
     self.assertEqual(result, "driver name cannot be a number")
Esempio n. 8
0
 def test_entry_time(self):
     obj = Vehicle(None, None, "abcd", "ABCD123456")
     result = obj.vehicle()
     self.assertEqual(result, "entry time cannot be None")