Esempio n. 1
0
def single_run(
    seed: int,
    stations_number: int,
    simulation_time: int,
    skip_results: bool,
    cw_min: int,
    cw_max: int,
    r_limit: int,
    payload_size: int,
    mcs_value: int,
):
    results = dict()
    backoffs = {key: {stations_number: 0} for key in range(cw_max + 1)}
    dcfsimpy.run_simulation(
        stations_number,
        seed,
        simulation_time,
        skip_results,
        dcfsimpy.Config(payload_size, cw_min, cw_max, r_limit, mcs_value),
        backoffs,
        results,
    )

    if not skip_results:
        dcfsimpy.save_results(results, backoffs, "single_run")
Esempio n. 2
0
def run_changing_mcs(
    runs: int,
    seed: int,
    stations_number: int,
    simulation_time: int,
    skip_results: bool,
    cw_min: int,
    cw_max: int,
    r_limit: int,
    payload_size: int,
):
    results = dict()
    backoffs = {key: {stations_number: 0} for key in range(cw_max + 1)}
    for _ in range(runs):
        threads = [
            threading.Thread(
                target=dcfsimpy.run_simulation,
                args=(
                    stations_number,
                    seed * _,
                    simulation_time,
                    skip_results,
                    dcfsimpy.Config(payload_size, cw_min, cw_max, r_limit,
                                    mcs_value),
                    backoffs,
                    results,
                ),
            ) for mcs_value in range(0, 8)
        ]
        __start_threads(threads)
    if not skip_results:
        path = dcfsimpy.save_results(results, backoffs, "run_changing_mcs")
        dcfsimpy.show_results_changing_mcs(path)
Esempio n. 3
0
def run_changing_cw(
    runs: int,
    seed: int,
    stations_start: int,
    stations_end: int,
    stations_step: int,
    simulation_time: int,
    skip_results: bool,
    cw_min_start: int,
    cw_min_stop: int,
    cw_max: int,
    r_limit: int,
    payload_size: int,
    mcs_value: int,
):
    # config = dcfsimpy.Config(payload_size, cw_min, cw_max, r_limit)
    results = dict()
    backoffs = {
        key: {i: 0
              for i in range(stations_start, stations_end + 1)}
        for key in range(cw_max + 1)
    }
    for cw_min in [
            pow(2, x) - 1 for x in range(int((cw_min_start + 1) /
                                             2), int((cw_min_stop + 1) / 2))
    ]:
        for _ in range(runs):
            threads = [
                threading.Thread(
                    target=dcfsimpy.run_simulation,
                    args=(
                        n,
                        seed * _,
                        simulation_time,
                        skip_results,
                        dcfsimpy.Config(payload_size, cw_min, cw_max, r_limit,
                                        mcs_value),
                        backoffs,
                        results,
                    ),
                )
                for n in range(stations_start, stations_end + 1, stations_step)
            ]
            __start_threads(threads)
    if not skip_results:
        path = dcfsimpy.save_results(results, backoffs, "run_changing_cw")
        dcfsimpy.show_results_changing_cw(path)
Esempio n. 4
0
def run_changing_stations(
    runs: int,
    seed: int,
    stations_start: int,
    stations_end: int,
    simulation_time: int,
    skip_results: bool,
    cw_min: int,
    cw_max: int,
    r_limit: int,
    payload_size: int,
    mcs_value: int,
    skip_results_show: bool,
):
    config = dcfsimpy.Config(payload_size, cw_min, cw_max, r_limit, mcs_value)
    results = dict()
    backoffs = {
        key: {i: 0
              for i in range(stations_start, stations_end + 1)}
        for key in range(cw_max + 1)
    }
    for _ in range(runs):
        threads = [
            threading.Thread(
                target=dcfsimpy.run_simulation,
                args=(
                    n,
                    seed * _,
                    simulation_time,
                    skip_results,
                    config,
                    backoffs,
                    results,
                ),
            ) for n in range(stations_start, stations_end + 1)
        ]
        __start_threads(threads)
    if not skip_results:
        path = dcfsimpy.save_results(results, backoffs,
                                     "run_changing_stations")
        if not skip_results_show:
            dcfsimpy.show_results_changing_stations(path)