Beispiel #1
0
        for b in lambBI:
            for k in K:
                for r in muR:
                    Wk = 0
                    loss_probability_all = 0
                    loss_probability_nodes = 0
                    loss_probability_links = 0
                    average_delay = 0
                    trans_band = 0
                    for i in range(1, 4):
                        env = simpy.Environment()

                        txA = pkt_Sender(env, 'A', a, 'I')
                        txB = pkt_Sender(env, 'B', b, 'I')

                        rxI = pkt_Receiver(env, 'I')

                        node1 = Node(env, 'N1', r, k)
                        node2 = Node(env, 'N2', r, k)
                        node3 = Node(env, 'N3', r, k)
                        node4 = Node(env, 'N4', r, k)

                        link13 = Link(env, 'L1-3', B, k)
                        link23 = Link(env, 'L2-3', B, k)
                        link34 = Link(env, 'L3-4', B, k)
                        link4I = Link(env, 'L4-I', B, k)

                        txA.out = node1
                        txB.out = node2

                        node1.add_conn(link13, 'I')
Beispiel #2
0
    lamb = 275.0
    K_arr = [64, 96, 128, 10000]
    tmp = 782  # 0.5*1500+0.5*64 bytes em media

    array_node1 = []
    array_node2 = []

    for K in K_arr:
        print Fore.BLUE + Style.BRIGHT + "NODE 1" + Style.RESET_ALL

        env = simpy.Environment()
        B = 2e6

        # Sender (tx) -> Node1 -> Link -> Receiver (rx)

        rx = pkt_Receiver(env, 'B')
        tx = pkt_Sender(env, 'A', 'B', time_packets)
        node1 = Node(env, 'N1', np.inf)
        link = Link(env, 'L', B, K)

        tx.out = node1
        node1.add_conn(link, 'B')
        link.out = rx

        env.run()

        print((Fore.LIGHTBLUE_EX + "Loss probability:" + Fore.GREEN + " %.2f%%" + Style.RESET_ALL) % round((100.0 * (tx.packets_sent-rx.packets_recv) / tx.packets_sent), 5))
        print((Fore.LIGHTBLUE_EX + 'Average delay:' + Fore.GREEN + ' %f sec' + Style.RESET_ALL) % round((1.0 * rx.overalldelay / rx.packets_recv), 5))
        print((Fore.LIGHTBLUE_EX + 'Transmitted bandwidth:' + Fore.GREEN + ' %.1f Bytes/sec' + Style.RESET_ALL) % round((1.0 * rx.overallbytes / simtime), 5))

        mu = B * 1.0 / (tmp * 8)
Beispiel #3
0
                            average_delayIB = 0
                            trans_band = 0
                            trans_bandIB = 0
                            trans_bandIA = 0
                            Wk = 0
                            WkIA = 0
                            WkIB = 0
                            for i in range(1, 4):
                                env = simpy.Environment()

                                txA = pkt_Sender(env, 'A', ai, 'I')
                                txB = pkt_Sender(env, 'B', bi, 'I')
                                txIA = pkt_Sender(env, 'I', ia, 'A')
                                txIB = pkt_Sender(env, 'I', ib, 'B')

                                rxI = pkt_Receiver(env, 'I')
                                rxA = pkt_Receiver(env, 'A')
                                rxB = pkt_Receiver(env, 'B')

                                node1 = Node(env, 'N1', r, k)
                                node2 = Node(env, 'N2', r, k)
                                node3 = Node(env, 'N3', r, k)
                                node4 = Node(env, 'N4', r, k)

                                link13 = Link(env, 'L1-3', B, k)
                                link23 = Link(env, 'L2-3', B, k)
                                link34 = Link(env, 'L3-4', B, k)
                                link4I = Link(env, 'L4-I', B, k)

                                link31 = Link(env, 'L3-1', B, k)
                                link32 = Link(env, 'L3-2', B, k)
Beispiel #4
0
    B = 2e6
    tmp = 782  # 0.5*1500+0.5*64 bytes em media
    mu = 1.0*B/(tmp*8)

    array = []

    for lam in lamb:
        for k in K:
            Wk = 0
            loss_probability = 0
            average_delay = 0
            trans_band = 0
            for i in range(1, 4):
                env = simpy.Environment()

                rx = pkt_Receiver(env, 'B')
                tx = pkt_Sender(env, 'A', lam, 'B')
                node1 = Node(env, 'N1', np.inf)
                node2 = Node(env, 'N2', np.inf)
                link1 = Link(env, 'L1', B, k)
                link2 = Link(env, 'L2', B, k)

                tx.out = node1
                node1.add_conn(link1, 'B')
                link1.out = node2
                node2.add_conn(link2, 'B')
                link2.out = rx

                if k == 10000:
                    simtime = 500
                else:
Beispiel #5
0
        for b in lambBI:
            for k in K:
                for r in muR:
                    Wk = 0
                    loss_probability_all = 0
                    loss_probability_nodes = 0
                    loss_probability_links = 0
                    average_delay = 0
                    trans_band = 0
                    for i in range(1, 4):
                        env = simpy.Environment()

                        txA = pkt_Sender(env, 'A', a, 'I')
                        txB = pkt_Sender(env, 'B', b, 'I')

                        rxI = pkt_Receiver(env, 'I')

                        node1 = Node(env, 'N1', r, k)
                        node2 = Node(env, 'N2', r, k)
                        node3 = Node(env, 'N3', r, k)
                        node4 = Node(env, 'N4', r, k)

                        link13 = Link(env, 'L1-3', B, k)
                        link23 = Link(env, 'L2-3', B, k)
                        link34 = Link(env, 'L3-4', B, k)
                        link4I = Link(env, 'L4-I', B, k)

                        txA.out = node1
                        txB.out = node2

                        node1.add_conn(link13, 'I')
Beispiel #6
0
                            average_delayIB = 0
                            trans_band = 0
                            trans_bandIB = 0
                            trans_bandIA = 0
                            Wk = 0
                            WkIA = 0
                            WkIB = 0
                            for i in range(1, 4):
                                env = simpy.Environment()

                                txA = pkt_Sender(env, 'A', ai, 'I')
                                txB = pkt_Sender(env, 'B', bi, 'I')
                                txIA = pkt_Sender(env, 'I', ia, 'A')
                                txIB = pkt_Sender(env, 'I', ib, 'B')

                                rxI = pkt_Receiver(env, 'I')
                                rxA = pkt_Receiver(env, 'A')
                                rxB = pkt_Receiver(env, 'B')

                                node1 = Node(env, 'N1', r, k)
                                node2 = Node(env, 'N2', r, k)
                                node3 = Node(env, 'N3', r, k)
                                node4 = Node(env, 'N4', r, k)

                                link13 = Link(env, 'L1-3', B, k)
                                link23 = Link(env, 'L2-3', B, k)
                                link34 = Link(env, 'L3-4', B, k)
                                link4I = Link(env, 'L4-I', B, k)

                                link31 = Link(env, 'L3-1', B, k)
                                link32 = Link(env, 'L3-2', B, k)