In [25]:

```
from __future__ import division
#Input data
p=40#Pressure in bar
T1=400+273#Temperature in K
T2=40+273#Temperature in K
x=[0,10,515.5,72.23,363.0,0.1478,0.5167,80.9*10**-6,0.0333]#Property values from table p(bar),t(degree C), hf,hg(kJ/kg),sf,sg(kJ/kg.K),vf,vg(m**3/kg)
y=[0,0.2,277.3,38.35,336.55,0.0967,0.6385,77.4*10**-6,1.163]#Property values from table p(bar),t(degree C), hf,hg(kJ/kg),sf,sg(kJ/kg.K),vf,vg(m**3/kg)
#Calculations
h1=3216#Enthalpy in kJ/kg
s1=6.7690#Entropy in kJ/kg.K
s2=s1#Entropy in kJ/kg.K
x2=(s2-0.5725)/(8.2570-0.5725)#Dryness fraction
h2=167.57+x2*2406.7#Enthalpy in kJ/kg
h3=167.57#Enthalpy in kJ/kg
h4=(167.57+p*100*1.008*10**-3)#Enthalpy in kJ/kg
h5=1087.31#Enthalpy in kJ/kg
h6=2801.4#Enthalpy in kJ/kg
ha=x[(4)]#Enthalpy in kJ/kg
sa=x[(6)]#Entropy in kJ/kg.K
sb=sa#Entropy in kJ/kg.K
xb=(sb-y[(5)])/(y[(6)]-y[(5)])#Dryness fraction
hb=(y[(3)]+xb*(y[(4)]-y[(3)]))#Enthalpy in kJ/kg
hc=y[(3)]#Enthalpy in kJ/kg
hd=hc#Enthalpy in kJ/kg
m=(h6-h5)/(hb-hc)#Mass of mercury circulated per kg of steam
Q1=m*(ha-hd)+(h1-h6)+(h5-h4)#Heat supplied in kJ/kg
Q2=(h2-h3)#Heat rejected in kJ/kg
nc=(1-(Q2/Q1))*100#Efficiency in percent
#Output
print " (a) The amount of mercury circulated per kg of water is %3.4f kg \n (b) The efficiency of the combined cycle is %3.1f percent"%(m,nc)
```

In [24]:

```
from __future__ import division
#Input data
m=5#Mass flow rate in kg/s
p1=40#Pressure in bar
T1=440+273#Temperature in K
p2=1.5#Pressure in bar
p3=1#Pressure in bar
T3=60+273#Temperature in K
p4=16#Pressure in bar
T4=100+273#Temperature in K
p5=9#Pressure in bar
#Calculations
h1=3307.1#Enthalpy in kJ/kg
s1=6.9041#Entropy in kJ/kg.K
s2=s1#Entropy in kJ/kg.K
h2=2570.8#Enthalpy in kJ/kg
h3=417.46#Enthalpy in kJ/kg
h6=(251.13+(1.0172*10**-3)*(p3-0.1994)*100)#Enthalpy in kJ/kg
m3=(m/2)#Mass flow rate in kg/s
m6=m3#Mass flow rate in kg/s
h4=(m3*h3+m6*h6)/m#Enthalpy in kJ/kg
h5=(h4+(1.0291*10**-3)*(p1-p3)*100)#Enthalpy in kJ/kg
ha=241.58#Enthalpy in kJ/kg
sa=0.7656#Entropy in kJ/kg.K
sb=sa#Entropy in kJ/kg.K
hb=229.43#Enthalpy in kJ/kg
hc=71.93#Enthalpy in kJ/kg
hd=hc+(0.7914*10**-3*(p4-p5)*100)#Enthalpy in kJ/kg
Q1=(m*(h1-h5))/1000#Heat supplied in kW
Wnets=(m*((h1-h2)-(h5-h4)))#Net workdone by steam in kW
mR12=(m3*(h2-h3))/(ha-hd)#Mass of R12 in kg/s
WnetR=(mR12*((ha-hb)-(hd-hc)))#Net workdone by R12 in kW
T=Wnets+WnetR#Total output in kW
Qh=(m6*(h2-h6))#Heat rejected in kW
#Output
print "(a) Rate of heat transfer in the steam generator is %3.3f kW \n (b) The net power output of the binary cycle is %d kW \n (c) The rate of heat transfer to the industrial process is %3.0f kW"%(Q1,T,Qh)
```

