def getLimit(fluid, config): method = getMethod() if method == "meos": if isinstance(config, dict): option = config else: option = {} option["eq"] = config.getint("MEoS", "eq") option["visco"] = config.getint("MEoS", "visco") option["thermal"] = config.getint("MEoS", "thermal") Tmin = fluid.eq[option["eq"]]["Tmin"] Tmax = fluid.eq[option["eq"]]["Tmax"] Pmin = fluid._new(T=fluid.eq[option["eq"]]["Tmin"], x=1, **option).P Pmax = fluid.eq[option["eq"]]["Pmax"] * 1000 elif method == "coolprop": Tmin = fluid.eq["Tmin"] Tmax = fluid.eq["Tmax"] Pmin = fluid.eq["Pmin"] Pmax = fluid.eq["Pmax"] elif method == "refprop": import refprop refprop.setup("def", fluid.name) limit = refprop.limitx([1], t=-1) # Using the tiple point temperature the Tmin value returned here can be # lower if define en thermal or viscosity procedures Tmin = fluid.Tt try: Pmin = fluid(T=fluid.Tt, x=1).P except: Pmin = 100 Tmax = limit["tmax"] Pmax = limit["pmax"] * 1000 return Tmin, Tmax, Pmin, Pmax
def d_max(T, x): ''' Maximal fluid density allowed by the Refprop. Inputs: T Fluid temperature [K] x Composition array [array of molar fraction] Output d Fluid molar density [mol/L] ''' return refprop.limitx(x, htype='EOS', t=T, D=0, p=0)['Dmax']
def _maintest(rp): #examples and test setup rp.SetErrorDebug.off() #turn on =>> for testing purpose if rp.test(): #if True; rptest =>>for testing purpose print u'refprop installed correctely' print u'test results' print rp.testresult print u'fluidlib' rp.fluidlib() print u'\n' prop = rp.setup( u'def', u'air', ) print u'setup air' print prop, u'\n' x = prop[u'x'] print u'critp(x)' print rp.critp(x), u'\n' print u'setup water ammonia' print rp.setup( u'def', u'water', u'ammonia', ), u'\n' #alternative setup input rp.setup( u'def', [u'water', u'ammonia'], ) x = [0.5, 0.3] prop = rp.normalize(x) x = prop[u'x'] prop = rp.critp(x) prop = rp.therm(prop[u'tcrit'], prop[u'Dcrit'], x) print u'therm' print prop, u'\n' p = prop[u'p'] print u'therm2' print rp.therm2(prop[u't'], prop[u'D'], x), u'\n' print u'therm0' print rp.therm0(prop[u't'], prop[u'D'], x), u'\n' print u'residual' print rp.residual(prop[u't'], prop[u'D'], x), u'\n' print u'entro' print rp.entro(prop[u't'], prop[u'D'], x), u'\n' print u'enthal' print rp.enthal(prop[u't'], prop[u'D'], x), u'\n' print u'ag' print rp.ag(prop[u't'], prop[u'D'], x), u'\n' print u'cvcp' print rp.cvcp(prop[u't'], prop[u'D'], x), u'\n' print u'dddp' print rp.dddp(prop[u't'], prop[u'D'], x), u'\n' print u'dddt' print rp.dddt(prop[u't'], prop[u'D'], x), u'\n' print u'dhd1' print rp.dhd1(prop[u't'], prop[u'D'], x), u'\n' print u'dpdd' print rp.dpdd(prop[u't'], prop[u'D'], x), u'\n' print u'dpdd2' print rp.dpdd2(prop[u't'], prop[u'D'], x), u'\n' print u'dpdt' print rp.dpdt(prop[u't'], prop[u'D'], x), u'\n' D = prop[u'D'] #function not supported in Windows if platform.system() == u'Linux': print u'dcdt' print rp.dcdt(prop[u't'], x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'dcdt2' print rp.dcdt2(prop[u't'], x), u'\n' print u'fgcty' print rp.fgcty(prop[u't'], D, x), u'\n' print u'gibbs' print rp.gibbs(prop[u't'], prop[u'D'], x), u'\n' #~ print('fgcty2') #~ print(rp.fgcty2(prop['t'], prop['D'], x), '\n') prop = rp.therm3(prop[u't'], prop[u'D'], x) print u'therm3' print prop, u'\n' D = prop[u'D'] print u'virb' print rp.virb(prop[u't'], x), u'\n' print u'virc' print rp.virc(prop[u't'], x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'vird' print rp.vird(prop[u't'], x), u'\n' print u'virba' print rp.virba(prop[u't'], x), u'\n' print u'virca' print rp.virca(prop[u't'], x), u'\n' print u'cvcpk' print rp.cvcpk(1, prop[u't'], D), u'\n' print u'dbdt' print rp.dbdt(prop[u't'], x), u'\n' print u'dpddk' print rp.dpddk(1, prop[u't'], D), u'\n' print u'dpdtk' print rp.dpdtk(2, prop[u't'], D), u'\n' D = 55 t = 373 prop = rp.press(t, D, x) print u'press' print prop, u'\n' p = prop[u'p'] print u'purefld(1)' prop = rp.purefld(1) print prop, u'\n' x = [1] resetup_test_prop_d = prop print u'satt' prop = rp.satt(t, x) print prop, u'\n' print u'satp' prop = rp.satp(prop[u'p'], x) print prop, u'\n' print u'satd' print rp.satd(prop[u'Dliq'], x), u'\n' print u'sath' print rp.sath(47000, x, 0), u'\n' print u'sate' print rp.sate(0.96047E-13, x), u'\n' print u'sats' print rp.sats(50, x, 0), u'\n' print u'purefld(0)' print rp.purefld(0), u'\n' x = [0.5, 0.3] x = rp.normalize(x)[u'x'] print u'csatk' print rp.csatk(1, t), u'\n' print u'dptsatk' print rp.dptsatk(1, t), u'\n' print u'cv2pk' print rp.cv2pk(2, t, D), u'\n' print u'tprho' print rp.tprho(t, p, x, 2, 1, 58), u'\n' print u'flsh, tp' prop = rp.flsh(u'tp', t, p, x) print prop, u'\n' print u'flsh, th' print rp.flsh(u'tH', 305, prop[u'h'], x, 1), u'\n' print u'flsh, tD' print rp.flsh(u'tD', t, 30, x), u'\n' print u'info()' print rp.info(), u'\n' print u'info(2)' print rp.info(2), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'rmix2' print rp.rmix2(x), u'\n' print u'xmass' prop = rp.xmass(x) print prop, u'\n' print u'xmole' print rp.xmole(prop[u'xkg']), u'\n' print u'limitx' print rp.limitx(x, u'eos', t, D, p), u'\n' print u'limitk' print rp.limitk(u'eos', 1, t, D, p), u'\n' print u'limits' print rp.limits(x), u'\n' print u'flsh, ts' prop = rp.flsh(u'ts', t, 40, x) print prop, u'\n' print u'flsh, te' print rp.flsh(u'te', t, prop[u'e'], x), u'\n' print u'flsh, pD' prop = rp.flsh(u'Pd', p, D, x) print prop, u'\n' print u'flsh, ph' prop = rp.flsh(u'ph', p, prop[u'h'], x) print prop, u'\n' print u'flsh, ps' prop = rp.flsh(u'ps', p, prop[u's'], x) print prop, u'\n' print u'flsh, pe' prop = rp.flsh(u'pE', p, prop[u'e'], x) print prop, u'\n' print u'flsh, es' prop = rp.flsh(u'es', prop[u'e'], prop[u's'], x) print prop, u'\n' print u'flsh, hs' prop = rp.flsh(u'hs', 40000, 100, x) print prop, u'\n' print u'flsh, es' print rp.flsh(u'es', 175, 13, x), u'\n' print u'flsh, Dh' print rp.flsh(u'DH', 20, 18000, x), u'\n' print u'flsh, Ds' prop = rp.flsh(u'Ds', 20, 50, x) print prop, u'\n' print u'flsh, De' prop = rp.flsh(u'DE', 20, prop[u'e'], x) print prop, u'\n' print u'flsh, tq' prop = rp.flsh(u'tq', t, prop[u'q'], x) print prop, u'\n' print u'flsh, pq' print rp.flsh(u'pq', 1200, prop[u'q'], x), u'\n' prop = rp.flsh(u'tp', 350, 1200, x) print u'flsh, tp' print prop, u'\n' s = prop[u's'] e = prop[u'e'] h = prop[u'h'] D = prop[u'D'] t = prop[u't'] p = prop[u'p'] Dmin = 40 Dmax = 55 print u'flsh1, liq, ph' print rp.flsh1(u'Ph', p, h, x, 1), u'\n' print u'getphase' print rp.getphase(prop), u'\n' print u'flsh1, liq, pD' print rp.flsh1(u'PD', p, D, x), u'\n' print u'flsh1, liq, ps' print rp.flsh1(u'Ps', p, s, x), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, th' print rp.flsh1(u'th', t, h, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, ts' print rp.flsh1(u'ts', t, s, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, te' print rp.flsh1(u'te', t, e, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, pe' print rp.flsh1(u'Pe', p, e, x), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, hs' print rp.flsh1(u'hs', h, s, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, Dh' print rp.flsh1(u'Dh', D, h, x), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, Ds' print rp.flsh1(u'Ds', D, s, x), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, liq, De' print rp.flsh1(u'De', D, e, x), u'\n' prop = rp.flsh(u'tp', 400, 100, x) s = prop[u's'] e = prop[u'e'] h = prop[u'h'] D = prop[u'D'] Dmin = 0.01 Dmax = 0.05 t = prop[u't'] p = prop[u'p'] print u'flsh1, vap, ph' print rp.flsh1(u'Ph', p, h, x, 2), u'\n' print u'getphase' print rp.getphase(prop), u'\n' print u'flsh1, vap, pD' print rp.flsh1(u'PD', p, D, x, 2), u'\n' print u'flsh1, vap, ps' print rp.flsh1(u'Ps', p, s, x, 2), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, th' print rp.flsh1(u'th', t, h, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, ts' print rp.flsh1(u'ts', t, s, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, te' print rp.flsh1(u'te', t, e, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, pe' print rp.flsh1(u'Pe', p, e, x, 2), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, hs' print rp.flsh1(u'hs', h, s, x, Dmin=Dmin, Dmax=Dmax), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, Dh' print rp.flsh1(u'Dh', D, h, x), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, Ds' print rp.flsh1(u'Ds', D, s, x), u'\n' #unsupported in Windows if platform.system() == u'Linux': print u'flsh1, vap, De' print rp.flsh1(u'De', D, e, x), u'\n' print u'cstar' print rp.cstar(t, p, 8, x), u'\n' print u'fpv' print rp.fpv(t, D, p, x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'excess' print rp.excess(t, p, x, kph=2), u'\n' prop = rp.flsh(u'pq', 1200, 0.65, x) D = prop[u'D'] Dliq = prop[u'Dliq'] Dvap = prop[u'Dvap'] xliq = prop[u'xliq'] xvap = prop[u'xvap'] e = prop[u'e'] h = prop[u'h'] s = prop[u's'] q = prop[u'q'] p = prop[u'p'] t = prop[u't'] #function not supported in Windows if platform.system() == u'Linux': print u'tpfl2' print rp.flsh2(u'tp', t, p, x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'Dhfl2' print rp.flsh2(u'Dh', D, h, x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'Dsfl2' print rp.flsh2(u'Ds', D, s, x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'Defl2' print rp.flsh2(u'De', D, e, x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'thfl2' print rp.flsh2(u'th', t, h, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'tsfl2' print rp.flsh2(u'ts', t, s, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'tefl2' print rp.flsh2(u'te', t, e, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'tDfl2' print rp.flsh2(u'tD', t, D, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'pDfl2' print rp.flsh2(u'pD', p, D, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'phfl2' print rp.flsh2(u'ph', p, h, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'psfl2' print rp.flsh2(u'ps', p, s, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'pefl2' print rp.flsh2(u'pe', p, e, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'tqfl2' print rp.flsh2(u'tq', t, q, x, ksat=0), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'pqfl2' print rp.flsh2(u'pq', p, q, x, ksat=0), u'\n' #function not supported in Windows #~ if platform.system() == 'Linux': #~ print('Dqfl2') #~ print(rp.flsh2('Dq', D, q, x), '\n') prop = rp.flsh(u'tp', 340, 100, x) t = prop[u't'] Dliq = prop[u'Dliq'] Dvap = prop[u'Dvap'] xliq = prop[u'xliq'] xvap = prop[u'xvap'] print u'qmass' prop = rp.qmass(prop[u'q'], xliq, xvap) print prop, u'\n' print u'qmole' print rp.qmole(prop[u'qkg'], prop[u'xlkg'], prop[u'xvkg']), u'\n' print u'wmol' print rp.wmol(x), u'\n' prop = rp.flsh(u'tp', 340, 100, x) print u'dielec' print rp.dielec(prop[u't'], prop[u'D'], x), u'\n' print u'surten' print rp.surten(t, Dliq, Dvap, xliq, xvap), u'\n' print u'surft' print rp.surft(240, x), u'\n' rp.setup(u'def', u'water') print u'meltt' print rp.meltt(273.15, [1]), u'\n' print u'meltp' print rp.meltp(100, [1]), u'\n' print u'sublt' print rp.sublt(273.15, [1]), u'\n' print u'sublp' print rp.sublp(0.1, [1]), u'\n' rp.setup( u'def', u'butane', u'ethane', u'propane', u'methane', ) x = [0.5, 0.15, 0.3, 0.05] rp.setref(u'nbp') prop = rp.flsh(u'tp', 260, 150, x) D = prop[u'D'] print u'trnprp, setref NBP' print rp.trnprp(260, D, x), u'\n' print u'B12' print rp.b12(260, x), u'\n' print u'chempot' print rp.chempot(260, D, x), u'\n' print u'fugcof' print rp.fugcof(260, D, x), u'\n' ##function not supported in Windows #if platform.system() == 'Linux': #print('phiderv') #print(rp.phiderv(2, 1, 260, D, x), '\n') #function not supported in Windows if platform.system() == u'Linux': print u'getmod' print rp.getmod(1, u'EOS'), u'\n' rp.setmod(u'tcx', u'ecs', [u'tc2', u'tc1', u'tc2', u'tc2']) rp.setup( u'def', u'butane', u'ethane', u'propane', u'methane', ) x = [0.5, 0.15, 0.3, 0.05] rp.setref(u'nbp') prop = rp.flsh(u'tp', 260, 200, x) print u'trnprp, setref NBP, setmod [tcx, ecs, tc2, tc1, tc2, tc2]' print rp.trnprp(260, prop[u'D'], x), u'\n' #function not supported in Windows if platform.system() == u'Linux': print u'getmod' print rp.getmod(3, u'tcx'), u'\n' rp.setref(u'oth', 1, [1], 0, 0, 273, 100) print u'setref = OTH' prop = rp.flsh(u'tp', 260, 200, x) print prop, u'\n' resetup_test_prop_a = prop rp.setref(u'???', 1, [1], 0, 0, 373, 100) print u'setref = ???' prop = rp.flsh(u'tp', 260, 200, x) print prop, u'\n' resetup_test_prop_b = prop print u'name' print rp.name(1), u'\n' rp.setup( u'def', u'butane', u'ethane', u'propane', u'methane', ) x = [0.5, 0.15, 0.3, 0.05] print u'getktv' prop = rp.getktv(1, 3) print prop, u'\n' print u'setktv' prop = rp.setktv( 1, 3, u'lin', prop[u'fij'], prop[u'hfmix'], ) print prop, u'\n' resetup_test_prop_c = prop print u'reset setktv' print rp.setktv(1, 2, u'rst'), u'\n' print u'getfij' print rp.getfij(u'LIN'), u'\n' print u'resetup_test_prop, setref, setmod' print resetup_test_prop_a, u'\n' print u'resetup' print rp.resetup(resetup_test_prop_a), u'\n' print u'resetup_test_prop, setref(???), setmod' print resetup_test_prop_b, u'\n' print u'resetup' print rp.resetup(resetup_test_prop_b), u'\n' print u'resetup_test_prop, setktv' print resetup_test_prop_c, u'\n' print u'resetup' print rp.resetup(resetup_test_prop_c), u'\n' print u'resetup_test_prop, purefld' print resetup_test_prop_d, u'\n' print u'resetup' print rp.resetup(resetup_test_prop_d), u'\n' #normalize([0.2, 0.2, 0.1, 0.1]) print u'normalize' print rp.normalize([0.2, 0.2, 0.1, 0.1]), u'\n' #setup_details print u'setup_details' print rp.setup_details({ u'hfld': [u'BUTANE', u'ETHANE', u'PROPANE', u'METHANE'], u'D': 0.21683907260570098, u'Dvap': 0.09664613429889905, u'hfmix': u'HMX.BNC', u'setmod': { u'hcomp': [u'TC2', u'TC1', u'TC2', u'TC2'], u'htype': u'TCX', u'hmix': u'ECS' }, u'cp': -9999980.0, u'xliq': [ Decimal(u'0.7125650648765283717349528049'), Decimal(u'0.04065955068790887177072495080'), Decimal(u'0.2449672538076863186375885862'), Decimal(u'0.001808130627876437856733658079') ], u'xvap': [ Decimal(u'0.2304027911956556081031262882'), Decimal(u'0.2886769748808782463382744488'), Decimal(u'0.3697982730402927396744896960'), Decimal(u'0.1111219608831734058841095670') ], u'x': [0.5, 0.15, 0.3, 0.05], u'e': -13828.39837781548, u'h': -12906.055381248256, u'nc': 4, u'Dliq': 11.150114864150222, u'cv': -9999980.0, u'q': 0.4408579356823604, u'p': 200.0, u's': -44.047682476988044, u't': 260.0, u'w': -9999980.0, u'kph': 1, u'setref': { u'p0': 100, u'ixflag': 1, u'h0': 0, u's0': 0, u't0': 273, u'hrf': [u'OTH', u'???'] }, u'hrf': u'DEF' }), u'\n' #gerg04 print u'gerg04 = 1' rp.gerg04(1) print rp.setup(u'def', u'butane', u'ethane', u'propane'), u'\n' #reset gerg04 print u'gerg04 = 0' rp.gerg04(0) print rp.setup(u'def', u'butane', u'ethane', u'propane'), u'\n' #preos print u'preos = 2' print rp.preos(2), u'\n' print u'preos = -1' print rp.preos(-1), u'\n' print u'preos = 0' print rp.preos(0), u'\n' print u'preos = -1' print rp.preos(-1), u'\n' #setaga print u'setaga' print rp.setaga(), u'\n' #unsetaga print u'unsetaga' print rp.unsetaga(), u'\n' #setup_settings print u'setup_setting' print rp.setup_setting(), u'\n'
def _maintest(rp): #examples and test setup rp.SetErrorDebug.off() #turn on =>> for testing purpose if rp.test(): #if True; rptest =>>for testing purpose print('refprop installed correctely') print('test results') print(rp.testresult) print('fluidlib') rp.fluidlib() print('\n') prop = rp.setup('def', 'air',) print('setup air') print(prop, '\n') x = prop['x'] print('critp(x)') print(rp.critp(x), '\n') print('setup water ammonia') print(rp.setup('def', 'water', 'ammonia',), '\n') #alternative setup input rp.setup('def', ['water', 'ammonia'],) x = [0.5, 0.3] prop = rp.normalize(x) x = prop['x'] prop = rp.critp(x) prop = rp.therm(prop['tcrit'], prop['Dcrit'], x) print('therm') print(prop, '\n') p = prop['p'] print('therm2') print(rp.therm2(prop['t'], prop['D'], x), '\n') print('therm0') print(rp.therm0(prop['t'], prop['D'], x), '\n') print('residual') print(rp.residual(prop['t'], prop['D'], x), '\n') print('entro') print(rp.entro(prop['t'], prop['D'], x), '\n') print('enthal') print(rp.enthal(prop['t'], prop['D'], x), '\n') print('ag') print(rp.ag(prop['t'], prop['D'], x), '\n') print('cvcp') print(rp.cvcp(prop['t'], prop['D'], x), '\n') print('dddp') print(rp.dddp(prop['t'], prop['D'], x), '\n') print('dddt') print(rp.dddt(prop['t'], prop['D'], x), '\n') print('dhd1') print(rp.dhd1(prop['t'], prop['D'], x), '\n') print('dpdd') print(rp.dpdd(prop['t'], prop['D'], x), '\n') print('dpdd2') print(rp.dpdd2(prop['t'], prop['D'], x), '\n') print('dpdt') print(rp.dpdt(prop['t'], prop['D'], x), '\n') D = prop['D'] #function not supported in Windows if platform.system() == 'Linux': print('dcdt') print(rp.dcdt(prop['t'], x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('dcdt2') print(rp.dcdt2(prop['t'], x), '\n') print('fgcty') print(rp.fgcty(prop['t'], D, x), '\n') print('gibbs') print(rp.gibbs(prop['t'], prop['D'], x), '\n') #~ print('fgcty2') #~ print(rp.fgcty2(prop['t'], prop['D'], x), '\n') prop = rp.therm3(prop['t'], prop['D'], x) print('therm3') print(prop, '\n') D = prop['D'] print('virb') print(rp.virb(prop['t'], x), '\n') print('virc') print(rp.virc(prop['t'], x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('vird') print(rp.vird(prop['t'], x), '\n') print('virba') print(rp.virba(prop['t'], x), '\n') print('virca') print(rp.virca(prop['t'], x), '\n') print('cvcpk') print(rp.cvcpk(1, prop['t'], D), '\n') print('dbdt') print(rp.dbdt(prop['t'], x), '\n') print('dpddk') print(rp.dpddk(1, prop['t'], D), '\n') print('dpdtk') print(rp.dpdtk(2, prop['t'], D), '\n') D = 55 t = 373 prop = rp.press(t, D, x) print('press') print(prop, '\n') p = prop['p'] print('purefld(1)') prop = rp.purefld(1) print(prop, '\n') x = [1] resetup_test_prop_d = prop print('satt') prop = rp.satt(t, x) print(prop, '\n') print('satp') prop = rp.satp(prop['p'], x) print(prop, '\n') print('satd') print(rp.satd(prop['Dliq'], x), '\n') print('sath') print(rp.sath(47000, x, 0), '\n') print('sate') print(rp.sate(0.96047E-13, x), '\n') print('sats') print(rp.sats(50, x, 0), '\n') print('purefld(0)') print(rp.purefld(0), '\n') x = [0.5, 0.3] x = rp.normalize(x)['x'] print('csatk') print(rp.csatk(1, t), '\n') print('dptsatk') print(rp.dptsatk(1, t), '\n') print('cv2pk') print(rp.cv2pk(2, t, D), '\n') print('tprho') print(rp.tprho(t, p, x, 2, 1, 58), '\n') print('flsh, tp') prop = rp.flsh('tp', t, p, x) print(prop, '\n') print('flsh, th') print(rp.flsh('tH', 305, prop['h'], x, 1), '\n') print('flsh, tD') print(rp.flsh('tD', t, 30, x), '\n') print('info()') print(rp.info(), '\n') print('info(2)') print(rp.info(2), '\n') #unsupported in Windows if platform.system() == 'Linux': print('rmix2') print(rp.rmix2(x), '\n') print('xmass') prop = rp.xmass(x) print(prop, '\n') print('xmole') print(rp.xmole(prop['xkg']), '\n') print('limitx') print(rp.limitx(x, 'eos', t, D, p), '\n') print('limitk') print(rp.limitk('eos', 1, t, D, p), '\n') print('limits') print(rp.limits(x), '\n') print('flsh, ts') prop = rp.flsh('ts', t, 40, x) print(prop, '\n') print('flsh, te') print(rp.flsh('te', t, prop['e'], x), '\n') print('flsh, pD') prop = rp.flsh('Pd', p, D, x) print(prop, '\n') print('flsh, ph') prop = rp.flsh('ph', p, prop['h'], x) print(prop, '\n') print('flsh, ps') prop = rp.flsh('ps', p, prop['s'], x) print(prop, '\n') print('flsh, pe') prop = rp.flsh('pE', p, prop['e'], x) print(prop, '\n') print('flsh, es') prop = rp.flsh('es', prop['e'], prop['s'], x) print(prop, '\n') print('flsh, hs') prop = rp.flsh('hs', 40000, 100, x) print(prop, '\n') print('flsh, es') print(rp.flsh('es', 175, 13, x), '\n') print('flsh, Dh') print(rp.flsh('DH', 20, 18000, x), '\n') print('flsh, Ds') prop = rp.flsh('Ds', 20, 50, x) print(prop, '\n') print('flsh, De') prop = rp.flsh('DE', 20, prop['e'], x) print(prop, '\n') print('flsh, tq') prop = rp.flsh('tq', t, prop['q'], x) print(prop, '\n') print('flsh, pq') print(rp.flsh('pq', 1200, prop['q'], x), '\n') prop = rp.flsh('tp', 350, 1200, x) print('flsh, tp') print(prop, '\n') s = prop['s'] e = prop['e'] h = prop['h'] D = prop['D'] t = prop['t'] p = prop['p'] Dmin = 40 Dmax = 55 print('flsh1, liq, ph') print(rp.flsh1('Ph', p, h, x, 1), '\n') print('getphase') print(rp.getphase(prop), '\n') print('flsh1, liq, pD') print(rp.flsh1('PD', p, D, x), '\n') print('flsh1, liq, ps') print(rp.flsh1('Ps', p, s, x), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, th') print(rp.flsh1('th', t, h, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, ts') print(rp.flsh1('ts', t, s, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, te') print(rp.flsh1('te', t, e, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, pe') print(rp.flsh1('Pe', p, e, x), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, hs') print(rp.flsh1('hs', h, s, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, Dh') print(rp.flsh1('Dh', D, h, x), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, Ds') print(rp.flsh1('Ds', D, s, x), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, liq, De') print(rp.flsh1('De', D, e, x), '\n') prop = rp.flsh('tp', 400, 100, x) s = prop['s'] e = prop['e'] h = prop['h'] D = prop['D'] Dmin = 0.01 Dmax = 0.05 t = prop['t'] p = prop['p'] print('flsh1, vap, ph') print(rp.flsh1('Ph', p, h, x, 2), '\n') print('getphase') print(rp.getphase(prop), '\n') print('flsh1, vap, pD') print(rp.flsh1('PD', p, D, x, 2), '\n') print('flsh1, vap, ps') print(rp.flsh1('Ps', p, s, x, 2), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, th') print(rp.flsh1('th', t, h, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, ts') print(rp.flsh1('ts', t, s, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, te') print(rp.flsh1('te', t, e, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, pe') print(rp.flsh1('Pe', p, e, x, 2), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, hs') print(rp.flsh1('hs', h, s, x, Dmin=Dmin, Dmax=Dmax), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, Dh') print(rp.flsh1('Dh', D, h, x), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, Ds') print(rp.flsh1('Ds', D, s, x), '\n') #unsupported in Windows if platform.system() == 'Linux': print('flsh1, vap, De') print(rp.flsh1('De', D, e, x), '\n') print('cstar') print(rp.cstar(t, p, 8, x), '\n') print('fpv') print(rp.fpv(t, D, p, x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('excess') print(rp.excess(t, p, x, kph=2), '\n') prop = rp.flsh('pq', 1200, 0.65, x) D = prop['D'] Dliq = prop['Dliq'] Dvap = prop['Dvap'] xliq = prop['xliq'] xvap = prop['xvap'] e = prop['e'] h = prop['h'] s = prop['s'] q = prop['q'] p = prop['p'] t = prop['t'] #function not supported in Windows if platform.system() == 'Linux': print('tpfl2') print(rp.flsh2('tp', t, p, x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('Dhfl2') print(rp.flsh2('Dh', D, h, x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('Dsfl2') print(rp.flsh2('Ds', D, s, x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('Defl2') print(rp.flsh2('De', D, e, x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('thfl2') print(rp.flsh2('th', t, h, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('tsfl2') print(rp.flsh2('ts', t, s, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('tefl2') print(rp.flsh2('te', t, e, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('tDfl2') print(rp.flsh2('tD', t, D, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('pDfl2') print(rp.flsh2('pD', p, D, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('phfl2') print(rp.flsh2('ph', p, h, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('psfl2') print(rp.flsh2('ps', p, s, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('pefl2') print(rp.flsh2('pe', p, e, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('tqfl2') print(rp.flsh2('tq', t, q, x, ksat=0), '\n') #function not supported in Windows if platform.system() == 'Linux': print('pqfl2') print(rp.flsh2('pq', p, q, x, ksat=0), '\n') #function not supported in Windows #~ if platform.system() == 'Linux': #~ print('Dqfl2') #~ print(rp.flsh2('Dq', D, q, x), '\n') prop = rp.flsh('tp', 340, 100, x) t = prop['t'] Dliq = prop['Dliq'] Dvap = prop['Dvap'] xliq = prop['xliq'] xvap = prop['xvap'] print('qmass') prop = rp.qmass(prop['q'], xliq, xvap) print(prop, '\n') print('qmole') print(rp.qmole(prop['qkg'], prop['xlkg'], prop['xvkg']), '\n') print('wmol') print(rp.wmol(x), '\n') prop = rp.flsh('tp', 340, 100, x) print('dielec') print(rp.dielec(prop['t'], prop['D'], x), '\n') print('surten') print(rp.surten (t, Dliq, Dvap, xliq, xvap), '\n') print('surft') print(rp.surft(240, x), '\n') rp.setup('def', 'water') print('meltt') print(rp.meltt(273.15, [1]), '\n') print('meltp') print(rp.meltp(100, [1]), '\n') print('sublt') print(rp.sublt(273.15, [1]), '\n') print('sublp') print(rp.sublp(0.1, [1]), '\n') rp.setup('def', 'butane', 'ethane', 'propane', 'methane',) x = [0.5, 0.15, 0.3, 0.05] rp.setref('nbp') prop = rp.flsh('tp', 260, 150, x) D = prop['D'] print('trnprp, setref NBP') print(rp.trnprp(260, D, x), '\n') print('B12') print(rp.b12(260, x), '\n') print('chempot') print(rp.chempot(260, D, x), '\n') print('fugcof') print(rp.fugcof(260, D, x), '\n') ##function not supported in Windows #if platform.system() == 'Linux': #print('phiderv') #print(rp.phiderv(2, 1, 260, D, x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('getmod') print(rp.getmod(1, 'EOS'), '\n') rp.setmod('tcx', 'ecs', ['tc2', 'tc1', 'tc2', 'tc2']) rp.setup('def', 'butane', 'ethane', 'propane', 'methane',) x = [0.5, 0.15, 0.3, 0.05] rp.setref('nbp') prop = rp.flsh('tp', 260, 200, x) print('trnprp, setref NBP, setmod [tcx, ecs, tc2, tc1, tc2, tc2]') print(rp.trnprp(260, prop['D'], x), '\n') #function not supported in Windows if platform.system() == 'Linux': print('getmod') print(rp.getmod(3, 'tcx'), '\n') rp.setref('oth', 1, [1], 0, 0, 273, 100) print('setref = OTH') prop = rp.flsh('tp', 260, 200, x) print(prop, '\n') resetup_test_prop_a = prop rp.setref('???', 1, [1], 0, 0, 373, 100) print('setref = ???') prop = rp.flsh('tp', 260, 200, x) print(prop, '\n') resetup_test_prop_b = prop print('name') print(rp.name(1), '\n') rp.setup('def', 'butane', 'ethane', 'propane', 'methane',) x = [0.5, 0.15, 0.3, 0.05] print('getktv') prop = rp.getktv(1, 3) print(prop, '\n') print('setktv') prop = rp.setktv(1, 3, 'lin', prop['fij'], prop['hfmix'],) print(prop, '\n') resetup_test_prop_c = prop print('reset setktv') print(rp.setktv(1, 2, 'rst'), '\n') print('getfij') print(rp.getfij('LIN'), '\n') print('resetup_test_prop, setref, setmod') print(resetup_test_prop_a, '\n') print('resetup') print(rp.resetup(resetup_test_prop_a), '\n') print('resetup_test_prop, setref(???), setmod') print(resetup_test_prop_b, '\n') print('resetup') print(rp.resetup(resetup_test_prop_b), '\n') print('resetup_test_prop, setktv') print(resetup_test_prop_c, '\n') print('resetup') print(rp.resetup(resetup_test_prop_c), '\n') print('resetup_test_prop, purefld') print(resetup_test_prop_d, '\n') print('resetup') print(rp.resetup(resetup_test_prop_d), '\n') #normalize([0.2, 0.2, 0.1, 0.1]) print('normalize') print(rp.normalize([0.2, 0.2, 0.1, 0.1]), '\n') #setup_details print('setup_details') print(rp.setup_details({'hfld': ['BUTANE', 'ETHANE', 'PROPANE', 'METHANE'], 'D': 0.21683907260570098, 'Dvap': 0.09664613429889905, 'hfmix': 'HMX.BNC', 'setmod': {'hcomp': ['TC2', 'TC1', 'TC2', 'TC2'], 'htype': 'TCX', 'hmix': 'ECS'}, 'cp': -9999980.0, 'xliq': [Decimal('0.7125650648765283717349528049'), Decimal('0.04065955068790887177072495080'), Decimal('0.2449672538076863186375885862'), Decimal('0.001808130627876437856733658079')], 'xvap': [Decimal('0.2304027911956556081031262882'), Decimal('0.2886769748808782463382744488'), Decimal('0.3697982730402927396744896960'), Decimal('0.1111219608831734058841095670')], 'x': [0.5, 0.15, 0.3, 0.05], 'e': -13828.39837781548, 'h': -12906.055381248256, 'nc': 4, 'Dliq': 11.150114864150222, 'cv': -9999980.0, 'q': 0.4408579356823604, 'p': 200.0, 's': -44.047682476988044, 't': 260.0, 'w': -9999980.0, 'kph': 1, 'setref': {'p0': 100, 'ixflag': 1, 'h0': 0, 's0': 0, 't0': 273, 'hrf': ['OTH', '???']}, 'hrf': 'DEF'}), '\n') #gerg04 print('gerg04 = 1') rp.gerg04(1) print(rp.setup('def', 'butane', 'ethane', 'propane'), '\n') #reset gerg04 print('gerg04 = 0') rp.gerg04(0) print(rp.setup('def', 'butane', 'ethane', 'propane'), '\n') #preos print('preos = 2') print(rp.preos(2), '\n') print('preos = -1') print(rp.preos(-1), '\n') print('preos = 0') print(rp.preos(0), '\n') print('preos = -1') print(rp.preos(-1), '\n') #setaga print('setaga') print(rp.setaga(), '\n') #unsetaga print('unsetaga') print(rp.unsetaga(), '\n') #setup_settings print('setup_setting') print(rp.setup_setting(), '\n')
def _rpfunc(): return refprop.limitx(x, htype, t, D, p)
def calculatePlot(self, fluid): """Calculate data for plot fluid: class of meos fluid to calculate""" data = {} points = get_points(config.Preferences) method = getMethod() # Melting and sublimation line only supported in internal meos method if method == "meos": # Calculate melting line if fluid._melting: self.parent().statusbar.showMessage( QtWidgets.QApplication.translate( "pychemqt", "Calculating melting line...")) T = linspace(fluid._melting["Tmin"], fluid._melting["Tmax"], points) fluidos = [] for Ti in T: P = fluid._Melting_Pressure(Ti) fluido = calcPoint(fluid, self.config, T=Ti, P=P) if fluido: fluidos.append(fluido) self.parent().progressBar.setValue(5*len(fluidos)/len(T)) QtWidgets.QApplication.processEvents() if fluidos: data["melting"] = saveProperties(fluidos) # Calculate sublimation line if fluid._sublimation: self.parent().statusbar.showMessage( QtWidgets.QApplication.translate( "pychemqt", "Calculating sublimation line...")) T = linspace(fluid._sublimation["Tmin"], fluid._sublimation["Tmax"], points) fluidos = [] for Ti in T: P = fluid._Sublimation_Pressure(Ti) fluido = calcPoint(fluid, self.config, T=Ti, P=P) if fluido: fluidos.append(fluido) self.parent().progressBar.setValue(5+5*len(fluidos)/len(T)) QtWidgets.QApplication.processEvents() if fluidos: data["sublimation"] = saveProperties(fluidos) # Define the saturation temperature T = list(concatenate([linspace(fluid.Tt, 0.9*fluid.Tc, points), linspace(0.9*fluid.Tc, 0.99*fluid.Tc, points), linspace(0.99*fluid.Tc, fluid.Tc, points)])) for i in range(2, 0, -1): del T[points*i] # Calculate saturation self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating Liquid-Vapour saturation line...")) for fase in [0, 1]: fluidos = [] for Ti in T: print("x = %i" % fase, Ti) try: fluidos.append(fluid._new(T=Ti, x=fase)) except: pass self.parent().progressBar.setValue( 10+5*fase+5*len(fluidos)/len(T)) QtWidgets.QApplication.processEvents() data["saturation_%i" % fase] = saveProperties(fluidos) # Calculate isoquality lines data["x"] = {} self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating isoquality lines...")) values = self.LineList("Isoquality", config.Preferences) for i, value in enumerate(values): fluidos = calcIsoline(fluid, self.config, "T", "x", T, value, 20, i, 20, len(values), self.parent().progressBar) data["x"][value] = saveProperties(fluidos) # Get limit equation if method == "meos": eq = fluid.eq[self.parent().currentConfig.getint("MEoS", "eq")] Tmin = eq["Tmin"] Tmax = eq["Tmax"] Tt = eq.get("Tt", fluid.Tt) if Tmin > Tt: Lt = fluid._new(T=Tmin, x=0) else: Lt = fluid._new(T=Tt, x=0) Pmin = Lt.P Pmax = eq["Pmax"]*1000 elif method == "coolprop": Tmin = fluid.eq["Tmin"] Tmax = fluid.eq["Tmax"] Pmin = fluid.eq["Pmin"] Pmax = fluid.eq["Pmax"] elif method == "refprop": import refprop refprop.setup("def", fluid.name) limit = refprop.limitx([1], t=-1) Tmin = limit["tmin"] try: Pmin = fluid(T=fluid.Tt, x=1).P except: Pmin = 100 Tmax = limit["tmax"] Pmax = limit["pmax"]*1000 T = list(concatenate( [linspace(Tmin, 0.9*fluid.Tc, points), linspace(0.9*fluid.Tc, 0.99*fluid.Tc, points), linspace(0.99*fluid.Tc, fluid.Tc, points), linspace(fluid.Tc, 1.01*fluid.Tc, points), linspace(1.01*fluid.Tc, 1.1*fluid.Tc, points), linspace(1.1*fluid.Tc, Tmax, points)])) P = list(concatenate( [logspace(log10(Pmin), log10(0.9*fluid.Pc), points), linspace(0.9*fluid.Pc, 0.99*fluid.Pc, points), linspace(0.99*fluid.Pc, fluid.Pc, points), linspace(fluid.Pc, 1.01*fluid.Pc, points), linspace(1.01*fluid.Pc, 1.1*fluid.Pc, points), logspace(log10(1.1*fluid.Pc), log10(Pmax), points)])) for i in range(5, 0, -1): del T[points*i] del P[points*i] # Calculate isotherm lines data["T"] = {} self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating isotherm lines...")) values = self.LineList("Isotherm", config.Preferences, fluid) for i, value in enumerate(values): fluidos = calcIsoline(fluid, self.config, "P", "T", P, value, 40, i, 10, len(values), self.parent().progressBar) data["T"][value] = saveProperties(fluidos) # Calculate isobar lines data["P"] = {} self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating isobar lines...")) values = self.LineList("Isobar", config.Preferences, fluid) for i, value in enumerate(values): fluidos = calcIsoline(fluid, self.config, "T", "P", T, value, 50, i, 10, len(values), self.parent().progressBar) data["P"][value] = saveProperties(fluidos) # Calculate isochor lines data["v"] = {} self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating isochor lines...")) values = self.LineList("Isochor", config.Preferences, fluid) for i, value in enumerate(values): fluidos = calcIsoline(fluid, self.config, "T", "v", T, value, 60, i, 10, len(values), self.parent().progressBar) data["v"][value] = saveProperties(fluidos) # Calculate isoenthalpic lines data["h"] = {} self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating isoenthalpic lines...")) vals = self.LineList("Isoenthalpic", config.Preferences, fluid) for i, value in enumerate(vals): fluidos = calcIsoline(fluid, self.config, "P", "h", P, value, 70, i, 10, len(values), self.parent().progressBar) data["h"][value] = saveProperties(fluidos) # Calculate isoentropic lines data["s"] = {} self.parent().statusbar.showMessage(QtWidgets.QApplication.translate( "pychemqt", "Calculating isoentropic lines...")) values = self.LineList("Isoentropic", config.Preferences, fluid) for i, value in enumerate(values): fluidos = calcIsoline(fluid, self.config, "P", "s", P, value, 80, i, 20, len(values), self.parent().progressBar) data["s"][value] = saveProperties(fluidos) return data
def _maintest(rp): # examples and test setup rp.SetErrorDebug.off() # turn on =>> for testing purpose if rp.test(): # if True; rptest =>>for testing purpose print u"refprop installed correctely" print u"test results" print rp.testresult print u"fluidlib" rp.fluidlib() print u"\n" prop = rp.setup(u"def", u"air") print u"setup air" print prop, u"\n" x = prop[u"x"] print u"critp(x)" print rp.critp(x), u"\n" print u"setup water ammonia" print rp.setup(u"def", u"water", u"ammonia"), u"\n" # alternative setup input rp.setup(u"def", [u"water", u"ammonia"]) x = [0.5, 0.3] prop = rp.normalize(x) x = prop[u"x"] prop = rp.critp(x) prop = rp.therm(prop[u"tcrit"], prop[u"Dcrit"], x) print u"therm" print prop, u"\n" p = prop[u"p"] print u"therm2" print rp.therm2(prop[u"t"], prop[u"D"], x), u"\n" print u"therm0" print rp.therm0(prop[u"t"], prop[u"D"], x), u"\n" print u"residual" print rp.residual(prop[u"t"], prop[u"D"], x), u"\n" print u"entro" print rp.entro(prop[u"t"], prop[u"D"], x), u"\n" print u"enthal" print rp.enthal(prop[u"t"], prop[u"D"], x), u"\n" print u"ag" print rp.ag(prop[u"t"], prop[u"D"], x), u"\n" print u"cvcp" print rp.cvcp(prop[u"t"], prop[u"D"], x), u"\n" print u"dddp" print rp.dddp(prop[u"t"], prop[u"D"], x), u"\n" print u"dddt" print rp.dddt(prop[u"t"], prop[u"D"], x), u"\n" print u"dhd1" print rp.dhd1(prop[u"t"], prop[u"D"], x), u"\n" print u"dpdd" print rp.dpdd(prop[u"t"], prop[u"D"], x), u"\n" print u"dpdd2" print rp.dpdd2(prop[u"t"], prop[u"D"], x), u"\n" print u"dpdt" print rp.dpdt(prop[u"t"], prop[u"D"], x), u"\n" D = prop[u"D"] # function not supported in Windows if platform.system() == u"Linux": print u"dcdt" print rp.dcdt(prop[u"t"], x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"dcdt2" print rp.dcdt2(prop[u"t"], x), u"\n" print u"fgcty" print rp.fgcty(prop[u"t"], D, x), u"\n" print u"gibbs" print rp.gibbs(prop[u"t"], prop[u"D"], x), u"\n" # ~ print('fgcty2') # ~ print(rp.fgcty2(prop['t'], prop['D'], x), '\n') prop = rp.therm3(prop[u"t"], prop[u"D"], x) print u"therm3" print prop, u"\n" D = prop[u"D"] print u"virb" print rp.virb(prop[u"t"], x), u"\n" print u"virc" print rp.virc(prop[u"t"], x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"vird" print rp.vird(prop[u"t"], x), u"\n" print u"virba" print rp.virba(prop[u"t"], x), u"\n" print u"virca" print rp.virca(prop[u"t"], x), u"\n" print u"cvcpk" print rp.cvcpk(1, prop[u"t"], D), u"\n" print u"dbdt" print rp.dbdt(prop[u"t"], x), u"\n" print u"dpddk" print rp.dpddk(1, prop[u"t"], D), u"\n" print u"dpdtk" print rp.dpdtk(2, prop[u"t"], D), u"\n" D = 55 t = 373 prop = rp.press(t, D, x) print u"press" print prop, u"\n" p = prop[u"p"] print u"purefld(1)" prop = rp.purefld(1) print prop, u"\n" x = [1] resetup_test_prop_d = prop print u"satt" prop = rp.satt(t, x) print prop, u"\n" print u"satp" prop = rp.satp(prop[u"p"], x) print prop, u"\n" print u"satd" print rp.satd(prop[u"Dliq"], x), u"\n" print u"sath" print rp.sath(47000, x, 0), u"\n" print u"sate" print rp.sate(0.46047e-13, x), u"\n" print u"sats" print rp.sats(50, x, 0), u"\n" print u"purefld(0)" print rp.purefld(0), u"\n" x = [0.5, 0.3] x = rp.normalize(x)[u"x"] print u"csatk" print rp.csatk(1, t), u"\n" print u"dptsatk" print rp.dptsatk(1, t), u"\n" print u"cv2pk" print rp.cv2pk(2, t, D), u"\n" print u"tprho" print rp.tprho(t, p, x, 2, 1, 58), u"\n" print u"flsh, tp" prop = rp.flsh(u"tp", t, p, x) print prop, u"\n" print u"flsh, th" print rp.flsh(u"tH", 305, prop[u"h"], x, 1), u"\n" print u"flsh, tD" print rp.flsh(u"tD", t, 30, x), u"\n" print u"info()" print rp.info(), u"\n" print u"info(2)" print rp.info(2), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"rmix2" print rp.rmix2(x), u"\n" print u"xmass" prop = rp.xmass(x) print prop, u"\n" print u"xmole" print rp.xmole(prop[u"xkg"]), u"\n" print u"limitx" print rp.limitx(x, u"eos", t, D, p), u"\n" print u"limitk" print rp.limitk(u"eos", 1, t, D, p), u"\n" print u"limits" print rp.limits(x), u"\n" print u"flsh, ts" prop = rp.flsh(u"ts", t, 40, x) print prop, u"\n" print u"flsh, te" print rp.flsh(u"te", t, prop[u"e"], x), u"\n" print u"flsh, pD" prop = rp.flsh(u"Pd", p, D, x) print prop, u"\n" print u"flsh, ph" prop = rp.flsh(u"ph", p, prop[u"h"], x) print prop, u"\n" print u"flsh, ps" prop = rp.flsh(u"ps", p, prop[u"s"], x) print prop, u"\n" print u"flsh, pe" prop = rp.flsh(u"pE", p, prop[u"e"], x) print prop, u"\n" print u"flsh, es" prop = rp.flsh(u"es", prop[u"e"], prop[u"s"], x) print prop, u"\n" print u"flsh, hs" prop = rp.flsh(u"hs", 40000, 100, x) print prop, u"\n" print u"flsh, es" print rp.flsh(u"es", 175, 13, x), u"\n" print u"flsh, Dh" print rp.flsh(u"DH", 20, 18000, x), u"\n" print u"flsh, Ds" prop = rp.flsh(u"Ds", 20, 50, x) print prop, u"\n" print u"flsh, De" prop = rp.flsh(u"DE", 20, prop[u"e"], x) print prop, u"\n" print u"flsh, tq" prop = rp.flsh(u"tq", t, prop[u"q"], x) print prop, u"\n" print u"flsh, pq" print rp.flsh(u"pq", 1200, prop[u"q"], x), u"\n" prop = rp.flsh(u"tp", 350, 1200, x) print u"flsh, tp" print prop, u"\n" s = prop[u"s"] e = prop[u"e"] h = prop[u"h"] D = prop[u"D"] t = prop[u"t"] p = prop[u"p"] Dmin = 40 Dmax = 55 print u"flsh1, liq, ph" print rp.flsh1(u"Ph", p, h, x, 1), u"\n" print u"getphase" print rp.getphase(prop), u"\n" print u"flsh1, liq, pD" print rp.flsh1(u"PD", p, D, x), u"\n" print u"flsh1, liq, ps" print rp.flsh1(u"Ps", p, s, x), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, th" print rp.flsh1(u"th", t, h, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, ts" print rp.flsh1(u"ts", t, s, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, te" print rp.flsh1(u"te", t, e, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, pe" print rp.flsh1(u"Pe", p, e, x), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, hs" print rp.flsh1(u"hs", h, s, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, Dh" print rp.flsh1(u"Dh", D, h, x), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, Ds" print rp.flsh1(u"Ds", D, s, x), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, liq, De" print rp.flsh1(u"De", D, e, x), u"\n" prop = rp.flsh(u"tp", 400, 100, x) s = prop[u"s"] e = prop[u"e"] h = prop[u"h"] D = prop[u"D"] Dmin = 0.01 Dmax = 0.05 t = prop[u"t"] p = prop[u"p"] print u"flsh1, vap, ph" print rp.flsh1(u"Ph", p, h, x, 2), u"\n" print u"getphase" print rp.getphase(prop), u"\n" print u"flsh1, vap, pD" print rp.flsh1(u"PD", p, D, x, 2), u"\n" print u"flsh1, vap, ps" print rp.flsh1(u"Ps", p, s, x, 2), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, th" print rp.flsh1(u"th", t, h, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, ts" print rp.flsh1(u"ts", t, s, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, te" print rp.flsh1(u"te", t, e, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, pe" print rp.flsh1(u"Pe", p, e, x, 2), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, hs" print rp.flsh1(u"hs", h, s, x, Dmin=Dmin, Dmax=Dmax), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, Dh" print rp.flsh1(u"Dh", D, h, x), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, Ds" print rp.flsh1(u"Ds", D, s, x), u"\n" # unsupported in Windows if platform.system() == u"Linux": print u"flsh1, vap, De" print rp.flsh1(u"De", D, e, x), u"\n" print u"cstar" print rp.cstar(t, p, 8, x), u"\n" print u"fpv" print rp.fpv(t, D, p, x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"excess" print rp.excess(t, p, x, kph=2), u"\n" prop = rp.flsh(u"pq", 1200, 0.65, x) D = prop[u"D"] Dliq = prop[u"Dliq"] Dvap = prop[u"Dvap"] xliq = prop[u"xliq"] xvap = prop[u"xvap"] e = prop[u"e"] h = prop[u"h"] s = prop[u"s"] q = prop[u"q"] p = prop[u"p"] t = prop[u"t"] # function not supported in Windows if platform.system() == u"Linux": print u"tpfl2" print rp.flsh2(u"tp", t, p, x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"Dhfl2" print rp.flsh2(u"Dh", D, h, x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"Dsfl2" print rp.flsh2(u"Ds", D, s, x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"Defl2" print rp.flsh2(u"De", D, e, x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"thfl2" print rp.flsh2(u"th", t, h, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"tsfl2" print rp.flsh2(u"ts", t, s, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"tefl2" print rp.flsh2(u"te", t, e, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"tDfl2" print rp.flsh2(u"tD", t, D, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"pDfl2" print rp.flsh2(u"pD", p, D, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"phfl2" print rp.flsh2(u"ph", p, h, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"psfl2" print rp.flsh2(u"ps", p, s, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"pefl2" print rp.flsh2(u"pe", p, e, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"tqfl2" print rp.flsh2(u"tq", t, q, x, ksat=0), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"pqfl2" print rp.flsh2(u"pq", p, q, x, ksat=0), u"\n" # function not supported in Windows # ~ if platform.system() == 'Linux': # ~ print('Dqfl2') # ~ print(rp.flsh2('Dq', D, q, x), '\n') prop = rp.flsh(u"tp", 340, 100, x) t = prop[u"t"] Dliq = prop[u"Dliq"] Dvap = prop[u"Dvap"] xliq = prop[u"xliq"] xvap = prop[u"xvap"] print u"qmass" prop = rp.qmass(prop[u"q"], xliq, xvap) print prop, u"\n" print u"qmole" print rp.qmole(prop[u"qkg"], prop[u"xlkg"], prop[u"xvkg"]), u"\n" print u"wmol" print rp.wmol(x), u"\n" prop = rp.flsh(u"tp", 340, 100, x) print u"dielec" print rp.dielec(prop[u"t"], prop[u"D"], x), u"\n" print u"surten" print rp.surten(t, Dliq, Dvap, xliq, xvap), u"\n" print u"surft" print rp.surft(240, x), u"\n" rp.setup(u"def", u"water") print u"meltt" print rp.meltt(273.15, [1]), u"\n" print u"meltp" print rp.meltp(100, [1]), u"\n" print u"sublt" print rp.sublt(273.15, [1]), u"\n" print u"sublp" print rp.sublp(0.1, [1]), u"\n" rp.setup(u"def", u"butane", u"ethane", u"propane", u"methane") x = [0.5, 0.15, 0.3, 0.05] rp.setref(u"nbp") prop = rp.flsh(u"tp", 260, 150, x) D = prop[u"D"] print u"trnprp, setref" print rp.trnprp(260, D, x), u"\n" print u"B12" print rp.b12(260, x), u"\n" print u"chempot" print rp.chempot(260, D, x), u"\n" print u"fugcof" print rp.fugcof(260, D, x), u"\n" ###function not supported in Windows # if platform.system() == 'Linux': input values changed.............................. # print('phiderv') # print(rp.phiderv(2, 1, 260, D, x), '\n') # function not supported in Windows if platform.system() == u"Linux": print u"getmod" print rp.getmod(1, u"EOS"), u"\n" rp.setmod(u"tcx", u"ecs", [u"tc2", u"tc1", u"tc2", u"tc2"]) rp.setup(u"def", u"butane", u"ethane", u"propane", u"methane") x = [0.5, 0.15, 0.3, 0.05] prop = rp.flsh(u"tp", 260, 200, x) print u"trnprp, setref NBP, setmod [tcx, ecs, tc2, tc1, tc2, tc2]" print rp.trnprp(260, prop[u"D"], x), u"\n" # function not supported in Windows if platform.system() == u"Linux": print u"getmod" print rp.getmod(3, u"tcx"), u"\n" rp.setref(u"oth", 1, [1], 0, 0, 273, 100) print u"setref = OTH" prop = rp.flsh(u"tp", 260, 200, x) print prop, u"\n" resetup_test_prop_a = prop rp.setref(u"???", 1, [1], 0, 0, 373, 100) print u"setref = ???" prop = rp.flsh(u"tp", 260, 200, x) print prop, u"\n" resetup_test_prop_b = prop print u"name" print rp.name(1), u"\n" rp.setup(u"def", u"butane", u"ethane", u"propane", u"methane") x = [0.5, 0.15, 0.3, 0.05] print u"getktv" prop = rp.getktv(1, 3) print prop, u"\n" print u"setktv" prop = rp.setktv(1, 3, u"lin", prop[u"fij"], prop[u"hfmix"]) print prop, u"\n" resetup_test_prop_c = prop print u"reset setktv" print rp.setktv(1, 2, u"rst"), u"\n" print u"getfij" print rp.getfij(u"LIN"), u"\n" print u"resetup_test_prop, setref, setmod" print resetup_test_prop_a, u"\n" print u"resetup" print rp.resetup(resetup_test_prop_a), u"\n" print u"resetup_test_prop, setref(???), setmod" print resetup_test_prop_b, u"\n" print u"resetup" print rp.resetup(resetup_test_prop_b), u"\n" print u"resetup_test_prop, setktv" print resetup_test_prop_c, u"\n" print u"resetup" print rp.resetup(resetup_test_prop_c), u"\n" print u"resetup_test_prop, purefld" print resetup_test_prop_d, u"\n" print u"resetup" print rp.resetup(resetup_test_prop_d), u"\n" # normalize([0.2, 0.2, 0.1, 0.1]) print u"normalize" print rp.normalize([0.2, 0.2, 0.1, 0.1]), u"\n" # setup_details print u"setup_details" print rp.setup_details( { u"hfld": [u"BUTANE", u"ETHANE", u"PROPANE", u"METHANE"], u"D": 0.21683907260570098, u"Dvap": 0.09664613429889905, u"hfmix": u"HMX.BNC", u"setmod": {u"hcomp": [u"TC2", u"TC1", u"TC2", u"TC2"], u"htype": u"TCX", u"hmix": u"ECS"}, u"cp": -9999980.0, u"xliq": [ Decimal(u"0.7125650648765283717349528049"), Decimal(u"0.04065955068790887177072495080"), Decimal(u"0.2449672538076863186375885862"), Decimal(u"0.001808130627876437856733658079"), ], u"xvap": [ Decimal(u"0.2304027911956556081031262882"), Decimal(u"0.2886769748808782463382744488"), Decimal(u"0.3697982730402927396744896960"), Decimal(u"0.1111219608831734058841095670"), ], u"x": [0.5, 0.15, 0.3, 0.05], u"e": -13828.39837781548, u"h": -12906.055381248256, u"nc": 4, u"Dliq": 11.150114864150222, u"cv": -9999980.0, u"q": 0.4408579356823604, u"p": 200.0, u"s": -44.047682476988044, u"t": 260.0, u"w": -9999980.0, u"kph": 1, u"setref": {u"p0": 100, u"ixflag": 1, u"h0": 0, u"s0": 0, u"t0": 273, u"hrf": [u"OTH", u"???"]}, u"hrf": u"DEF", } ), u"\n" # gerg04 print u"gerg04 = 1" rp.gerg04(1) print rp.setup(u"def", u"butane", u"ethane", u"propane"), u"\n" # reset gerg04 print u"gerg04 = 0" rp.gerg04(0) print rp.setup(u"def", u"butane", u"ethane", u"propane"), u"\n" # preos print u"preos = 2" print rp.preos(2), u"\n" print u"preos = -1" print rp.preos(-1), u"\n" print u"preos = 0" print rp.preos(0), u"\n" print u"preos = -1" print rp.preos(-1), u"\n" # setaga print u"setaga" print rp.setaga(), u"\n" # unsetaga print u"unsetaga" print rp.unsetaga(), u"\n" # setup_settings print u"setup_setting" print rp.setup_setting(), u"\n"