parameters: (self, id_stop)
docstring: Check whether vehicles are in the output buffer ready for release.
          Theses are all stopped vehicles with identical destination
          at the exit of the output queue.
docstring_summary: Check whether vehicles are in the output buffer ready for release.
          Theses are all stopped vehicles with identical destination
          at the exit of the output queue.
docstring_tokens: Check whether vehicles are in the output buffer ready for release . Theses are all stopped vehicles with identical destination at the exit of the output queue .
function: def get_vehicles_ready_for_departure(self, id_stop):
          """
          Check whether vehicles are in the output buffer ready for release.
          Theses are all stopped vehicles with identical destination
          at the exit of the output queue. 
          """
          ids_veh_out = self.ids_vehs_out[id_stop]
          n_veh = len(ids_veh_out)
          ids_veh_ready = self.ids_vehs_ready_for_departure[id_stop]
          is_veh_ready = len(ids_veh_ready) > 0
          print 'get_vehicles_ready_for_departure check id_stop', id_stop, ' len(ids_vehs_out)', n_veh, 'capa', self.capas_outqueue[id_stop]
          if is_veh_ready:
              if self.debug:
                  print '  there are still vehicles ready to be launched'
                  print '     ids_veh_ready', ids_veh_ready
              return []
  
          berths = self.get_berths()
          vehicles = self.parent.prtvehicles
          if self.debug:
              print '  ids_berths_veh_wait_exit', type(self.ids_berths_veh_wait_exit[id_stop]), self.ids_berths_veh_wait_exit[id_stop], 'ids_veh_berth_wait', berths.ids_veh[self.ids_berths_veh_wait_exit[id_stop]]
  
          if (n_veh == 0):
              if self.debug:
                  print '  no vehicles in output queue'
              return []
  
          # search after ready vehicles, that will be launched shortly
  
          i = 0  # len(ids_veh_ready)
          ids_veh_platoon = []
          is_cont = True
          id_stopedge_target = -1
          while is_cont & (i < n_veh):
              id_veh, stoppos = ids_veh_out[i]
              if id_stopedge_target == -1:  # target not yet defined
                  id_stopedge_target = vehicles.routes[id_veh][-1]
                  if self.debug:
                      # ,'is_stopped',is_stopped
                      print '   %d Leader prt.%d' % (i, id_veh), 'id_stopedge_target', id_stopedge_target
  
              else:
                  if self.debug:
                      print '   %d Follower prt.%d' % (i, id_veh), 'is_cont next', vehicles.routes[id_veh][-1] == id_stopedge_target
  
              if vehicles.routes[id_veh][-1] == id_stopedge_target:
                  ids_veh_platoon.append((id_veh, stoppos))
                  i += 1
              else:
                  is_cont = False
  
          if (i == n_veh):
              if ((len(self.ids_berths_veh_wait_exit[id_stop]) > 0) | (len(self.ids_vehs_pass_wait_exit[id_stop]) > 0))\
                      & (i < self.capas_outqueue[id_stop]-1):
                  if self.debug:
                      print '  Maybe incomplete platoon, wait till all vehicles are kicked out of berths'
                      print '  len(ids_berths_veh_wait_exit)', len(self.ids_berths_veh_wait_exit[id_stop]), 'len(ids_vehs_pass_wait_exit)', len(self.ids_vehs_pass_wait_exit[id_stop]), "i", i
                  return []
              else:
                  # the entire out queue has the same destination
                  # and will leave the stop
                  if self.debug:
                      print '  entire out queue same dest and ready for departure'
                  #is_update_outqueue = False
          else:
              # only a part of te out-queue departs, update position of rest
              if self.debug:
                  print '  partial out queue ready for departure'
              #is_update_outqueue = True
  
          # Check if all vehicles in the platoon are stopped at the
          # defined stopline
          id_stopedge_sumo = self.ids_stop_to_ids_edge_sumo[id_stop]
          are_stopped = True
          are_finalpos = True
          ids_veh_ready_new = []
          if self.debug:
              print '  position check/update ids_veh_platoon', ids_veh_platoon
          for id_veh, stoppos in ids_veh_platoon:
  
              id_veh_sumo = vehicles.get_id_sumo(id_veh)
              is_stopped = traci.vehicle.isStopped(id_veh_sumo)
              if self.debug:
                  print '    stopcheck ', id_veh_sumo, 'are_stopped', are_stopped, 'is_stopped', is_stopped
  
              if is_stopped:
                  # check if stopposition is correct
                  pos_veh = traci.vehicle.getLanePosition(id_veh_sumo)
                  are_finalpos &= abs(pos_veh-stoppos) < 0.1
                  are_stopped &= are_finalpos
  
                  if 0:  # be done for all in _reposition_outqueue
                      if not is_stopped:
                          # vehicle is stopped but not at correct position
                          are_stopped = False
                          if self.debug:
                              print '      update stoppos of prt.%s:' % id_veh_sumo, 'from curpos', pos_veh, 'stoppos', stoppos
                          # vehicle has stopped but not at the correct stop position
                          # =>foreward vehicle to the correct position
                          vehicles.control_forewarding_exit(id_veh,
                                                            id_edge_sumo=id_stopedge_sumo,
                                                            position=stoppos,
                                                            laneindex=2,
                                                            )
              else:
                  are_stopped = False
  
              #is_pos_correct = traci.vehicle.get
              # print '    Veh',id_veh_sumo,'is_stopped',is_stopped
              # if not is_veh_ready:# means that there are not already vehicles ready
              if self.debug:
                  print '      append prt.%d to ids_veh_ready_new' % (id_veh)
              ids_veh_ready_new.append(id_veh)
  
          if self.debug:
              print '  ready? are_stopped %s,' % (are_stopped), 'ids_veh_ready_new', ids_veh_ready_new
  
          # value if platoon is ready to leave
          if (not is_veh_ready) & are_stopped:
              if self.debug:
                  print '  all vehicles of the platoon are stopped, platoon ready.'
              return ids_veh_ready_new
  
          else:
              if not are_finalpos:
                  self.are_reposition_out[id_stop] = True
                  if self.debug:
                      print '  vehicles of platoon not stopped at coorect position or previous ready vehicles not launched.'
              else:
                  if self.debug:
                      print '  not all vehicles of platoon stopped or previous ready vehicles not launched.'
              return []
