예제 #1
0
    def get_request(self):
        if self.__time_for_create <= Time.get_current_time():
            self.__time_for_create = self.__calculate_time_for_create()
            r = Request(self.__number, Time.get_current_time(), self.stat)
            r.created()
            Time.upd_time(self.__time_for_create)
            return r

        Time.upd_time(self.__time_for_create)
        return None
예제 #2
0
 def __ten_steps(self):
     for i in range(10):
         self.__step()
     self.__fill_buffer()
     self.__fill_workers()
     self.__time.set('{:.3f}'.format(Time.get_current_time()))
     self.__step2.set(Time.get_current_step())
예제 #3
0
 def try_to_release(self):
     if Time.get_current_time(
     ) >= self.__time_of_release and not self.is_available():
         self.__current_request.leave_worker(self.__number)
         self.__current_request = None
     elif not self.is_available():
         Time.upd_time(self.__time_of_release)
예제 #4
0
 def __one_step(self):
     self.__step()
     self.__fill_buffer()
     self.__fill_workers()
     self.__time.set('{:.3f}'.format(Time.get_current_time()))
     self.__step2.set(Time.get_current_step())
예제 #5
0
 def __calculate_time_for_create(self):
     return Time.get_current_time() + (-1/config.alf)*log(random())
예제 #6
0
 def __calculate_work_time(self):
     return Time.get_current_time() + config.lam * exp(
         int(random() * -config.lam))
예제 #7
0
 def deny_buffer(self):
     self.stat.denied(self.__numOfSource)
     self.stat.add_wait_time(self.__numOfSource,
                             Time.get_current_time() - self.__time)
예제 #8
0
    def leave_worker(self, num):
        self.stat.add_worker_time2(num, Time.get_current_time())

        self.stat.completed(self.__numOfSource)
        self.stat.add_all_time(self.__numOfSource,
                               Time.get_current_time() - self.__time)
예제 #9
0
    def in_worker(self, num, time):
        self.stat.add_work_time(self.__numOfSource,
                                time - Time.get_current_time())

        self.stat.add_worker_time(num, Time.get_current_time())
예제 #10
0
 def leave_buffer(self):
     self.stat.add_wait_time(self.__numOfSource,
                             Time.get_current_time() - self.__time)