# Variables
Tc = 295.; #K
Th = 585.; #K
W = 800000.; #KW
# Calculations
n_max = 1-(Tc/Th);
n = round(0.7*n_max,3)
Qc = round(((1-n)/n)*W,-2);
# Results
print 'Heat required',Qc,'KW'
import math
def MCPS(T0,T,A,B,C,D):
t = T/T0;
return (A)+(((B*T0)+(((C*T0*T0)+(D/(t*t*T0*T0)))*(t+1)/2))*((t-1)/math.log(t)))
# Variables
P2 = 1.; #bar
P1 = 5.; #bar
T0 = 550.; #K
A = 1.702;
B = 9.081*(10**-3);
C = -2.164*(10**-6);
D = 0;
#Equation to be used
#(<Cp>s/R)ln(T2/T1) = ln(P2/P1) math.since del_S = 0
#let I = (<Cp>s/R)
# Calculations
a = T0-1; #Initial
i = -1;
while (i == -1):
b = MCPS(T0,a,A,B,C,D);
c = (math.log(1./5))/(math.log(a/T0));
flag = c-b;
if(flag <= 0.0001):
T = a;
i = 1;
else:
a = a-.01;
i = -1;
# Results
print 'Final Temperature',T,'K'
import math
from scipy.integrate import quad
# Variables
#For Casting
Cp_Casting = 0.5; #[KJ/Kg/K]
T1 = 723.15 #[K]
T0 = 298.15 #[K]
M_Casting = 40. #[Kg]
#For Oil
Cp_Oil = 2.5 #[KJ/Kg/K]
M_Oil = 150. #[Kg]
# Calculations and Results
T = ((T1*M_Casting*Cp_Casting)+(T0*M_Oil*Cp_Oil))/((M_Casting*Cp_Casting)+(M_Oil*Cp_Oil));
#(a)-change in entropy For casting
def f1(T):
return 1./T
del_S_Casting = round(M_Casting*Cp_Casting* quad(f1,T1,T)[0],2)
print '(a)Change In Entropy of Casting',del_S_Casting,'KJ/K'
#(b)-change in entropy For Oil
def f2(T):
return 1./T
del_S_Oil = round(M_Oil*Cp_Oil* quad(f2,T0,T)[0],2)
print '(b)Change In Entropy of Oil',del_S_Oil,'KJ/K'
#(c)-Total
del_S_total = del_S_Casting+del_S_Oil;
print '(c)Total entropy change',del_S_total,'KJ/K'
import math
# Variables
#Gas A
rn_A = 1.; #rate[mol/s]
T_A = 600.; #[K]
#Gas B
rn_B = 2.; #rate[mol/s]
T_B = 450.; #[K]
#product
rn = rn_A+rn_B; #[mol/s]
T = 400.; #[K]
R = 8.314;
Cp = (7./2)*R;
T_s = 300.; #Temperature[K]
# Calculations
#By equation (2.30) rQ = rn*H-rn_A*H_A-rn_B*H_B = rn_A(H-H_A)+rn_B*(H-H_B) Rate of heat transfer
rQ = (rn_A*Cp*(T-T_A))+(rn_B*Cp*(T-T_B)); #[J/s] or [W]
#By eqn (5.22) rSg = rn*S-(rn_A*S_A)-(rn_B*S_B)-(rQ/T_s) rate of entropy generation for the process
rSg = round((rn_A*Cp*math.log(T/T_A))+(rn_B*Cp*math.log(T/T_B))-(rQ/T_s),3); #[J/K/s]
# Results
print 'Rate of heat transfer',rQ,'J/s or W'
print 'Rate of entropy generation',rSg,'J/K/s'
import math
# Variables
#Saturated Steam
#At T = 373.15K
H1 = 2676. #[KJ/Kg] from Steam table(App F)
S1 = 7.3554 #[KJ/Kg/K] from steam table(App F)
#At T = 273.15K Liquid water
H2 = 0;
S2 = 0;
T_sigma = 273.15; #[K]
T_r = 473.15; #[K]
Q_r = -2000.; #[KJ]
del_H = H2-H1;
Q = del_H;
Q_sigma = Q-Q_r;
# Calculations and Results
del_S = S2-S1;
#For Heat Reservoir at 473.15K
del_St_T_r = (-Q_r/T_r); #[KJ/K]
#For Heat reservoir provided by cooling water at 273.15K
del_St_T_sigma = -Q_sigma/T_sigma;
del_S_total = del_S+del_St_T_r+del_St_T_sigma;
print ('Since del_S_total<0 Process not feasible')
#Actual
Q_r = round((T_r/(T_r-T_sigma))*(del_H-(T_sigma*del_S)),1);
print 'Actual Heat transfer',Q_r,'KJ/Kg'
import math
def ICPH(T0,T,A,B,C,D):
t = T/T0;
return (A+((B/2)*T0*(t+1))+((C/3)*T0*T0*((t**2)+t+1))+(D/(t*T0*T0)))*(T-T0)
def ICPS(T0,T,A,B,C,D):
t = T/T0;
return ((A)*math.log(t))+(((B*T0)+(((C*T0*T0)+(D/(t*t*T0*T0)))*(t+1)/2))*(t-1))
# Variables
P1 = 50. #bar
P2 = 1.013 #bar
T1 = 800. #[K]
T2 = 300. #[K]
R = 8.314
# Calculations
#del_H = intergral(CpdT) in the limits T1 and T2
A = 3.280;
B = 0.593*(10**-3);
C = 0;
D = 0.040*(10**5);
del_H = R*ICPH(T1,T2,A,B,C,D); #[J/mol]
#del_S = integral[Cp(dT/T)] -Rln(P2/P1) btw the limits T1,T2
del_S = (R*ICPS(T1,T2,A,B,C,D))-(R*math.log(P2/P1)); #[J/mol/K]
W_ideal = round(del_H-(T2*del_S),0); #[J/mol]
# Results
print 'Maximum Work',W_ideal,'J/mol'
import math
# Variables
#Saturated Steam
#At T = 373.15K
H1 = 2676.; #[KJ/Kg] from Steam table(App F)
S1 = 7.3554; #[KJ/Kg/K] from steam table(App F)
#At T = 273.15K Liquid water
H2 = 0;
S2 = 0;
T_sigma = 273.15; #[K]
T_r = 473.15; #[K]
# Calculations
del_H = H2-H1;
del_S = S2-S1;
W_ideal = del_H-(T_sigma*del_S); #[KJ/Kg]
Q = round(abs(W_ideal*(T_r/(T_sigma-T_r))),1); #[KJ]
# Results
print 'Maximum Possible Work',Q,'KJ'
%matplotlib inline
import math
from matplotlib.pyplot import plot,suptitle,xlabel,ylabel
# Variables
T_H1 = 400.; #[K]
T_H2 = 350.; #[K]
T_C1 = 300.; #[K]
T_sigma = 300.; #[K]
rn_H = 1.; #[mol/s]
R = 8.314;
Cp = (7./2)*R;
T_C2_a = T_H2-10;
T_C2_b = T_H1-10;
# Calculations and Results
X = [0,1];
Y = [T_C1,T_C2_a];
plot(X,Y);
Y = [T_H1,T_H2];
plot(X,Y);
X = [1,1];
Y = [290,410];
plot(X,Y);
X = [0,0.25];
Y = [T_C1,T_C1];
plot(X,Y,'--');
Y = [T_H1,T_H1];
plot(X,Y,'--');
X = [0.75,1];
Y = [T_C2_a,T_C2_a];
plot(X,Y,'--');
Y = [T_H2,T_H2];
plot(X,Y,'--');
suptitle("(a)Case 1,Cocurrent")
xlabel("Qc")
ylabel("T");
X = [0,1];
Y = [T_C1,T_C2_b];
plot(X,Y);
Y = [T_H2,T_H1];
plot(X,Y);
X = [1,1];
Y = [290,410];
plot(X,Y);
X = [0,0.25];
Y = [T_C1,T_C1];
plot(X,Y,'--');
Y = [T_H2,T_H2];
plot(X,Y,'--');
X = [0.75,1];
Y = [T_C2_b,T_C2_b];
plot(X,Y,'--');
Y = [T_H1,T_H1];
plot(X,Y,'--');
suptitle("(b)Case 2,Countercurrent")
xlabel("Qc")
ylabel("T");
#Solution
#Equation to be used
#(rn_H*Cp(T_H2-T_H1))+(rn_C*Cp(T_C2-T_C1)) = 0 Eq(A)
#del_rS = rn_H*Cp*(ln(T_H2/T_H1)+kln(T_C2/T_C1)) k = rn_C/rn_H r-->Rate Eqn(B)
#rW_lost = T_sigma*del_rS Eqn(C)
#(a)-Cocurrent
#by Eqn(A)
T_C2_a = T_H2-10;
k = (T_H1-T_H2)/(T_C2_a-T_C1); #k = rn_C/rn_H
#By Eqn(B)
del_rS = round(rn_H*Cp*(math.log(T_H2/T_H1)+(k*math.log(T_C2_a/T_C1))),3); #[J/K/s]
#By Eqn(C)
rW_lost = round(T_sigma*del_rS,1); #[J/s]or[W]
print ('(a)-Cocurrent')
print 'Rate Of change of entropy',del_rS,'J/K/s'
print 'Lost Work',rW_lost,'J/s or W'
#(b)-Countercurrent
T_C2_b = T_H1-10;
k = (T_H1-T_H2)/(T_C2_b-T_C1); #k = rn_C/rn_H
#By Eqn(B)
del_rS = round(rn_H*Cp*(math.log(T_H2/T_H1)+(k*math.log(T_C2_b/T_C1))),3); #[J/K/s]
#By Eqn(C)
rW_lost = round(T_sigma*del_rS,1); #[J/s]or[W]
print ('(b)-Countercurrent')
print 'Rate Of change of entropy',del_rS,'J/K/s'
print 'Lost Work',rW_lost,'J/s or W'