def f3(cmpName, N, UAe, sigma, Te, Tk, DTsub, Tf): #蒸发器负荷 cmp3 = compressor(cmpName) Ts = Tsuct(Te, Tk, DTsub, sigma) cy3 = refCycle(cmp3.refType, Ts, Te, Tk, Tk - DTsub) Qe1 = UAe * (Tf - Te) Qe2 = cmp3.mf(N, Te, Tk, Ts) * cy3.qe() return Qe2 - Qe1
def f2(cmpName, N, UAcmp, sigma, Tamb, Te, Tk, DTsub, Td): #压缩机壳体负荷 cmp2 = compressor(cmpName) Ts = Tsuct(Te, Tk, DTsub, sigma) cy2 = refCycle(cmp2.refType, Ts, Te, Tk, Tk - DTsub) Qc1 = UAcmp * (Td - Tamb) Qc2 = cmp2.mf(N, Te, Tk, Ts) * (cy2.wc() / cmp2.isoEff(Te, Tk, N) - cy2.h2_1(Td)) return Qc2 - Qc1
def f1(cmpName, N, UAk, sigma, Tamb, Te, Tk, DTsub, Td): #注意函数定义时,变量排布顺序的一致性 f1:冷凝器负荷 cmp1 = compressor(cmpName) Ts = Tsuct(Te, Tk, DTsub, sigma) cy = refCycle(cmp1.refType, Ts, Te, Tk, Tk - DTsub) Qk1 = UAk * (Tk - Tamb) Qk2 = cmp1.mf(N, Te, Tk, Ts) * cy.qk(Td) return Qk2 - Qk1
# -*- coding: UTF-8 -*- from Compressor import compressor from RefCycle import refCycle import CoolProp.CoolProp as CP cmp1 = compressor("VNX1116Y") print cmp1.pistVol print cmp1.volEff(-23.3, 54.4, 1500) print cmp1.isoEff(-23.3, 54.4, 1500) cy1 = refCycle("R600a", 32.2, -23.3, 54.4, 32.2) print cy1.cycleCOP()
from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D ref = "R600a" subcoolDegree = 2 suctionTemp = 32 condTemp = np.linspace(35, 45, 11) evapTemp = np.linspace(-30, -20, 11) COP = np.zeros(11 * 11).reshape(11, 11) Wc = np.zeros(11 * 11).reshape(11, 11) fig = plt.figure(figsize=(11, 7), dpi=100) ax = fig.gca(projection='3d') X, Y = np.meshgrid(condTemp, evapTemp) for i in range(len(X)): for j in range(len(Y)): COP[i, j] = refCycle(ref, suctionTemp, Y[i, j], X[i, j], X[i, j] - subcoolDegree).cycleCOP() Wc[i, j] = refCycle(ref, suctionTemp, Y[i, j], X[i, j], X[i, j] - subcoolDegree).wc() ax.plot_surface(X, Y, COP[:], cmap=cm.viridis, rstride=1, cstride=1) #ax.plot_surface(X, Y, Wc[:], cmap=cm.viridis, rstride=1, cstride=1) ax.set_xlabel('$Condensing Temperature$') ax.set_ylabel('$Evaporating Temperature$') plt.show() qex = refCycle(ref, suctionTemp, evapTemp, 40, 40 - subcoolDegree).cycleCOP() print(qex) plt.plot(evapTemp, qex) plt.show()
model = "VTH1113YA" N = 1800 # rpm cmp1 = compressor(model) ref = "R600a" subcoolDegree = 1.5 condTemp = np.linspace(35, 45, 3) evapTemp = np.linspace(-30, -10, 21) Eihx = 0.85 q = np.zeros(3 * 21).reshape(3, 21) Pel = np.zeros(3 * 21).reshape(3, 21) COP_sys = np.zeros(3 * 21).reshape(3, 21) MassFlow = np.zeros(3 * 21).reshape(3, 21) for i in range(len(condTemp)): for j in range(len(evapTemp)): Tsuct = suctionTemp(condTemp[i], evapTemp[j], subcoolDegree, Eihx) rf = refCycle(ref, Tsuct, evapTemp[j], condTemp[i], condTemp[i] - subcoolDegree) q[i, j] = cmp1.mf(N, evapTemp[j], condTemp[i], Tsuct) * rf.qe() Pel[i, j] = cmp1.mf(N, evapTemp[j], condTemp[i], Tsuct) * rf.wc() / cmp1.isoEff( evapTemp[j], condTemp[i], N) COP_sys[i, j] = rf.cycleCOP() * cmp1.isoEff(evapTemp[j], condTemp[i], N) MassFlow[i, j] = cmp1.mf(N, evapTemp[j], condTemp[i], Tsuct) plt.figure(figsize=(10, 5)) plt.plot(evapTemp, q[0, :], label="Condensing Temp. =35℃", linestyle='dashdot', marker="v", color="red")
while (abs( f1(cmpName,N,UAk,sigma,Tamb,Te,Tk,DTsub,Td)) < ep and abs(f2(cmpName,N,UAcmp,sigma,Tamb,Te,Tk,DTsub,Td))<ep \ and abs(f3(cmpName,N,UAe,sigma,Te,Tk,DTsub,Tf))<ep )== False : y = np.matrix([[f1(cmpName, N, UAk, sigma, Tamb, Te, Tk, DTsub, Td)], [f2(cmpName, N, UAcmp, sigma, Tamb, Te, Tk, DTsub, Td)], [f3(cmpName, N, UAe, sigma, Te, Tk, DTsub, Tf)]]) Jac = np.matrix([[f1dTK(cmpName,N,UAk,sigma,Tamb,Te,Tk,DTsub,Td),f1dTd(cmpName,N,UAk,sigma,Tamb,Te,Tk,DTsub,Td),\ f1dTe(cmpName,N,UAk,sigma,Tamb,Te,Tk,DTsub,Td)],[f2dTk(cmpName,N,UAcmp,sigma,Tamb,Te,Tk,DTsub,Td),\ f2dTd(cmpName,N,UAcmp,sigma,Tamb,Te,Tk,DTsub,Td), f2dTe(cmpName,N,UAcmp,sigma,Tamb,Te,Tk,DTsub,Td)],\ [f3dTk(cmpName,N,UAe,sigma,Te,Tk,DTsub,Tf),f3dTd(cmpName,N,UAe,sigma,Te,Tk,DTsub,Tf),f3dTe(cmpName,N,UAe,sigma,Te,Tk,DTsub,Tf)]]) U = U - Jac**(-1) * y Tk, Td, Te = U[0, 0], U[1, 0], U[2, 0] # main code end # data analysis Ts = Tsuct(Te, Tk, DTsub, sigma) print "Tk=", Tk, "Td=", Td, "Te=", Te, "Ts=", Ts comp = compressor(cmpName) cyFinal = refCycle(comp.refType, Ts, Te, Tk, DTsub) inputPower = comp.mf(N, Te, Tk, Ts) * cyFinal.wc() / comp.isoEff(Te, Tk, N) print inputPower Qe = UAe * (Tf - Te) Qk = UAk * (Tk - Tamb) Qcmp = UAcmp * (Td - Tamb) print Qe, Qk, Qcmp Qcab = UAcab * (Tamb - Tf) print "Cabinet load is", Qcab, "W" R = Qcab / Qe print "compressor Running ratio is:", R
from mpl_toolkits.mplot3d import Axes3D def suctionTemp(Tk, Te, Tsub, eihx): return eihx * (Tk - Tsub - Te) + Te #定义系统循环: ref = "R600a" subcoolDegree = 1.5 condTemp = np.linspace(35, 45, 3) evapTemp = np.linspace(-30, -10, 21) Eihx = 0.85 rf1 = refCycle(ref, 32, evapTemp, condTemp, condTemp - subcoolDegree) rf2 = refCycle(ref, 27, evapTemp, condTemp, condTemp - subcoolDegree) rf3 = refCycle(ref, 22, evapTemp, condTemp, condTemp - subcoolDegree) density1 = rf1.denSuction() density2 = rf2.denSuction() density3 = rf3.denSuction() plt.figure(figsize=(10, 5)) plt.plot(evapTemp, density1, label="Suction Temp. =32℃", linestyle='dashdot', marker="v", color="red") plt.plot(evapTemp, density2, label="Suction Temp. = 27℃",