In [27]:

```
from numpy import mat
#Input data
rp=7.5#Pressure ratio
T1=15+273#Inlet air temperature in K
T3=750+273#Maximum temperature in K
T6=100+273#Temperature in K
p1=50#Pressure in bar
T7=600+273#Temperature in K
p2=0.1#Pressure in bar
P=200#Total power in MW
CV=43.3#calorific value in MJ/kg
cpg=1.11#Specific heat for gas in kJ/kg.K
g=1.33#Ratio of specific heats for gas
cpa=1.005#Specific heat for air in kJ/kg.K
g1=1.4#Ratio of specific heats for air
#Calculations
T2=(T1*rp**((g1-1)/g1))#Temperature in K
T4=(T3/rp**((g-1)/g))#Temperature in K
ha=3670#Enthalpy in kJ/kg
hb=2305#Enthalpy in kJ/kg
hc=192#Enthalpy in kJ/kg
hd=hc#Enthalpy in kJ/kg
#ma*cpg*(T3-T6)=ms*(ha-hd)
#ma*cpg*(T3-T4)-ma*cpa*(T2-T1)+ms*(ha-hb)=P*1000
#Solving these two equations
A=mat([[cpg*(T3-T6), (hd-ha)],[cpg*(T3-T4)-cpa*(T2-T1), (ha-hb)]])#Coefficient matrix
B=mat([[0],[(P*10**3)]])#Constant matrix
X=(A**-1)*B#Variable matrix
Wgt=(cpg*(T3-T4)-cpa*(T2-T1))*X[0]*10**-3#Net workdone by Gas turbine in MW
Wst=(P-Wgt)#Net workdone by steam turbine in MW
Q1=(X[0]*cpg*(T3-T2+T3-T4))#Heat supplied in MW
nth=(P/(Q1*10**-3))*100#Thermal efficiency in percent
af=(CV*10**3)/(cpg*(T3-T2+T3-T4))#Air fuel ratio
#Output
print " (a) The flow rate of air is %3.2f kg/s and steam is %3.2f kg/s \n (b) The power outputs of the gas turbine is %3.2f MW and steam turbine is %3.2f MW \n (c) The thermal efficiency of the combined plant is %3.0f percent \n (d) The air fuel ratio is %3.1f"%(X[0],X[1],Wgt,Wst,nth,af)
```

In [29]:

