Example #1
0
 def idle_time(self, time):
     """ returns the time the elevator spends not moving and not being
         called by anyone
         
         the values returned are averages derived from data collection
     """
     if self.type == TYPE_F:
         if is_morning(time):
             return 29
         elif is_afternoon(time):
             return 6
         elif is_evening(time):
             return 277
     elif self.type == TYPE_L:
         if is_morning(time):
             return 20
         elif is_afternoon(time):
             return 6
         elif is_evening(time):
             return 294
     elif self.type == TYPE_I:
         if is_morning(time):
             return 13
         elif is_afternoon(time):
             return 12
         elif is_evening(time):
             return 219
     elif self.type == TYPE_E:
         if is_morning(time):
             return 51
         elif is_afternoon(time):
             return 1
         elif is_evening(time):
             return 189
Example #2
0
 def busy_time(self, time):
     """ returns the time the elevator spends not moving and not being
         called by anyone
         
         the values returned are averages derived from data collection
     """
     if self.type == TYPE_F:
         if is_morning(time):
             return 98
         elif is_afternoon(time):
             return 54
         elif is_evening(time):
             return 256
     elif self.type == TYPE_L:
         if is_morning(time):
             return 86
         elif is_afternoon(time):
             return 71
         elif is_evening(time):
             return 107
     elif self.type == TYPE_I:
         if is_morning(time):
             return 62
         elif is_afternoon(time):
             return 72
         elif is_evening(time):
             return 110
     elif self.type == TYPE_E:
         if is_morning(time):
             return 135
         elif is_afternoon(time):
             return 156
         elif is_evening(time):
             return 169
Example #3
0
 def idle_time(self, time):
     if self.type == TYPE_F:
         if is_morning(time):
             return 29
         elif is_afternoon(time):
             return 6
         elif is_evening(time):
             return 277
     elif self.type == TYPE_L:
         if is_morning(time): #11am
             return 20
         elif is_afternoon(time):
             return 6
         elif is_evening(time):
             return 294
     elif self.type == TYPE_I:
         if is_morning(time): #11am
             return 13
         elif is_afternoon(time):
             return 12
         elif is_evening(time):
             return 219
     elif self.type == TYPE_E:
         if is_morning(time): #11am
             return 51
         elif is_afternoon(time):
             return 1
         elif is_evening(time):
             return 189
Example #4
0
 def busy_time(self, time):
     if self.type == TYPE_F:
         if is_morning(time):
             return 98
         elif is_afternoon(time):
             return 54
         elif is_evening(time):
             return 256
     elif self.type == TYPE_L:
         if is_morning(time):
             return 86
         elif is_afternoon(time):
             return 71
         elif is_evening(time):
             return 107
     elif self.type == TYPE_I:
         if is_morning(time):
             return 62
         elif is_afternoon(time):
             return 72
         elif is_evening(time):
             return 110
     elif self.type == TYPE_E:
         if is_morning(time):
             return 135
         elif is_afternoon(time):
             return 156
         elif is_evening(time):
             return 169
Example #5
0
 def busy_time(self, time):
     """ returns the time the elevator spends not moving and not being
         called by anyone
         
         the values returned are averages derived from data collection
     """
     if self.type == TYPE_F:
         if is_morning(time):
             return 98
         elif is_afternoon(time):
             return 54
         elif is_evening(time):
             return 256
     elif self.type == TYPE_L:
         if is_morning(time):
             return 86
         elif is_afternoon(time):
             return 71
         elif is_evening(time):
             return 107
     elif self.type == TYPE_I:
         if is_morning(time):
             return 62
         elif is_afternoon(time):
             return 72
         elif is_evening(time):
             return 110
     elif self.type == TYPE_E:
         if is_morning(time):
             return 135
         elif is_afternoon(time):
             return 156
         elif is_evening(time):
             return 169
Example #6
0
 def idle_time(self, time):
     """ returns the time the elevator spends not moving and not being
         called by anyone
         
         the values returned are averages derived from data collection
     """
     if self.type == TYPE_F:
         if is_morning(time):
             return 29
         elif is_afternoon(time):
             return 6
         elif is_evening(time):
             return 277
     elif self.type == TYPE_L:
         if is_morning(time):
             return 20
         elif is_afternoon(time):
             return 6
         elif is_evening(time):
             return 294
     elif self.type == TYPE_I:
         if is_morning(time):
             return 13
         elif is_afternoon(time):
             return 12
         elif is_evening(time):
             return 219
     elif self.type == TYPE_E:
         if is_morning(time):
             return 51
         elif is_afternoon(time):
             return 1
         elif is_evening(time):
             return 189
Example #7
0
 def create_passengers(self, time):
     # we want to find what minute period we're in, ie
     # if we're in 5, 10, 15, 20, ...
     minute_period = (time / 60) % 60
     minute_period -= minute_period % 5
     
     # then we take that minute period and find the index in the arrival
     # distribution arrays, which will give us an arrival rate for that
     # 5-minute period
     index = minute_period / 5
     arrivals = 0
     
     # based on the time of day, we select the rate from the proper array
     # and pass it to a poisson distribution for a 5-minute period
     if is_morning(time):
         arrivals = rand.poisson(5, arrival_distrs[self.type]['morning'][index])
     elif is_afternoon(time):
         arrivals = rand.poisson(5, arrival_distrs[self.type]['afternoon'][index])
     elif is_evening(time):
         arrivals = rand.poisson(5, arrival_distrs[self.type]['evening'][index])
        
     # finally, as the arrivals are in terms of one elevator and our data
     # was based on a default amount of elevators, we multiply it by
     # that amount of elevators to create a pool of people for the group
     self.pool = arrivals * self.default_count
Example #8
0
    def create_passengers(self, time):
        # we want to find what minute period we're in, ie
        # if we're in 5, 10, 15, 20, ...
        minute_period = (time / 60) % 60
        minute_period -= minute_period % 5

        # then we take that minute period and find the index in the arrival
        # distribution arrays, which will give us an arrival rate for that
        # 5-minute period
        index = minute_period / 5
        arrivals = 0

        # based on the time of day, we select the rate from the proper array
        # and pass it to a poisson distribution for a 5-minute period
        if is_morning(time):
            arrivals = rand.poisson(
                5, arrival_distrs[self.type]['morning'][index])
        elif is_afternoon(time):
            arrivals = rand.poisson(
                5, arrival_distrs[self.type]['afternoon'][index])
        elif is_evening(time):
            arrivals = rand.poisson(
                5, arrival_distrs[self.type]['evening'][index])

        # finally, as the arrivals are in terms of one elevator and our data
        # was based on a default amount of elevators, we multiply it by
        # that amount of elevators to create a pool of people for the group
        self.pool = arrivals * self.default_count
Example #9
0
 def create_passengers(self, time):
     minute_period = (time / 60) % 60
     minute_period -= minute_period % 5
     
     index = minute_period / 5
     arrivals = 0
     
     if is_morning(time):
         arrivals = rand.poisson(5, arrival_distrs[self.type]['morning'][index])
     elif is_afternoon(time):
         arrivals = rand.poisson(5, arrival_distrs[self.type]['afternoon'][index])
     elif is_evening(time):
         arrivals = rand.poisson(5, arrival_distrs[self.type]['evening'][index])
         
     self.pool = arrivals
Example #10
0
 def pick_floor(self, time):
     """ picks a floor as a passenger would based on the time of day 
         and type of elevator.
         
         time must be in seconds.
     """
     
     if is_morning(time):
         f = floor_distrs[self.type]['morning']
         return f()
     elif is_afternoon(time):
         f = floor_distrs[self.type]['afternoon']
         return f()
     elif is_evening(time):
         f = floor_distrs[self.type]['evening']
         return f()
Example #11
0
    def pick_floor(self, time):
        """ picks a floor as a passenger would based on the time of day 
            and type of elevator.
            
            time must be in seconds.
        """

        if is_morning(time):
            f = floor_distrs[self.type]['morning']
            return f()
        elif is_afternoon(time):
            f = floor_distrs[self.type]['afternoon']
            return f()
        elif is_evening(time):
            f = floor_distrs[self.type]['evening']
            return f()
Example #12
0
 def pick_floor(self, time):
     """ picks a floor it is going to based on the time of day and type
         time must be in seconds where 0 is 5am
     """
     
     if is_morning(time):
         f = floor_distrs[self.type]['morning']()
         print "morning: " + str(f)
         return f
     elif is_afternoon(time):
         f = floor_distrs[self.type]['afternoon']()
         print "afternoon: " + str(f)
         return f
     elif is_evening(time):
         f = floor_distrs[self.type]['evening']()
         print "evening: " + str(f)
         return f
Example #13
0
    def create_passengers(self, time):
        minute_period = (time / 60) % 60
        minute_period -= minute_period % 5

        index = minute_period / 5
        arrivals = 0

        if is_morning(time):
            arrivals = rand.poisson(
                5, arrival_distrs[self.type]['morning'][index])
        elif is_afternoon(time):
            arrivals = rand.poisson(
                5, arrival_distrs[self.type]['afternoon'][index])
        elif is_evening(time):
            arrivals = rand.poisson(
                5, arrival_distrs[self.type]['evening'][index])

        self.pool = arrivals