<jupyter_start><jupyter_text>Example 11.1: Ideal Refrigeration*<NAME>, Ph.D., P.E.University of Kentucky - Paducah CampusME 321: Engineering Thermodynamics II*  Problem StatementR-134a flows through a vapor-compression refrigeration cycle.  Heat is removed at a rate of 18 kW from a freezer at $-8^\circ\mathrm{C}$.  Heat is rejected to a room at $22^\circ\mathrm{C}$.  The evaporator and the condenser are $10^\circ\mathrm{C}$ colder or hotter than the thermal reservoirs. Find:* (a) $p_\mathrm{evap}$ and $p_\mathrm{cond}$ (kPa)* (b) $COP_R$* (c) Net Work* (d) Volumetric flow rate entering the compressor![image.png](attachment:e047931f-9241-45a0-ba9d-e5e372395e5d.png)  Solution__[Video Explanation](https://uky.yuja.com/V/Video?v=2005363&node=7667507&a=185761075&autoplay=1)__  Python InitializationWe'll start by importing the libraries we will use for our analysis and initializing dictionaries to hold the properties we will be usings.<jupyter_code>from kilojoule.templates.default import *
r134a = realfluid.Properties('R134a')<jupyter_output><empty_output><jupyter_text>Given ParametersWe now define variables to hold our known values.<jupyter_code>Qdot_in = Quantity(18,'kW')         # Rate of heat input
T_L = Quantity(-8,'degC')           # Temperature of refrigerated space
T_H = Quantity(22,'degC')           # Temperature of surroundings
Delta_T = Quantity(10,'delta_degC') # Temperature difference in evaporator and condenser

Summary();<jupyter_output><empty_output><jupyter_text>Assumptions- Ideal work devices- Saturated vapor at evaporator exit- Saturated liquid at condenser exit- Isobaric heat exchangers- Negligible changes in kinetic energy- Negligible changes in potential energy<jupyter_code>x[1] = 1      # Saturated vapor at evaporator exit
x[3] = 0      # Saturated liquid at condenser exit

Summary();<jupyter_output><empty_output><jupyter_text>(a) Pressures in condenser and evaporator<jupyter_code>%%showcalc
#### Evaporator pressure
# The working fluid temperature must be lower than the refrigerated space
T[1] = T_L - Delta_T
# The fluid is saturated, so the saturation pressure must be consistent with the saturation temperature
p[1] = r134a.p(T[1],x[1])

#### Condenser pressure
# The working fluid temperature must be hotter than the surroundings
T[3] = T_H + Delta_T
# The fluid is saturated, so the saturation pressure must be consistent with the saturation temperature
p[3] = r134a.p(T[3],x[3])<jupyter_output><empty_output><jupyter_text>(b) $COP_R$<jupyter_code>%%showcalc
#### 1st Law Analysis
##### State 1
h[1] = r134a.h(T[1],x[1])
s[1] = r134a.s(T[1],x[1])

##### 1-2) Ideal compression
p[2] = p[3]
s[2] = s[1]

##### State 2
T[2] = r134a.T(p[2],s[2])
h[2] = r134a.h(p[2],s[2])

##### 2-3) Isobaric heat rejection
##### State 3
T[3] = r134a.T(p[3],x[3])
h[3] = r134a.h(p[3],x[3])
s[3] = r134a.s(p[3],x[3])

##### 3-4) Isenthalpic expansion
p[4] = p[1]
h[4] = h[3]

##### State 4
T[4] = r134a.T(p[4],h=h[4])
s[4] = r134a.s(p[4],h=h[4])
x[4] = r134a.x(p[4],h=h[4])

##### COP
# Desired: Heat Input
q_in = h[1]-h[4]
# Cost: Net Work
w_net = h[2]-h[1]
# COP: Desired/Cost
COP_R = q_in/w_net<jupyter_output><empty_output><jupyter_text>(c) Net Work<jupyter_code>%%showcalc
##### Mass flow rate
mdot = Qdot_in/q_in

##### Net work
Wdot_net = mdot*w_net<jupyter_output><empty_output><jupyter_text>(d) Volumetric flow rate entering compressor<jupyter_code>%%showcalc
##### Specific volume entering compressor
v[1] = r134a.v(T[1],x[1])

##### Volumetric flow rate
Vdot[1] = mdot*v[1]<jupyter_output><empty_output><jupyter_text>Diagrams<jupyter_code>pv = r134a.pv_diagram()
pv.ax.set_ylim(bottom=100)
pv.ax.set_xlim(right=.5)

# Plot Reference Isotherms for refrigerated space and surroundings
# Refrigerated space
pv.plot_isotherm(T_L,color='blue',label='$T_L$',ycoor=4e3,labelprops=dict(va='top'))
# Surrounding temperature
pv.plot_isotherm(T_H,color='red',label='$T_H$',ycoor=4e3);
# High pressure
pv.plot_isobar(p[2],label=f'{p[2]}',pos=.9)
pv.plot_isobar(p[1],label=f'{p[1]}',pos=.9);

for state in [1,2,3,4]:
    v[state] = r134a.v(p[state],h=h[state])

pv.plot_state(states[1],label_loc='south')
pv.plot_state(states[2],label_loc='north east')
pv.plot_state(states[3],label_loc='north east')
pv.plot_state(states[4],label_loc='north east')
    
pv.plot_process(states[1],states[2],path='isentropic',label='compressor')
pv.plot_process(states[2],states[3],path='isobaric',label='condenser')
pv.plot_process(states[3],states[4],path='isenthalpic',label='throttle')
pv.plot_process(states[4],states[1],path='isobaric',label='evaporator',labelprops=dict(va='top',ha='right',pos=.75));
Ts = r134a.Ts_diagram()
Ts.ax.set_ylim(bottom=-30,top=60)
Ts.ax.set_xlim(left=.7)

Ts.plot_state(states[1],label_loc='south east')
Ts.plot_state(states[2],label_loc='east')
Ts.plot_state(states[3],label_loc='north west')
Ts.plot_state(states[4],label_loc='south west')
    
Ts.plot_process(states[1],states[2],path='isentropic',label='compressor')
Ts.plot_process(states[2],states[3],path='isobaric',label='condenser')
Ts.plot_process(states[3],states[4],path='isenthalpic',label='throttle')
Ts.plot_process(states[4],states[1],path='isobaric',label='evaporator')

# Plot Reference Isotherms for refrigerated space and surroundings
Ts.plot_isotherm(T_L,color='blue',label='$T_L$',pos=0.1)
Ts.plot_isotherm(T_H,color='red',label='$T_H$',pos=0.1)
Ts.plot_isobar(p[2],label=f'{p[2]}',ycoor=55)
Ts.plot_isobar(p[1],label=f'{p[1]}',ycoor=55);<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup