In [1]:

```
# Variables
T2 = 268.;
T1 = 308.;
# Calculation
COP = T2/(T1-T2);
ACOP = COP/3; # Actual COP
Q2 = 29.; # in kW
W = Q2/ACOP;
# Results
print "Power required to derive the plane is %.0f kW"%W
```

In [5]:

```
# Variables
h1 = 236.04; s1 = 0.9322; s2 = s1;
P2 = 0.8; # in MPa
h2 = 272.05; h3 = 93.42; h4 = h3;
m = 0.06; # mass flow rate
# Calculation
Q2 = m*(h1-h4);
Wc = m*(h2-h1);
Q1 = m*(h2-h4);
COP = Q2/Wc;
# Results
print "The rate of heat removal is %.2f kW"%Q2
print "Power input to the compressor is %.2f kW"%Wc
print "The heat rejection rate in the condenser is %.2f kW"%Q1
print "COP is %.3f"%COP
```

In [1]:

```
# Variables
h1 = 183.19;
h2 = 209.41;
h3 = 74.59;
h4 = h3;
T1 = 313.;
T2 = 263.;
W = 70000./3600; # Plant capacity in kW
# Calculation
w = W/(h1-h4); # Refrigerant flow rate
v1 = 0.077;
VFR = w*v1;
T = 48.; # in degree
P2 = 9.6066; P1 = 2.1912;
rp = P2/P1; # Pressure ratio
Q1 = w*(h2-h3);
hf = 26.87; hfg = 156.31;
x4 = (h4-hf)/hfg;
COP = (h1-h4)/(h2-h1);
PI = w*(h2-h1);
COP = T2/(T1-T2);
COP_v = 4.14;
r = COP_v/COP;
# Results
print "Refrigerant flow rate is %.2f Kg/s"%w
print "Volume flow rate is %.4f m3/s"%VFR
print "Compressor discharge temperature is",T,"degree"
print "Pressure ratio is %.2f"%rp
print "Heat rejected to the condenser is %.2f kW"%Q1
print "Flash gas percentage is %.1f %%"%(x4*100)
print "COP is",COP
print "Power required to drive the compressor is %.2f kW"%PI
print "Ratio of COP of carnot refrigerator is %.3f"%r
# note : rounding off error is there.
```

In [16]:

```
import math
# Variables
h3 = 882.
h2 = 1034.;
h6 = 998.
h1 = 1008.;
v1 = 0.084;
# Calculation and Results
h4 = h3-h1+h6; h5 = h4;
t4 = 25.+273;
print "Refrigeration effect is",h6-h5,"kJ/kg"
m = 10.;
w = (m*14000)/((h6-h5)*3600); # in kg/s
print "Refrigerant flow rate is %.2f kg/s"%w
v1 = 0.084;
VFR = w*3600*v1; # in kg/h
ve = 0.8; # volumetric efficiency
CD = VFR/(ve*60); # in m3/min
N = 900;
n = 2;
D = ((CD*4)/(math.pi*1.1*N*n))**(1./3); # L = 1.1D L = length D = diameter
L = 1.1*D;
print "Diameter of cylinder is %.1f cm"%(D*100)
print "Length of cylinder is %.2f cm"%(L*100)
COP = (h6-h5)/(h2-h1);
PI = w*(h2-h1);
print "Power required to drive the compresor is %.2f kW"%PI
print "COP is %.2f"%COP
```

In [3]:

```
import math
# Variables
P2 = 1554.3;
P1 = 119.5;
Pi = math.sqrt(P1*P2);
h1 = 1404.6;
h2 = 1574.3;
h3 = 1443.5;
h4 = 1628.1;
h5 = 371.7; h6 = h5; h7 = 181.5;
w = 30.; # capacity of plant
# Calculation
m2_dot = (3.89*30)/(h1-h7);
m1_dot = m2_dot*((h2-h7)/(h3-h6));
Wc_dot = m2_dot*(h2-h1)+m1_dot*(h4-h3);
COP = w*3.89/Wc_dot;
# math.single stage
h1_ = 1404.6; h2_ = 1805.1;
h3_ = 371.1; h4_ = h3_;
m_dot = (3.89*30)/(h1_-h4_);
Wc = m_dot*(h2_-h1_);
COP_ = w*3.89/Wc;
IW = (Wc-Wc_dot)/Wc_dot;
ICOP = (COP-COP_)/COP_
# Results
print "Increase in work of compression is %.2f"%(IW*100)
print "Increase in COP for 2 stage compression is %.2f %%"%(ICOP*100)
# note : rounding error is there.
```

In [20]:

```
# Variables
tsat = 120.2+273
hfg = 2201.9;
T1 = 120.2+273;
T2 = 30.+273;
Tr = -10.+273;
# Calculation
COP_max = ((T1-T2)*Tr)/((T2-Tr)*T1);
ACOP = 0.4*COP_max;
Qe = (20.*14000)/3600; # in KW
Qg = Qe/ACOP;
x = 0.9;
H = x*hfg;
SFR = Qg/H;
# Results
print "Steam flow rate required is %.4f kg/s"%SFR
```

In [4]:

```
# Variables
T1 = 277.;
T3 = 273.+55;
rp = 3.; # Pressure ratio
g = 1.4;
cp = 1.005;
# Calculation and Results
T2s = T1*(rp**((g-1)/g));
T2 = T1+(T2s-T1)/0.72
T4s = T3/(rp**((g-1)/g));
T34 = 0.78*(T3-T4s); # T3-T4
T4 = T3-T34;
COP = (T1-T4)/((T2-T1)-(T3-T4));
print "COP of the refrigerator is %.2f"%COP
P = (3.*14000)/(COP*3600)
print "Driving power required is %.1f kW"%P
m = (3.*14000)/(cp*(T1-T4));
print "Mass flow rate is %.2f kg/s"%(m/3600)
# note: rounding off error is there.
```

In [26]:

```
# Variables
P1 = 2.4; T1 = 0+273;
h1 = 188.9; s1 = 0.7177; v1 = 0.0703;
P2 = 9; T2 = 60+273;
h2 = 219.37;
h2s = 213.27;
h3 = 71.93; h4 = h3;
v1 = 0.0703;
A1V1 = 0.6/60;
# Calculation
m_dot = A1V1/0.0703;
Wc_dot = m_dot*(h2-h1);
Q1_dot = m_dot*(h2-h3);
COP = Q1_dot/Wc_dot;
nis = (h2s-h1)/(h2-h1);
# Results
print "Power input is %.2f kW"%Wc_dot
print "Heating capacity is %.2f kW"%Q1_dot
print "COP is %.3f"%COP
print "The isentropic compressor efficiency is %.2f %%"%(nis*100)
```

In [14]:

```
# Variables
T1 = 275.;
T3 = 310.;
P1 = 1. ; P2 = 4.;
# Calculation
T2s = T1*(P2/P1);
nc = 0.8;
T2 = T1 + (T2s-T1)*nc;
pr = 0.1;
P3 = P2-0.1;
P4 = P1+0.08;
PR = P3/P4;
# Results
print "Pressure ratio for the turbine is %.3f"%PR
T4s = T3*(1./PR)**(0.286);
nt = 0.85;
T4 = T3-(T3-T4s)*nt;
COP = (T1-T4)/((442.26-T3)-(T1-T4));
print "COP is %.3f"%COP
# note : rounding off error is there.
```