if res.success and res.fun < 1.0e-5 and volfrac <= 1.0: return comp_mf(cas, BOB, spids, propvec, volfrac), volfrac else: eff = comp_mf(cas, BOB, spids, propvec, 1.0) return eff, 1.0 if __name__ == '__main__': print("=================================================================") print("Finding blend levels for fixed efficiency") print("=================================================================") matplotlib.rc('xtick', labelsize=24) matplotlib.rc('ytick', labelsize=24) matplotlib.rc('axes', titlesize=24) matplotlib.rc('font', size=24) propDB = load_propDB('testDB.xls') ncomp, spids, propvec = make_property_vector_all(propDB) # Volume fractions: wb = xlrd.open_workbook('test_list.xlsx') ws = wb.sheet_by_index(0) cas_list = [] nm_list = [] jbm_list = [] cas_col = ws.col(0) for c, jb, nm in zip(cas_col[1:], ws.col(2)[1:], ws.col(1)[1:]): cas_list.append(c.value) jbm_list.append(jb.value) nm_list.append(nm.value) if True:
f.write("{}\t".format(c[h])) f.write("\n") if __name__ == '__main__': t0 = time.time() print("=================================================================") print("Welcome to the Co-optimizer") print("=================================================================") print('-----------------------------------------------------------------') print("Setting up:") print("Reading fuel component properties from: ", cooptimizer_input.component_properties_database) propDB = load_propDB(cooptimizer_input.component_properties_database, maxrows=18, maxcols=14) print("Reading fuel component costs from: ", cooptimizer_input.component_cost_database) propDB = load_propDB(cooptimizer_input.component_cost_database, propDB_initial=propDB, maxrows=18, maxcols=3) print('-----------------------------------------------------------------') output_files = [] for t, v in cooptimizer_input.task_list.items(): if v: ans = 'Yes' else: ans = 'No' print('Planning to perform task: ', t, '\t\t', ans)
if k in comp.keys(): ws.write(j, i, comp[k]) i += 1 j += 1 wb.save(output_file) if __name__ == '__main__': cas = read_input_list('assert_20.xls') # Add blendstocks to this as well as flag for is it a blend so that # know how to map it to fpdatabase fields print("{}".format(cas)) keys = ['Pure_CAS', 'pk_UUID', 'Pure_Molecular_Formula', 'Pure_IUPAC_name', 'Pure_Molecular_Weight', 'Pure_Boiling_Point', 'Pure_LHV', 'Pure_Heat_of_Vaporization', 'Pure_RON', 'Pure_MON', 'Pure_PMI', 'Pure_Density', 'Blend_Name', 'Blend_Density', 'Blend_HoV', 'Blend_LHV', 'Blend_MON', 'Blend_RON', 'Blend_PMI'] data = load_raw_fpdatabase('Fuel Engine Co Optimization-2.csv', cas, keys) write_propDB_remap('testpropDB.xls', data) # Now re-read that file, combine with the bRON data and write # out the result: propDB = load_propDB('testpropDB.xls') propDB = load_propDB('bRON_data_with_CAS.xls', propDB_initial=propDB) write_propDB('testDB.xls', propDB)