src/TrafficSimulator.py
def generate_new_random_car(self, time_between_cars_multiplier=1.0, p_notcomm = 0.1, probability_left_turn=0.33, probability_right_turn=0.33):
        ''' Generate cars according to Poisson process'''

        if self.iterations_until_next_car <= 0:
            new_car = self.generate_car(p_notcomm, probability_left_turn,probability_right_turn)
            if new_car:
                self.add_vehicle(new_car)
            time_between_cars = new_car.time_required_intersection(AV.TurnDirection.STRAIGHT,new_car._maxSpeed)
            number_iterations = time_between_cars_multiplier*time_between_cars/self.deltaT
            posson_lambda = 1/number_iterations        
            self.iterations_until_next_car = np.random.exponential(1/posson_lambda)
        else:
            self.iterations_until_next_car -= 1
 Generate cars according to Poisson process
Generate cars according to Poisson process
Generate cars according to Poisson process
def generate_new_random_car(self, time_between_cars_multiplier=1.0, p_notcomm = 0.1, probability_left_turn=0.33, probability_right_turn=0.33):
        if self.iterations_until_next_car <= 0:
            new_car = self.generate_car(p_notcomm, probability_left_turn,probability_right_turn)
            if new_car:
                self.add_vehicle(new_car)
            time_between_cars = new_car.time_required_intersection(AV.TurnDirection.STRAIGHT,new_car._maxSpeed)
            number_iterations = time_between_cars_multiplier*time_between_cars/self.deltaT
            posson_lambda = 1/number_iterations        
            self.iterations_until_next_car = np.random.exponential(1/posson_lambda)
        else:
            self.iterations_until_next_car -= 1
def generate_new_random_car ( self , time_between_cars_multiplier = 1.0 , p_notcomm = 0.1 , probability_left_turn = 0.33 , probability_right_turn = 0.33 ) : if self . iterations_until_next_car <= 0 : new_car = self . generate_car ( p_notcomm , probability_left_turn , probability_right_turn ) if new_car : self . add_vehicle ( new_car ) time_between_cars = new_car . time_required_intersection ( AV . TurnDirection . STRAIGHT , new_car . _maxSpeed ) number_iterations = time_between_cars_multiplier * time_between_cars / self . deltaT posson_lambda = 1 / number_iterations self . iterations_until_next_car = np . random . exponential ( 1 / posson_lambda ) else : self . iterations_until_next_car -= 1
Generate cars according to Poisson process
Generate cars according to Poisson process
''' Generate cars according to Poisson process'''
self
time_between_cars_multiplier
p_notcomm
probability_left_turn
probability_right_turn