def find_e10_blend(cas, BOB, spids, propvec): # E10 merit in this BOB e10comp = {'64-17-5': 0.1, BOB: 0.9} x = get_xvec(e10comp, spids) x = volume_to_other(x, propvec, 'MOLE') ME10 = eval_merit(x, propvec) fsq = lambda vf: (comp_mf(cas, BOB, spids, propvec, vf) - ME10)**2 vf = 0.3 res = minimize(fsq, vf, method='Nelder-Mead') print("Residual: {}".format(res.fun)) vfrac_E10_equiv = res.x[0] if res.success and res.fun < 1.0e-5: return ME10, vfrac_E10_equiv else: return ME10, None
def comp_mf(cas, BOB, spids, propvec, vf): thiscomp = {cas: vf, BOB: (1 - vf)} x = get_xvec(thiscomp, spids) x = volume_to_other(x, propvec, 'MOLE') M = eval_merit(x, propvec) return M
mf_knom = [] mf_knom_idx = [] isamp = 0 comp_25 = [] comp_50 = [] comp_75 = [] comp_name = [] comp_idx = [] comp_samples = [] for c, nm in zip(cas_list, nm_list): if len(c) > 0: print(" c = {}".format(c)) comp = {c: 0.1, 'BOB-1': 0.9} # comp = {c:1.0, 'BOB-1':0.0} x = get_xvec(comp, spids) x = volume_to_other(x, propvec, 'MOLE') print("mole fracs: {}".format(x)) ron = blend_linear_vec(x, propvec, 'RON') print("Mixture RON: {}".format(ron)) ron = blend_fancy_vec(x, propvec, 'RON') print("Fancy Mixture RON: {}".format(ron)) sen = blend_fancy_vec(x, propvec, 'S') print("{} Fancy Mixture S: {}".format(isamp, sen)) HoV = blend_fancy_vec(x, propvec, 'HoV') print("Fancy Mixture HoV: {}".format(HoV))