core_model_loop(global_dic, case_dic_list)

print('Simple_Energy_Model: Saving basic results')
# Note that results for individual cases are output from core_model_loop
save_basic_results(global_dic, case_dic_list)

# -----------------------------------------------------------------------------

# copy the Gurobi log file to the output folder
#   The Verbose field in SOLVE function in CORE_MODEL.PY determined if a gurobi.log is generated.
#   delete the gurobi log to eliminate cumulations from previous runs.

if os.path.exists("./gurobi.log"):
    copy2("./gurobi.log", output_folder)
    try:
        os.remove("./gurobi.log")
    except:
        print('gurboi.log not erased')

# -----------------------------------------------------------------------------

if global_dic['POSTPROCESS']:
    print('Simple_Energy_Model: Post-processing results')
    post_process(global_dic)  # Lei's old postprocessing

if global_dic['QUICK_LOOK']:
    print('Simple_Energy_Model: Preparing quick look at results')
    pickle_file_name = './Output_Data/' + global_dic[
        'GLOBAL_NAME'] + '/' + global_dic['GLOBAL_NAME'] + '.pickle'
    quick_look(global_dic, case_dic_list)  # Fan's new postprocessing
#        'nate2_battery',
#        'nate2_solar'
#         'test_bat'
#        'test3'
        ]
# =============================================================================
for case_switch in case_list:
    
    file_info, time_series, assumption_list = preprocess_input(
        root_directory,
        case_switch,
        hour_simulation_start,
        hours_of_simulation,
        verbose
        )  

    result_list = core_model_loop (
        time_series,
        assumption_list,
        verbose
        )

    scalar_names,scalar_table = save_basic_results(
        file_info,
        time_series,
        assumption_list,
        result_list,
        verbose)
    if switch_postprocess == True:
        post_process(file_info)