src.Main

 1from . import Generator
 2from . import InputLoader
 3from . import ELDCalculator
 4from tabulate import tabulate
 5def main():
 6    """
 7    Main function to run the ELD calculation.
 8    """
 9    use_csv = True  # Toggle this to True to load from CSV
10    input = InputLoader.InputLoader()
11
12    if use_csv:
13        file_path = "./input/10-generator_system.csv"
14        input.load_data_from_file(file_path)
15    else:
16        input.load_data_from_user()
17
18    gen_list = input.get_generators()
19
20    if not gen_list:
21        print("No valid generators loaded. Exiting.")
22        return
23
24    print(f"Total generators loaded: {len(gen_list)}")
25
26    # Print generator details
27    df = input.display_generators()
28
29    total_demand = 2000.0
30    eld_calculator = ELDCalculator.ELDCalculator(len(gen_list), gen_list, total_demand)
31
32    el_dispatch = eld_calculator.lambda_iteration()
33    P = el_dispatch[0]
34    df["Power_Dispatch"]= P
35    headers = ["Gen_ID", "Min_Capacity", "Max_Capacity", "a", "b", "c","Power_Dispatch"]
36    print(tabulate(df,headers=headers, tablefmt="simple"))  
37
38if __name__ == "__main__":
39    main()
def main():
 6def main():
 7    """
 8    Main function to run the ELD calculation.
 9    """
10    use_csv = True  # Toggle this to True to load from CSV
11    input = InputLoader.InputLoader()
12
13    if use_csv:
14        file_path = "./input/10-generator_system.csv"
15        input.load_data_from_file(file_path)
16    else:
17        input.load_data_from_user()
18
19    gen_list = input.get_generators()
20
21    if not gen_list:
22        print("No valid generators loaded. Exiting.")
23        return
24
25    print(f"Total generators loaded: {len(gen_list)}")
26
27    # Print generator details
28    df = input.display_generators()
29
30    total_demand = 2000.0
31    eld_calculator = ELDCalculator.ELDCalculator(len(gen_list), gen_list, total_demand)
32
33    el_dispatch = eld_calculator.lambda_iteration()
34    P = el_dispatch[0]
35    df["Power_Dispatch"]= P
36    headers = ["Gen_ID", "Min_Capacity", "Max_Capacity", "a", "b", "c","Power_Dispatch"]
37    print(tabulate(df,headers=headers, tablefmt="simple"))  

Main function to run the ELD calculation.