```
from __future__ import division
from math import log
#Input data
p1=1#Pressure in bar
T1=25+273#Temperature in K
rp=8#Pressure ratio of compressor
Tm=900+273#Maximum temperature in K
pd=3#pressure drop in combustion chamber in percent
nc=0.88#Efficiency of compressor
nt=0.88#Efficiency of turbine
CV=44.43#Calorific value of fuel in MJ/kg
cpa=1.006#Specific heat of air in kJ/kg.K
cpg=1.148#Specific heat of gas in kJ/kg.K
g1=1.333#Specific heat ratio of gas
g=1.4#Specific heat ratio of air
T3=425+273#Temperature in K
p2=40#Pressure in bar
p3=0.04#Condensor pressure in bar
Th=170.4+273#Temperature of feed water to the HRSG in K
nst=0.82#Efficiency of steam turbine
pdh=5#Pressure drop in HRSG in kPa
m=29.235#Steam flow rate in kg/s
A=1.0401#si=1.0401+0.1728*(h/c)
B=0.1728#si=1.0401+0.1728*(h/c)
#Calculations
#Gas turbine plant
T2=(rp**((g-1)/(g*nt)))*T1#Temperature in K
#Combustor
pc=((pd/100)*rp)#Pressure loss in bar
pcx=(rp-pc)#Pressure in bar
f=((cpg*(Tm-T1))-(cpa*(T2-T1)))/((CV*10**3)-(cpa*(T2-T1)))#Fuel flow rate in kg/s
af=(1-f)/f#Air fuel ratio
#C8H18+12.5O2->8CO2+9H2O
afc=(12.5*32)/(0.232*114)#Air fuel ratio for stoichiometric combustion
ea=((af-afc)/afc)*100#Excess air in percent
#Gas turbine
p4=p1+0.05#Pressure in bar
T4=(Tm/(pcx/p4)**(((g1-1)*nt)/g1))#Temperature in K
#HRSG
T5=250+30#Temeprature in K
ha=3272#Enthalpy in kJ/kg
hf=1087.31#Enthalpy in kJ/kg
ws=(cpg*((T4-273)-T5))/(ha-hf)#Flow rate in kg/s
he=721.1#Enthalpy in kJ/kg
T6=(T4-273)-((ws*(ha-he))/cpg)#Temperature in degree C
#Power output
sa=6.853#Entropy in kJ/kg.K
sbs=sa#Entropy in kJ/kg.K
xbs=(sbs-0.4266)/8.052#Dryness fraction
hbs=(121.46+xbs*2432.9)#ENthalpy in kJ/kg
Wst=(m*(ha-hbs)*nst)#Workdone in kW
wg=(m/ws)#gas flow rate in kg/s
wa=(1-f)*wg#Air flow rate entering the compressor in kg/s
Wgt=(wg*cpg*(Tm-T4))-(wa*cpa*(T2-T1))#Power output of gas turbine in kW
TO=Wst+Wgt#Total power output in kW
wf1=(f*wa)#Fuel mass flow rate in kg/s
wf=4.466#Rounding off of wf1 for exact answers
no=(TO/(wf*(CV*10**3)))*100#Overall efficiency of the combined plant in percent
ns=((ha-hbs)/(ha-he))*nst#Efficiency of steam plant
ngtp=(Wgt/(wf*(CV*10**3)))#Efficiency of the GT plant
xL=((wg*cpg*(T6-(T1-273)))/(wf*(CV*10**3)))#Lost heat coefficient
nov=(ns+ngtp-ns*ngtp-ngtp*xL)#The overall efficiency
#Energy fluxes and irreversibilities
si=(A+B*((18*1)/(8*12)))#si for octane C8H18
dHo=(wf*CV*10**3)#Power in kW
dGo=(si*dHo)#Power in kW
TS=(dGo-dHo)#Power in kW
#Compressor
dS=(cpa*log(T2/T1))-(((cpa*(g-1))/g)*log(rp))#change in entropy in kJ/kg.K
Ic=(wa*T1*dS)#power in kW
Icx=((wg*T1*((cpg*log(Tm/T1))-(((cpg*(g1-1))/g1)*log(pcx))))-(wa*T1*((cpa*log(T2/T1))-(((cpa*(g-1))/g)*log(rp))))+TS)#Compressor in kW
Icg=(-cpg*log(Tm/T4))-(((cpg*(g1-1))/g1)*log(p4/pcx))#Difference in entropy in kJ/kg.K
IGT=(Icg*T1*wg)#Gas turbine in kW
se=2.046#Enntropy in kJ/kg.K
sae=(sa-se)#Difference in entropy in kJ/kg.K
s64=(cpg*log((T6+273)/T4))-(((cpg*(g1-1))/g1)*log(p4/p1))#Difference in entropy in kJ/kg.K
Ih=(T1*m*sae)+(wg*T1*s64)#For HRSG in kW
hb=(ha-(nst*(ha-hbs)))#Enthalpy in kJ/kg
xb=(hb-121.46)/2432.9#Dryness Fraction
sb=(0.4226+xb*8.052)#Entropy in kJ/kg.K
Ist=(m*(sb-sa)*T1)#For steam turbine in kW
Iexh=(wg*cpg*((T6-(T1-273))-(T1*log((T6+273)/T1))))#For exhaust in kW
Tl=Icx+Icg+IGT+Ih+Ist+Iexh#Exergy losses in kW
T=Tl+Wgt+Wst#Total exergy output and exergy destruction in kW
ee=((Wst+Wgt)/T)*100#Exergy efficiency in percent
#Output
print "(a) Total power output is %3.2f kW and overall efficiency is %3.2f percent lost heat coefficient is %3.3f\n Exergy efficiency is %3.0f percent \n\n Input is %3.0f kW \n Total Output is %3.0f kW \n Total losses is %3.0f kW \n Exergy outut + exergy destruction = %3.0f kW which is 1.3 percent gretter than the exergy input"%(TO,no,xL,ee,dGo,(Wgt+Wst),Tl,T)
```

In [30]:

