try: copy2(case_input_path_filename, output_folder) except: print( 'case input file ' + case_input_path_filename + ' not copied. Perhaps it does not exist. Perhaps it is open and cannot be overwritten.' ) # ----------------------------------------------------------------------------- print('Simple_Energy_Model: Executing core model loop') 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') # -----------------------------------------------------------------------------
output_folder = global_dic['OUTPUT_PATH'] + '/' + global_dic['GLOBAL_NAME'] if not os.path.exists(output_folder): os.makedirs(output_folder) copy2(case_input_path_filename, output_folder) # ----------------------------------------------------------------------------- print('Simple_Energy_Model: Executing core model loop') 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 scalar_names, scalar_table = 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) os.remove("./gurobi.log") # ----------------------------------------------------------------------------- if global_dic['POSTPROCESS']: print('Simple_Energy_Model: Post-processing results')
# '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)
case_dic,tech_list = preprocess_input(case_input_path_filename) # ----------------------------------------------------------------------------- # copy the input data file to the output folder output_folder = case_dic['output_path'] + '/' + case_dic['case_name'] if not os.path.exists(output_folder): os.makedirs(output_folder) try: copy2(case_input_path_filename, output_folder) except: print ('case input file '+case_input_path_filename+' not copied. Perhaps it does not exist. Perhaps it is open and cannot be overwritten.') # ----------------------------------------------------------------------------- print ('Macro_Energy_Model: Executing core model') #global_results_dic, decision_dic_list = core_model (case_dic, tech_list) constraint_list,cvxpy_constraints,cvxpy_prob,cvxpy_capacity_dic,cvxpy_dispatch_dic = core_model (case_dic, tech_list) # constraints,prob,capacity_dic,dispatch_dic = extract_cvxpy_output(cvxpy_constraints,cvxpy_prob,cvxpy_capacity_dic,cvxpy_dispatch_dic ) prob_dic,capacity_dic,dispatch_dic = extract_cvxpy_output(case_dic,tech_list,constraint_list, cvxpy_constraints,cvxpy_prob,cvxpy_capacity_dic,cvxpy_dispatch_dic ) print ('Simple_Energy_Model: Saving basic results') # Note that results for individual cases are output from core_model_loop case,tech,time = save_basic_results(case_dic, tech_list, cvxpy_constraints,prob_dic,capacity_dic,dispatch_dic)