In [3]:

```
#given values
P1=0.14;#intial pressure in MPa
P2=0.8;#final pressure in MPa
m=0.05;#mass flow rate in kg/s
#from refrigerant-134a tables
h1=239.16;
s1=0.94456;
h2=275.39;
h3=95.47;
#calculation
s2=s1;#isentropic process
h4=h3;#throttling
QL=(h1-h4)*m;
Wm=m*(h2-h1);
Qh=m*(h2-h3);
COPR=QL/Wm;
print'the rate of heat removal from the refrigerated space %f kW'%round(QL,2);
print'the power input to the compressor %f kW'%round(Wm,2);
print'the rate of heat rejection to the environment %f kW'%round(Qh);
print'the COP of the refrigerator is %f'%round(COPR,2);
```

In [5]:

```
#given data
m=0.05;#mass flow rate in kg/s
P1=0.14;#inlet pressure in MPa
T1=-10;#inlet temperature in C
P2=0.8;#outlet pressure in MPa
T2=50;#outlet temperature in C
P3=0.72;#condensor pressure in MPa
T3=26;#condensor temperature in C
#from refrigerant tables
h1=246.36;
h2=286.69;
h3=87.83;
h2S=284.21;#at isentropic conditions
#calculations
h4=h3;#throttling
QL=m*(h1-h4);
Wm=m*(h2-h1);
nC=(h2S-h1)/(h2-h1);
COPR=QL/Wm;
print'the rate of heat removal from the refrigerated space %f kW'%round(QL,2);
print'the power input to the compressor %f kW'%round(Wm,2);
print'the isentropic efficiency of the compressor is %f'%round(nC,3);
print'the COP of the refrigerator is %f'%round(COPR,2);
```

In [8]:

```
#given data
mA=0.05;#mass flow rate in kg/s
P1=0.14;#inlet pressure in MPa
P5=0.32;#pressure at heat exchanger in MPa
P7=0.8;#oultet pressure in MPa
#from tables
h1=239.16;
h2=255.93;
h3=55.16;
h5=251.88;
h6=270.92;
h7=95.47;
#calculations
h4=h3;#throttling
h8=h7;#throttling
# E out = E in
# mA*h5 + mB*h3 = mA*h8 + mB*h2
mB=mA*(h5-h8)/(h2-h3);
QL=mB*(h1-h4);
# W in = Wcomp I,in + Wcomp II,in
Win=mA*(h6-h5)+mB*(h2-h1);
COPR=QL/Win;
print'the mass flow rate of the refrigerant through the lower cycle %f kg/s'%round(mB,4);
print'the rate of heat removal from the refrigerated space %f kW'%round(QL,2);
print'the power input to the compressor %f kW'%round(Win,2);
print'the coefficient of performance of this cascade refrigerator is %f'%round(COPR,2);
```

In [10]:

```
#given data
P1=0.14;#inlet pressure in MPa
P5=0.32;#throttled pressure in MPa
P7=0.8;#oultet pressure in MPa
#from tables
h1=239.16;
h2=255.93;
h3=251.88;
h5=95.47;
h7=55.16;
#from saturated liquid-vapour table
#at P=0.32 MPa
hf=55.16;
hfg=196.71;
#calculations
h8=h7;#throttling
h6=h5;#throttling
#the quality at state 6
x6=(h6-hf)/hfg;
qL=(1-x6)*(h1-h8);
# W in = Wcomp I,in + Wcomp II,in
#enthalaoy at state 9
# E out = E in
h9=x6*h3+(1-x6)*h2;
# s9 = s4 i.e isentropic process
#at 0.8MPa and s4=0.9416 kJ/kg
h4=274.48;
Win=(1-x6)*(h2-h1)+(1)*(h4-h9);
COPR=qL/Win;
print'the fraction of the refrigerant that evaporates as it is throttled to the flash chamber is %f'%round(x6,4);
print'the amount of heat removed from the refrigerated space %f kJ/kg'%round(qL,1);
print'the compressor work per unit mass of refrigerant flowing through the condensor %f kJ/kg'%round(Win,2);
print'the coefficient of performance is %f'%round(COPR,2)
```

In [13]:

```
#given data
m=0.1;#mass flow rate in lbm/s
T1=0+460;#refigerated space at temperature in R
T3=80+460;#temperature of surrounding medium in R
#from Table A–17E
# at T1
h1=109.90;
Pr1=.7913;
#pressure ratio at compressor is 4
Pr2=4*Pr1;
#at Pr2
h2=163.5;
T2=683;
#at T3
h3=129.06;
Pr3=1.3860;
#pressure ratio at compressor is 4
Pr4=Pr3/4;
#at Pr4
h4=86.7;
T4=363;
#calculations
qL=h1-h4;
Wout=h3-h4;
Win=h2-h1;
COPR=qL/(Win-Wout);
Qrefrig=m*qL;
print'the minimum temperatures in the cycle %f F'%round(T4-460);
print'the maximum temperatures in the cycle %f F'%round(T2-460);
print'the coefficient of performance is %f'%round(COPR,2)
print'the rate of refrigeration for a mass flow rate of 0.1 lbm/s. %f Btu/s'%round(Qrefrig,2)
```

In [14]:

```
#given data
COPR=0.1;#refrigerator COP
T1=20;#intial temp in C
T2=4;#final temp in C
t=30*60;#total time required in sec
V=0.350;#volumne of can in L
#constants used
p=1;#on kg/L
c=4.18;#in kJ/kg-C from Table A-3
#calculations
m=p*V;
Qcooling=m*c*(T1-T2)/t*1000;#converted in W by multiplying by 1000
Win=Qcooling/COPR;
print'the average electric power consumed by the thermoelectric refrigerator %i W'%round(Win)
```