Beispiel #1
0
    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)

        Wmm1 = 1.0 / (mu - lamb)
Beispiel #2
0
                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')
                        node2.add_conn(link23, 'I')
                        node3.add_conn(link34, 'I')
Beispiel #3
0
    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:
                    simtime = 30
                env.run(simtime)
Beispiel #4
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)
                                link43 = Link(env, 'L4-3', B, k)
                                link1A = Link(env, 'L1-A', B, k)
                                link2B = Link(env, 'L2-B', B, k)
Beispiel #5
0
                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')
                        node2.add_conn(link23, 'I')
                        node3.add_conn(link34, 'I')
Beispiel #6
0
    mu = 350

    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', 350, k)
                node2 = Node(env, 'N2', 350, k)
                link1 = Link(env, 'L1', B, np.inf)
                link2 = Link(env, 'L2', B, np.inf)

                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:
                    simtime = 30
                env.run(simtime)
Beispiel #7
0
    for lam in lamb:
        for k in K:
            Wmm1 = 0
            Wmd1 = 0
            Wmg1 = 0
            Wmmk = 0
            pb = 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')
                node2 = Node(env, 'N1', 350, k)
                link = Link(env, 'L', B, np.inf)

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

                if k == 10000:
                    simtime = 500
                else:
                    simtime = 30
                env.run(simtime)

                loss_probability += 100.0 * (tx.packets_sent -
                                             rx.packets_recv) / tx.packets_sent
                average_delay += 1.0 * rx.overalldelay / rx.packets_recv
Beispiel #8
0
    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', 300, k)
                link1 = Link(env, 'L1', B, k)

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

                if k == 10000:
                    simtime = 500
                else:
                    simtime = 30

                env.run(simtime)

                loss_probability += 100.0 * (tx.packets_sent -
                                             rx.packets_recv) / tx.packets_sent
Beispiel #9
0
    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))