```
#Input data
n1=0.5#Efficiency of mercury
n2=0.4#Efficiency of steam
n3=0.25#Efficiency of composite cycle
#Calculations
n=(1-(1-n1)*(1-n2)*(1-n3))*100#Overall efficiency of the combined cycle in percent
#Output
print "The overall efficiency of the combined cycle is %3.1f percent"%(n)
```

In [17]:

```
#Input data
z=30.0#Percentage of total energy of fuel
n=40.0#Cycle efficiency in percent
#Calculations
on=((z/100)+(1-(z/100))*(n/100))*100#Overall efficiency in percent
#Output
print "The overall efficiency of the combined plant is %3.0f percent"%(on)
```

In [32]:

```
from __future__ import division
from math import exp
#Input data
Tc=1250+273#Cathode temperature in K
Ta=500+273#Anode temperature in K
e=1.602*10**-19#Charge in coloumb
K=1.38*10**-23#Boltzmann constant in J/molecule.K
b=18#Constant
#Calculations
Va=((b*K*Ta)/e)#Voltage of anode in V
Vc=((b*K*Tc)/e)#Voltage of cathode in V
Vo=Vc-Va#Output voltage in V
Ja=(120*Ta**2*exp(-b))#Current density in Cathode in A/cm**2
Jc=(120*Tc**2*exp(-b))#Current density in Anode in A/cm**2
P=Vo*(Jc-Ja)#Power output per unit area in /cm**2
nth=(((Tc-Ta)/Tc)*(b/(b+2)))*100#Thermal efficiency in percent
#Output
print "(a) The output voltage is %3.4f V \n (b) The current density in the cathode is %3.3f A/cm**2 and anode is %3.3f A/cm**2 \n (c) Power output per unit area is %3.2f W/cm**2 \n (d) Thermal efficiency is %3.1f percent"%(Vo,Jc,Ja,P,nth)
```

In [35]:

```
from __future__ import division
from math import sqrt
#Input data
P=100#Power in kW
V=115#Voltage in V
To=1500#Outer temperature in K
Te=1000#Exit temperature in K
Ta=350#Ambient temperature in K
nth=30#Thermal efficiency in percent
nge=92#Generator efficiency in percent
#Properties of thermoelectrons
a=0.0012#At 1250K in V/K
kp=0.02#In W/cm.K
kn=0.03#In W/cm.K
dp=0.01#In ohm.cm
dn=0.012#In ohm.cm
J=20#Current density in A/cm**2
#Calculations
zmax=(a**2/(sqrt(dp*kp)+sqrt(dn*kn))**2)#Maximum value of figure of merit in K**-1
mo=sqrt(1+(zmax*((To+Te)/2)))#Optimum value of the resistance ratio
nmax=(((To-Te)/To)*((mo-1)/(mo+(Te/To))))*100#Maximum thermal efficiency in percent
Vl=(a*(To-Te)*(mo/(mo+1)))#Voltage per couple in V
nc=(V/Vl)#Number of couples in series
L=((a*(To-Te))/((1+mo)*(dp+dn)))/J#Length in cm
A=((P*Te)/V)/J#Area in cm**2
I=(J*A)#Current in A
Vo=(a*(To-Te))#Voltage in V
Q1=((a*I*To)-((1/2)*(L/A)*I**2*(dp+dn))+((A/L)*(kp+kn)*(To-Te)))/1000#Heat input to the thermoelectric generator in kW
Q2=((a*I*Te)+((A/L)*(kp+kn)*(To-Te))+P)/1000#Heat rejected at full load in kW
Q1n=(((A/L)*(kp+kn)*(To-Te)))/1000#At no load heat input in kW
Q2n=Q1n#At no load heat rejected in kW
no=((nmax/100)+(1-(nmax/100))*(nth/100)*(nge/100))*100#Overall efficiency in percent
#Output
print "(a) The thermal efficiency of thermocouple generator is %3.1f percent \n (b) The number of thermo couples in series is %d \n (c) The lenght of the thermal elements is %3.3f cm and area is %3.2f cm**2 \n (d) The output open-circuit voltage is %3.1f V \n (e) At full load: \n The heat input is %3.3f kW \n The heat rejected is %3.3f kW \n At no load: \n The heat input is %3.3f kW \n The heat rejected is %3.3f kW \n (f) The overall efficiency of the combined thermo-electric steam power plant is %3.2f percent"%(nmax,nc,L,A,Vo,Q1,Q2,Q1n,Q2n,no)
```