Пример #1
0
    def process_sample():
        s_wait_1 = 0; s_s_wait_1 = 0
        s_wait_2 = 0; s_s_wait_2 = 0
        s_server_1 = 0; s_server_2 = 0

        for client in self.clients:
            s_wait_1 += client.wait(1)
            s_s_wait_1 += client.wait(1)**2
            s_server_1 += client.server[1]
            s_wait_2 += client.wait(2)
            s_s_wait_2 += client.wait(2)**2
            s_server_2 += client.server[2]
            
        self.results['m_s_W1'] += est.mean(s_wait_1, len(self.clients))
        self.results['m_s_s_W1'] += est.mean(s_wait_1, len(self.clients))**2
        self.results['v_s_W1'] += est.variance(s_wait_1, s_s_wait_1, len(self.clients))
        self.results['v_s_s_W1'] += est.variance(s_wait_1, s_s_wait_1, len(self.clients))**2
        self.results['m_s_N1'] += est.mean(self.N_samples['N_1'], self.t)
        self.results['m_s_s_N1'] += est.mean(self.N_samples['N_1'], self.t)**2
        self.results['m_s_Nq1'] += est.mean(self.N_samples['Nq_1'], self.t)
        self.results['m_s_s_Nq1'] += est.mean(self.N_samples['Nq_1'], self.t)**2
        self.results['m_s_T1'] += est.mean(s_wait_1, len(self.clients)) + est.mean(s_server_1, len(self.clients))
        self.results['m_s_s_T1'] += (est.mean(s_wait_1, len(self.clients)) + est.mean(s_server_1, len(self.clients)))**2
        self.results['m_s_W2'] += est.mean(s_wait_2, len(self.clients))
        self.results['m_s_s_W2'] += est.mean(s_wait_2, len(self.clients))**2
        self.results['v_s_W2'] += est.variance(s_wait_2, s_s_wait_2, len(self.clients))
        self.results['v_s_s_W2'] += est.variance(s_wait_2, s_s_wait_2, len(self.clients))**2
        self.results['m_s_N2'] += est.mean(self.N_samples['N_2'], self.t)
        self.results['m_s_s_N2'] += est.mean(self.N_samples['N_2'], self.t)**2
        self.results['m_s_Nq2'] += est.mean(self.N_samples['Nq_2'], self.t)
        self.results['m_s_s_Nq2'] += est.mean(self.N_samples['Nq_2'], self.t)**2
        self.results['m_s_T2'] += est.mean(s_wait_2, len(self.clients)) + est.mean(s_server_2, len(self.clients))
        self.results['m_s_s_T2'] += (est.mean(s_wait_2, len(self.clients)) + est.mean(s_server_2, len(self.clients)))**2
        self.init_sample()
Пример #2
0
    def process_sample(self):
        s_wait_1 = 0; s_s_wait_1 = 0
        s_wait_2 = 0; s_s_wait_2 = 0
        s_server_1 = 0; s_server_2 = 0

        # Loop que faz a soma e a soma dos quadrados dos tempos de espera e a soma dos tempos em servidor
        # Dos clientes na fila 1 e na fila 2.
        for client in self.clients:
            s_wait_1 += client.wait(1)
            s_s_wait_1 += client.wait(1)**2
            s_server_1 += client.server[1]
            s_wait_2 += client.wait(2)
            s_s_wait_2 += client.wait(2)**2
            s_server_2 += client.server[2]
            
        # Adiciona à soma e à soma dos quadrados dos estimadores os valores estimados na rodada.
        self.sums['m_s_W1'] += est.mean(s_wait_1, len(self.clients))
        self.sums['m_s_s_W1'] += est.mean(s_wait_1, len(self.clients))**2
        self.sums['v_s_W1'] += est.variance(s_wait_1, s_s_wait_1, len(self.clients))
        self.sums['v_s_s_W1'] += est.variance(s_wait_1, s_s_wait_1, len(self.clients))**2
        self.sums['m_s_N1'] += est.mean(self.N_samples['N_1'], self.t)
        self.sums['m_s_s_N1'] += est.mean(self.N_samples['N_1'], self.t)**2
        self.sums['m_s_Nq1'] += est.mean(self.N_samples['Nq_1'], self.t)
        self.sums['m_s_s_Nq1'] += est.mean(self.N_samples['Nq_1'], self.t)**2
        self.sums['m_s_T1'] += est.mean(s_wait_1, len(self.clients)) + est.mean(s_server_1, len(self.clients))
        self.sums['m_s_s_T1'] += (est.mean(s_wait_1, len(self.clients)) + est.mean(s_server_1, len(self.clients)))**2
        self.sums['m_s_W2'] += est.mean(s_wait_2, len(self.clients))
        self.sums['m_s_s_W2'] += est.mean(s_wait_2, len(self.clients))**2
        self.sums['v_s_W2'] += est.variance(s_wait_2, s_s_wait_2, len(self.clients))
        self.sums['v_s_s_W2'] += est.variance(s_wait_2, s_s_wait_2, len(self.clients))**2
        self.sums['m_s_N2'] += est.mean(self.N_samples['N_2'], self.t)
        self.sums['m_s_s_N2'] += est.mean(self.N_samples['N_2'], self.t)**2
        self.sums['m_s_Nq2'] += est.mean(self.N_samples['Nq_2'], self.t)
        self.sums['m_s_s_Nq2'] += est.mean(self.N_samples['Nq_2'], self.t)**2
        self.sums['m_s_T2'] += est.mean(s_wait_2, len(self.clients)) + est.mean(s_server_2, len(self.clients))
        self.sums['m_s_s_T2'] += (est.mean(s_wait_2, len(self.clients)) + est.mean(s_server_2, len(self.clients)))**2
        # Inicializa as estruturas de dados para a próxima rodada.
        self.init_sample()