function_tokens: def get_vehicles_ready_for_departure ( self , id_stop ) : ids_veh_out = self . ids_vehs_out [ id_stop ] n_veh = len ( ids_veh_out ) ids_veh_ready = self . ids_vehs_ready_for_departure [ id_stop ] is_veh_ready = len ( ids_veh_ready ) > 0 print 'get_vehicles_ready_for_departure check id_stop' , id_stop , ' len(ids_vehs_out)' , n_veh , 'capa' , self . capas_outqueue [ id_stop ] if is_veh_ready : if self . debug : print '  there are still vehicles ready to be launched' print '     ids_veh_ready' , ids_veh_ready return [ ] berths = self . get_berths ( ) vehicles = self . parent . prtvehicles if self . debug : print '  ids_berths_veh_wait_exit' , type ( self . ids_berths_veh_wait_exit [ id_stop ] ) , self . ids_berths_veh_wait_exit [ id_stop ] , 'ids_veh_berth_wait' , berths . ids_veh [ self . ids_berths_veh_wait_exit [ id_stop ] ] if ( n_veh == 0 ) : if self . debug : print '  no vehicles in output queue' return [ ] # search after ready vehicles, that will be launched shortly i = 0 # len(ids_veh_ready) ids_veh_platoon = [ ] is_cont = True id_stopedge_target = - 1 while is_cont & ( i < n_veh ) : id_veh , stoppos = ids_veh_out [ i ] if id_stopedge_target == - 1 : # target not yet defined id_stopedge_target = vehicles . routes [ id_veh ] [ - 1 ] if self . debug : # ,'is_stopped',is_stopped print '   %d Leader prt.%d' % ( i , id_veh ) , 'id_stopedge_target' , id_stopedge_target else : if self . debug : print '   %d Follower prt.%d' % ( i , id_veh ) , 'is_cont next' , vehicles . routes [ id_veh ] [ - 1 ] == id_stopedge_target if vehicles . routes [ id_veh ] [ - 1 ] == id_stopedge_target : ids_veh_platoon . append ( ( id_veh , stoppos ) ) i += 1 else : is_cont = False if ( i == n_veh ) : if ( ( len ( self . ids_berths_veh_wait_exit [ id_stop ] ) > 0 ) | ( len ( self . ids_vehs_pass_wait_exit [ id_stop ] ) > 0 ) ) & ( i < self . capas_outqueue [ id_stop ] - 1 ) : if self . debug : print '  Maybe incomplete platoon, wait till all vehicles are kicked out of berths' print '  len(ids_berths_veh_wait_exit)' , len ( self . ids_berths_veh_wait_exit [ id_stop ] ) , 'len(ids_vehs_pass_wait_exit)' , len ( self . ids_vehs_pass_wait_exit [ id_stop ] ) , "i" , i return [ ] else : # the entire out queue has the same destination # and will leave the stop if self . debug : print '  entire out queue same dest and ready for departure' #is_update_outqueue = False else : # only a part of te out-queue departs, update position of rest if self . debug : print '  partial out queue ready for departure' #is_update_outqueue = True # Check if all vehicles in the platoon are stopped at the # defined stopline id_stopedge_sumo = self . ids_stop_to_ids_edge_sumo [ id_stop ] are_stopped = True are_finalpos = True ids_veh_ready_new = [ ] if self . debug : print '  position check/update ids_veh_platoon' , ids_veh_platoon for id_veh , stoppos in ids_veh_platoon : id_veh_sumo = vehicles . get_id_sumo ( id_veh ) is_stopped = traci . vehicle . isStopped ( id_veh_sumo ) if self . debug : print '    stopcheck ' , id_veh_sumo , 'are_stopped' , are_stopped , 'is_stopped' , is_stopped if is_stopped : # check if stopposition is correct pos_veh = traci . vehicle . getLanePosition ( id_veh_sumo ) are_finalpos &= abs ( pos_veh - stoppos ) < 0.1 are_stopped &= are_finalpos if 0 : # be done for all in _reposition_outqueue if not is_stopped : # vehicle is stopped but not at correct position are_stopped = False if self . debug : print '      update stoppos of prt.%s:' % id_veh_sumo , 'from curpos' , pos_veh , 'stoppos' , stoppos # vehicle has stopped but not at the correct stop position # =>foreward vehicle to the correct position vehicles . control_forewarding_exit ( id_veh , id_edge_sumo = id_stopedge_sumo , position = stoppos , laneindex = 2 , ) else : are_stopped = False #is_pos_correct = traci.vehicle.get # print '    Veh',id_veh_sumo,'is_stopped',is_stopped # if not is_veh_ready:# means that there are not already vehicles ready if self . debug : print '      append prt.%d to ids_veh_ready_new' % ( id_veh ) ids_veh_ready_new . append ( id_veh ) if self . debug : print '  ready? are_stopped %s,' % ( are_stopped ) , 'ids_veh_ready_new' , ids_veh_ready_new # value if platoon is ready to leave if ( not is_veh_ready ) & are_stopped : if self . debug : print '  all vehicles of the platoon are stopped, platoon ready.' return ids_veh_ready_new else : if not are_finalpos : self . are_reposition_out [ id_stop ] = True if self . debug : print '  vehicles of platoon not stopped at coorect position or previous ready vehicles not launched.' else : if self . debug : print '  not all vehicles of platoon stopped or previous ready vehicles not launched.' return [ ]