import subprocess
import time


def run_script():

    # outer_blades_count = [12.0, 24.0, 36.0, 48.0]
    # outer_blades_count = [24.0, 36.0]
    outer_blades_count = [24.0]
    # outer_blades_length = [44.0, 86.0, 107.5]
    outer_blades_length = [70.0]
    # outer_blades_angle = [30.0, 45.0, 60.0, 75.0]
    outer_blades_angle = [45.0, 60.0]
    middle_blades_count = [9.0, 27.0, 36.0]
    # middle_blades_count = 18.0
    # load = [190, 260, 315, 400, 465]
    load = [315, 400, 465]
    # load_eco = [260, 315, 400, 465]
    # load = [190, 260, 465]
    # recycling_eco = [0, 7, 14, 21, 28]
    # recycling_full = [0, 5, 8, 10, 15, 20, 25, 30]
    recycling_full = [0, 5, 10, 20]
    # recycling = [0, 6, 12, 18, 24, 30]
    # recycling = [0, 5, 8]

    for middle_count in middle_blades_count:
        for length in outer_blades_length:
            for outer_blade in outer_blades_count:
                for angle in outer_blades_angle:
                    for current_load in load:
                        for current_recycling in recycling_full:

                            # Начало замера времени
                            start_time = time.time()

                            result = subprocess.run(['python', 'new_experiment_planner.py', str(outer_blade),
                                                     str(length), str(angle), str(middle_count),
                                                     str(current_load), str(current_recycling)], capture_output=True, text=True)

                            # Конец замера времени
                            end_time = time.time()

                            # Вычисление времени выполнения
                            execution_time = end_time - start_time

                            print("Output of the script:")
                            print(result.stdout)

                            print("Errors (if any):")
                            print(result.stderr)

                            print("Execution time:", execution_time)


if __name__ == "__main__":
    run_script()