"Ideal Vapor-Compression Cycle" T_evap = 5 T_cond = 40 "Point 1: evaporator outlet (saturated vapor)" x[1] = 1 T[1] = T_evap P[1] = pressure(R134a, T = T[1], x = x[1]) h[1] = enthalpy(R134a, T = T[1], x = x[1]) s[1] = entropy(R134a, T = T[1], x = x[1]) "Point 2: compressor outlet (isentropic compression)" s[2] = s[1] T[2] = T_cond P[2] = pressure(R134a, T = T_cond, s = s[2]) h[2] = enthalpy(R134a, T = T_cond, s = s[2]) "Point 3: condenser outlet (saturated liquid)" x[3] = 0 P[3] = P[2] h[3] = enthalpy(R134a, T = T_cond, x = x[3]) s[3] = entropy(R134a, T = T_cond, x = x[3]) T[3] = temperature(R134a, P = P[3], x = x[3]) "Point 4: expansion valve outlet (isenthalpic expansion)" P[4] = P[1] h[4] = h[3] s[4] = entropy(R134a, P = P[4], h = h[4]) x[4] = quality(R134a, P = P[4], h = h[4]) T[4] = temperature(R134a, P = P[4], h = h[4]) "Cycle performance" Q_evap = h[1] - h[4] W_comp = h[2] - h[1] COP = Q_evap/W_comp