ncpus = 1 # default, unless otherwise specified in sbatch script solver = '' # leave blank to let temoa decide which solver to use of those installed iterations = 2 # ======================================================= # begin script # ======================================================= try: ncpus = int(os.getenv( 'NUM_PROCS')) # try to use variable defined in sbatch script except: ncpus = ncpus # otherwise default to this number of cores # combine data files tt.combine(project_path=project_path, primary='data_virginia.xlsx', data_files=['data_emerging_tech.xlsx', 'data_H2_VFB.xlsx'], output='data_combined.xlsx') # ======================================================= # Move modelInputs_XLSX to database # ======================================================= modelInputs = tt.move_data_to_db(modelInputs_XLSX, path=project_path) # ======================================================= # Create directories - best completed before using multiprocessing # ======================================================= mc_dir = 'monte_carlo' tt.create_dir(project_path=project_path, optional_dir=mc_dir) # ==================================== # Perform Simulations
ncpus = ncpus # otherwise default to this number of cores # iterate through base_data_files for base_data_file, base_data_name in zip(base_data_files, base_data_names): # iterate through emission_inputs for emission_input, emission_name in zip(emission_inputs, emission_names): # naming convention combined_name = base_data_name + '_' + emission_name combined_file = combined_name + '.xlsx' # combine files tt.combine(project_path=project_path, primary=base_data_file, data_files=[emission_input], output=combined_file) # ======================================================= # Move modelInputs_XLSX to database # ======================================================= modelInputs = tt.move_data_to_db(combined_file, path=project_path) # ==================================== # Perform Simulations option = 2 # 1 - Run first, 2 - Run all # ==================================== if option == 1: # Perform single simulation evaluateModel(modelInputs, scenario_inputs, scenario_names[0],
# iterate through emission_inputs # ======================================================= for emission_input, emission_name in zip(emission_inputs, emission_names): # naming convention combined_name = emission_name combined_file = combined_name + '.xlsx' # files files = [emission_input] for modelInput in modelInputs_secondary: if len(modelInput) > 0: files.append(modelInput) # combine files tt.combine(project_path=project_path, primary=modelInputs_primary, data_files=files, output=combined_file) # ======================================================= # Move modelInputs_XLSX to database # ======================================================= modelInputs = tt.move_data_to_db(combined_file, path=project_path) # ==================================== # Perform Simulations # ==================================== for monte_carlo_case in monte_carlo_cases: for scenarioName, iterations in zip(scenarioNames, n_iterations): # Create monte carlo cases os.chdir(os.path.join(project_path, 'data'))
sensitivityMultiplier = 10.0 # percent perturbation ncpus = 1 # default, unless otherwise specified in sbatch script solver = '' # leave blank to let temoa decide which solver to use of those installed # ======================================================= # begin script # ======================================================= try: ncpus = int(os.getenv( 'NUM_PROCS')) # try to use variable defined in sbatch script except: ncpus = ncpus # otherwise default to this number of cores # combine data files tt.combine(project_path=project_path, primary=data_files[0], data_files=data_files[1:], output='data_combined_sensitivity.xlsx') modelInputs_XLSX = 'data_combined_sensitivity.xlsx' # ======================================================= # Move modelInputs_XLSX to database # ======================================================= modelInputs = tt.move_data_to_db(modelInputs_XLSX, path=project_path) # ======================================================= # Create directories - best completed before using multiprocessing # ======================================================= sens_dir = 'sensitivity' tt.create_dir(project_path=project_path, optional_dir=sens_dir) # ====================================