import math
# Variables
#Given:
u1 = 1; #entering velocity of water (m/s)
d_ent = 0.2; #entrance diameter of reducer (m)
d_exit = 0.1; #exit diameter of reducer (m)
P_ent = 105; #pressure at entrance (kPa)
z = 5; #distance between entrance and exit (m)
g = 9.81; #acceleration due to gravity
den = 1000; #density of water (kg/m**3)
# Calculations
#To calculate the pressure at exit
A1 = (math.pi/4)*d_ent**2; #cross section area of entrance (m**2)
A2 = (math.pi/4)*d_exit**2; #cross section area of exit (m**2)
#By the equation of continuity and since density of water remains constant
u2 = (A1*u1)/A2;
#By Bernoulli's equation between section 1 and 2 (Eq 5.20 Page no. 118)
P_exit = (-((u2**2-u1**2)/2)-(g*z)+(P_ent*10**3/den))*(den/10**3)
# Results
print 'The pressure at exit is %f kPa'%P_exit
# Variables
#Given:
P = 1000.; #pressure of saturated steam (kPa)
T = 398.; #temperature of escaping steam (K)
#Referring steam tables
H_vap = 2778.; #enthalpy of saturated vapour at 1000 kPa (kJ/kg)
H_liq = 763.; #enthalpy of saturated liquid at 1000 kPa (kJ/kg)
H_steam = 2726.; #enthalpy of superheated steam at 398 K (kJ/kg)
H2 = 2726; #[kJ/kg]
# Calculations
#No work is done and no heat is exchanged between section 1 and 2
#S0% H1 = H2
x = (H2-H_vap)/(H_liq-H_vap)
# Results
print 'The steam contains %f percent liquid'%(x*100)
# Variables
#Given:
m = 10.; #mass flow rate of steam (kg/s)
H1 = 3062.; #enthalpy of entering steam (kJ/kg)
H2 = 2875.; #enthalpy of discharged steam (kJ/kg)
Q = -100./m; #heat loss to the surrounding (kJ/kg)
u1 = 0.; #entering velocity of steam
# Calculations
import math
H = H2-H1;
u2 = math.sqrt((Q-H)*1000*2)
# Results
print 'The discharge velocity is %i m/s'%u2
# Variables
#Given:
To = 600.; #temperature of air (K)
Po = 2000.; #pressure of air (kPa)
gama = 1.4;
M = 0.8; #Mach number at throat
m = 29.; #molecular mass of air
R = 8.314; #ideal gas constant
#To determine thermodynamical properties at throat and critical pressure
import math
# Calculations and Results
#(a)
#Using equation 5.40 (Page no 123).. u**2 = (M**2)*gama*P*V
#Substituting this in eq. 5.39 (Page no. 123) and on rearranging we get
P = Po/((1+(((gama-1)/2)*M**2))**(gama/(gama-1)))
#Using eq. 5.39 and the relation PoVo = RTo/m
u = math.sqrt((2*gama*R*To*1000)/(m*(gama-1))*(1-(P/Po)**((gama-1)/gama)))
#Using eq. 3.23 (Page no. 49)
T = To*(P/Po)**((gama-1)/gama)
#Let d be the density
d_o = (Po*m)/(R*To)
#Since P*(V**gama) = P/(den**gama) = constant...so
d = d_o*((P/Po)**(1/gama))
print '(a). At throat'
print 'Pressure = %i kPa'%P
print 'Temperature = %i K'%T
print 'Velocity = %f m/s'%u
print 'Density = %f kg/cubic m'%d
#(b)
#Using eq. 5.42 (Page no.124)
Pc = Po*((2/(gama+1))**(gama/(gama-1))) #critical pressure
print '(b).'
print 'The critical pressure is %f kPa'%Pc
# Variables
P1 = 1.; #initial pressure (bar)
T1 = 300.; #initial temperature (K)
P2 = 10.; #final pressure (bar)
gama = 1.3; #gama for CO2
V_rate = 100.; #volumetric flow rate (m**3/h)
# Calculations and Results
#To calculate work required and temperature after compression
Ws = (gama/(gama-1))*P1*10**5*(V_rate/3600)*(1-(P2/P1)**((gama-1)/gama))
print 'The work required is %f kW'%(-Ws/1000)
#Using equation 3.23 (Page no.49)
T2 = T1*((P2/P1)**((gama-1)/gama))
print 'Temperature of gas after compression is %f K'%T2
# Variables
P1 = 100.; #initial pressure of saturated steam (kPa)
P2 = 500.; #final pressure (kPa)
eff = 0.8; #compression efficiency
#Referring steam tables
#Properties of steam entering the compressor
H1 = 2675.5; #enthalpy (kJ/kg)
S1 = 7.3594; #entropy (kJ/kg K)
#Properties of compressed steam
H2 = 3008.; #enthalpy (kJ/kg)
S2 = S1; #isentropic compression
# Calculations and Results
#To calculate work required and temperature
Hs = H2-H1;
#Using eq. 5.44 (Page no. 128)
W_isentropic = -Hs;
W_act = W_isentropic/eff;
print 'The work required for compression is %f kJ/kg'%-W_act
H = Hs/eff; #actual change in enthalpy
H_act = H1+H; #actual enthalpy of steam leaving the compressor
#From steam tables for superheated steam at 500 kPa and enthalpy of H_act
T = 586; #temperature (K)
print 'Temperature of exhaust steam is %i K'%T
# Variables
#Given:
T1 = 288.; #temperature of surrounding (K)
T2 = 261.; #temperature of solution (K)
Q2 = 1000.; #heat removed (kJ/min)
# Calculations
#To determine the least amount of power
#Using eq. 5.57 (Page no. 137)
W = Q2*((T1-T2)/T2 ) #power in kJ/min
P = (W*1000)/(746.*60) #power in hp
# Results
print 'Least amount of power necessary is %f hp'%P
# Variables
#Given:
T = 290.; #operating temperature (K)
W = 1000.; #work (J)
tof = 3516.67; #ton of refrigeration (W)
# Calculations and Results
#To determine COP, heat rejected and lowest temperature
#(a)
Q2 = tof;
COP = Q2/W; #coeffecient of performance
print '(a). COP is %f'%COP
#(b)
Q1 = Q2+W; #heat rejected
print ' (b). Heat rejected is %f kW'%(Q1/1000.)
#(c)
#Let T2 be the lowest temperature
T2 = T*(Q2/Q1);
print ' (c). Lowest possible temperature in refrigerator is %f K'%T2
# Variables
#Given:
T2 = 266.;
T1 = 300.; #operating temperatures of vapour compression refrigeration cycle(K)
#To determine COP at given conditions
#(a)
Ha = 656.; #(kJ/kg)
Hb = 724.; #(kJ/kg)
Hd = 144.; #(kJ/kg)
Hc = Hd;
# Calculations and Results
#Using eq. 5.61 (Page no. 139)
COP = (Ha-Hd)/(Hb-Ha);
print '(a). COP = %f'%COP
#(b)
Ha = 652.; #(kJ/kg)
Hb = 758.; #(kJ/kg)
Hd = 159.; #(kJ/kg)
Hc = Hd;
eff = 0.75; #efficiency of compressor
COP = (Ha-Hd)/((Hb-Ha)*(1./eff));
print ' (b). COP = %f'%COP
#(c). Ideal Carnot refrigerator
COP = T2/(T1-T2);
print ' (c). COP = %f'%COP
# Variables
#Given:
Tin_cool = 288.; #entering temperature of cooling water (K)
Tout_cool = 300.; #discharge temperature of cooling water (K)
m_c = 0.25; #mass flow rate of coling water (kg/s)
m = 0.5; #mass flow rate of ammonia (kg/min)
Ha = 1426.; #enthalpy of saturated ammonia vapour at 258 K (kJ/kg)
Hd = 281.5; #enthalpy of liquid ammonia at 294 K (kJ/kg)
eff = 0.9; #compressor efficiency
Cp = 4.2; #specific heat of water (kJ/kg K)
tof = 12660.; #ton of refrigeration (kJ/h)
# Calculations and Results
#To determine the power requirement and refrigeration capacity in tons
Q1 = m_c*Cp*(Tout_cool-Tin_cool); #heat rejected by compressor at constant pressure (kJ/s)
Q2 = (m/60.)*(Ha-Hd); #heat absorbed (kJ/s)
W = Q1-Q2; #work required (kJ/s)
P = (W*1000)/(eff*746); #power requirement of compressor (hp)
print 'Power requirement of the compressor is %f hp'%P
rc = Q2*3600/tof; #refrigeration capacity (ton)
print ' Refrigeration capacity is %f ton'%rc
# Variables
#Given:
m1 = 10.; #machine rating (ton)
#Since 5 K approach is necessary
T1 = 293.+5; #temperature of cooling water (K)
T2 = 261.-5; #temperature of cold storage (K)
Ha = 181.; #enthalpy of saturated vapour at 256 K (kJ/kg)
Sa = 0.714; #entropy of saturated vapour at 256K (kJ/kg K)
Hc = 62.; #enthalpy of saturated liquid at 298 K (kJ/kg)
Sc = 0.231; #entropy of saturated liquid at 298 K (kJ/kg K)
Hb = 206.; #enthalpy of superheated vapour (kJ/kg)
Sb = 0.714; #entropy of superheated vapour (kJ/kg)
# Calculations and Results
#Combining the three relations, we get
Sd = Sc; #isentropic process
Hd = Ha-(T2*(Sa-Sd));
#Using eq. 5.64 (Page no. 141)
COP = (Ha-Hd)/((Hb-Hc)-(Ha-Hd));
print 'COP = %f'%COP
#Using equation 5.63 (Page no. 140)
m = (12660*m1)/(Ha-Hd); #refrigerant circulation rate (kg/h)
print ' Refrigerant circulation rate is %f kg/h'%m
# Variables
#Given:
m1 = 10.; #machine rating (ton)
#Assuming 5 K approach in refrigerator and cooler
Ta = 261.-5; #temperature of air leaving the refrigerator (K)
Tc = 293.+5; #temperature of air leaving the cooler (K)
gama = 1.4;
Cp = 1.008; #sp. heat of air (kJ/kg K)
P1 = 4.052;
P2 = 1.013; #operating pressures in bar
# Calculations and Results
#To determine the COP and air circulation rate
#Using eq. 5.66 (Page no. 145)
Tb = Ta*(P1/P2)**((gama-1)/gama)
Td = (Tc*Ta)/Tb;
#Using equation 5.68 (PAge no. 146)
COP = Ta/(Tb-Ta)
print 'COP = %f'%COP
#Considering energy balance in refrigerator [m*Cp*(Ta-Td) = m1*12660]
m = (m1*12660)/(Cp*(Ta-Td)) #air circulation rate (kg/h)
print ' Air circulation rate is %i kg/h'%m
# Variables
#Given:
T1 = 300.; #indoor temperatur (K)
T2 = 290.; #outside temperature (K)
W_input = 1.; #1 kW heat pump
W_output = 30.; #given output (kW)
# Calculations and Results
#To verify that given heat pump is equivalent to 30 kW heater
Q2 = (T2/(T1-T2))*W_input; #heat absorbed
Q1 = Q2 + W_input; #heat rejected
if(Q1==W_output):
print '1 kW pump if operated reversibly% is equivalent to a 30 kW heater'
else:
print 'The given heat pump is not equivalent to a 30 kW heater'
# Variables
#Given:
T1 = 295.; #temperature inside building (K)
T2 = 275.; #temperature of outside air (K)
eff = 0.25; #overall efficiency of unit
Hc = 890.9; #heat of combustion of fuel (kJ/mol)
conv = 0.33; #efficiency of conversion of heat of combustion to electricity
Q1 = 10**6; #amount of heat to be delivered
# Calculations
#To determine the amount of fuel burned
COP = T1/(T1-T2)
W = Q1/COP; #work required to deliver Q1 kJ of heat
W_act = W/eff; #actual amount of electrical energy to be supplied
W_heat = W_act/conv; #heat energy required as heat of combustion
n = W_heat/Hc; #number of moles of fuel burned
# Results
print 'The amount of fuel burned is %f kmol'%(n/1000)
# Variables
#Given:
#Referring steam tables at 2.54 bar
H1 = 2717.; #enthalpy of saturated vapour (kJ/kg)
H2 = 538.; #enthalpy of saturated liquid (kJ/kg)
S1 = 7.05; #entropy of saturated vapour (kJ/kg K)
S2 = 1.61; #entropy of saturated liquid (kJ/kg K)
H = 2700.; #enthalpy of superheated steam at 1 bar and 385 K (kJ/kg)
S = 7.42; #entropy of superheated steam at 1 bar and 385 K (kJ/kg K)
# Calculations and Results
x = (H-H1)/(H2-H1)
#From steam tables
T = 401.; #temperature of steam (K)
print '(a). For isenthalpic math.expansion'
print ' The fraction of liquid in inlet stream is %f'%x
print ' The temperature of stream is %i K'%T
#(b)..The math.expansion is isentropic
#Since entropy of saturated vapour at inlet pressure (S1) is less than entropy of steam leaving the turbine (S)
#So% the inlet stream is superheated% therefore
x = 0;
#From steam tales
T = 478.; #temperature of superheated steam having entropy of 7.42 kJ/kg K
print '(b). For isentropic math.expansion'
print ' The fraction of liquid in inlet stream is %i'%x
print ' The temperature of stream is %i K'%T
# Variables
#Given:
#Referring Fig. 5.15 (Page no. 151)
Hc = 516.; #enthalpy of high pressure gas at 120 bar and 306 K (kJ/kg)
Ha = 526.; #enthalpy of low pressure gas at 2 bar and 292 K (kJ/kg)
Hf = 121.; #entalpy of saturated liquid at 2 bar (kJ/kg)
Hg = 314.; #enthalpy of saturated vapour at 2 bar (kJ/kg)
#To determine the fraction of air liquified and temperature of air
# Calculations and Results
#(a)..
#Using equation 5.73 (Page no. 152)
x = (Hc-Ha)/(Hf-Ha) #fraction of air liquified
print '(a). The fraction of liquified air is %f'%x
#(b)..
#Taking enthalpy balance around heat exchanger
Hd = Hc - (1-x)*(Ha-Hg)
#At enthalpy of Hd kJ/kg% from T-S diagram for air
T = 167.; #temperature in K
print ' (b). Temperature of air on high pressure side of throttle valve is %i K'%T
# Variables
#Given:
P2 = 2800.; #pressure of superheated steam (kPa)
P1 = 5.; #pressure after math.expansion (kPa)
e_turbine = 0.85; #isentropic turbine efficiency
e_pump = 0.8; #isentropic pump efficiency
V = 1.005*10**-3; #specific volume of saturated liquid at 5 kPaHl =
#From steam tables:
Hl = 138.; #enthalpy of saturated liquid at 5 kPa (kJ/kg)
Hv = 2562.; #enthalpy of saturated vapour at 5 kPa (kJ/kg)
H3 = 3063.; #enthalpy of superheated steam at 2800 kPa and 598 K (kJ/kg)
Sl = 0.4764; #entropy of saturated liquid at 5 kPa (kJ/kg K)
Sv = 8.3951; #entropy of saturated vapour at 5 kPa (kJ/kg K)
S3 = 6.6875; #entropy of superheated steam at 2800 kPa and 598 K (kJ/kg K)
# Calculations and Results
#To determine the ideal Rankine cycle efficiency% thermal efficiency and rate of steam production
#(a)..The ideal Rankine cycle efficiency for the stated conditions
#Referring fig 5.19(b) (Page no. 155) and considering feed water pump
Ws = V*(P2-P1) #work done by pump (kJ/kg)
H2 = Hl+Ws;
#Considering isentropic math.expansion in turbine
S4 = S3;
x = (S4-Sl)/(Sv-Sl) #fraction of steam that is vapour
H4 = Hl + x*(Hv-Hl)
#Using eq. 5.80 (Page no. 155)
e_r = ((H3-H2)-(H4-Hl))/(H3-H2)
print '(a). The ideal Rankine cycle efficiency for the stated conditions is %i percent'%(e_r*100)
#(b)..The thermal efficiency of plant
W_act = Ws/e_pump; #actual work requirement in pump
H_2 = Hl + W_act; #enthalpy of water leaving the feed water pump
W_out = e_turbine*(H3-H4) #actual work output
H_4 = H3-W_out; #actual enthalpy of steam leaving the turbine
e_act = ((H3-H_2)-(H_4-Hl))/(H3-H_2)
print ' (b). The actual efficiency is %f percent'%(e_act*100)
#(c)..The rate of steam production
W_net = e_act*(H3-H_2) #net work output (kJ/kg)
rate = (3.6*10**6)/W_net; #steam produced in boiler (kg/h)
print ' (c). The rate of steam production is %f kg/h'%(rate)
# Variables
#Given:
P2 = 7600.; #pressure of superheated steam (kPa)
P1 = 5.; #pressure after math.expansion (kPa)
V = 1.005*10**-3; #specific volume of saturated liquid (m**3/kg)
#From steam tables:
H_l1 = 138.; #enthalpy of saturated liquid at 5 kPa (kJ/kg)
S_l1 = 0.4764; #entropy of saturated liquid at 5 kPa (kJ/kg K)
H_v1 = 2562.; #enthalpy of saturated vapour at 5 kPa (kJ/kg)
S_v1 = 8.3951; #entropy of saturated vapour at 5 kPa (kJ/kg K)
H_l2 = 830.; #enthalpy of saturated liquid at 1400 kPa(kJ/kg)
S_l2 = 2.2842; #entropy of saturated liquid at 1400 kPa (kJ/kg K)
H_v2 = 2790.; #enthalpy of saturated vapour at 1400 kPa (kJ/kg)
S_v2 = 6.4693; #entropy of saturated vapour at 1400 kPa (kJ/kg K)
H5 = 3226.; #enthalpy of superheated steam at 1400 kPa and 658 K
S5 = 7.2558; #entropy of superheated steam at 1400 kPa and 658 K
H3 = 3150.; #enthalpy of superheated steam at 7600 kPa and 673 K
S3 = 6.4022; #entropy of superheated steam at 1400 kPa and 673 K
# Calculations and Results
#Let the fraction of steam in vapour state be x
S4 = S3; #as the math.expansion process is isentropic
x = (S4-S_l2)/(S_v2-S_l2)
H4 = H_l2 + x*(H_v2-H_l2)
W_high = H3-H4;
#For low pressure turbine
S6 = S5; #isentropic math.expansion
x = (S6-S_l1)/(S_v1-S_l1)
H6 = H_l1 + x*(H_v1-H_l1)
W_low = H5-H6;
print '(a)'
print ' The work output of high pressure turbine is %i kJ/kg'%W_high
print ' The work output of low pressure turbine is %i kJ/kg'%W_low
#(b)
#Work output of feed pump is [-Ws = intg(VdP)]
Ws = V*(P2-P1)
H2 = H_l1+Ws;
#Using eq. 5.82 (Page no. 159)
eff = ((H3-H2)+(H5-H4)-(H6-H_l1))/((H3-H2)+(H5-H4))
print ' (b)'
print ' Thermal efficiency is %f percent'%(eff*100)
#(c)
#The numerator of eq. 5.82 gives net work output
W_net = (H3-H2)+(H5-H4)-(H6-H_l1)
#For 1000 kW of net work output
rate = 3.6*10**6/W_net;
print ' (c)'
print ' The rate of steam circulation is %f kg/h'%rate
# Variables
#Given:
P2 = 2800.; #pressure of superheated steam (kPa)
P1 = 275.; #pressure of withdrawn steam (kPa)
V = 1.070*10**-3; #specific volume of saturated liquid at 275 kPa
#From steam tables:
H6 = 138.; #enthalpy of saturated liquid at 5 kPa
S6 = 0.4764; #entropy of saturated liquid at 5 kPa
H_v1 = 2562.; #enthalpy of saturated vapour at 5 kPa
S_v1 = 8.3951; #entropy of saturated vapour at 5 kPa
H1 = 549.; #enthalpy of saturated liquid at 275 kPa
S1 = 1.6408; #entropy of saturated liquid at 275 kPa
H_v2 = 2721.; #enthalpy of saturated vapour at 275 kPa
S_v2 = 7.0209; #entropy of saturated vapour at 275 kPa
H3 = 3063.; #enthalpy of superheated steam at 2800 kPa and 598 K
S3 = 6.6875; #entropy of superheated steam at 2800 kPa and 598 K
# Calculations and Results
#To determine the fraction of steam withdrawn and thermal efficiency of cycle
#Referring fig. 5.23 (Page no.161)
S4 = S3; #isentropic math.expansion
x = (S4-S1)/(S_v2-S1) #quality of steam
H4 = H1 + x*(H_v2-H1)
H7 = H6; #as the power input to the condensate pump is neglegible
#Applying energy balance around feed water heater
m = (H1-H7)/(H4-H7 ) #fraction of steam extracted
print 'Fraction of steam withdrawn is %f'%m
W_in = V*(P2-P1) #work input to the feed water pump
H2 = H1+W_in;
#Considering isentropic math.expansion in turbine
S5 = S3;
x = (S5-S6)/(S_v1-S6)
H5 = H6 + x*(H_v1-H6)
#Using eq. 5.85 (Page no.162)
eff = ((H3-H2)-(1-m)*(H5-H6))/(H3-H2)
print ' Thermal efficiency is %f percent'%(eff*100)
# Variables
#Given:
r = 8.; #compression ratio
T1 = 290.; #temperature at beginning (K)
P1 = 100.; #pressure at the beginning (kPa)
Q1 = 450.; #heat transferred per cycle (kJ/kg K)
Cp = 1.005; #specific heat of air (kJ/kg K)
Cv = 0.718; #specific heat of air (kJ/kg K)
R = 8.314; #ideal gas constant
M = 29.; #molecular wt of air
#To determine mean effective pressure
#Basis:
m = 1.; #mass of air (kg)
# Calculations and Results
#(a)
#Referring fig. 5.24 (Page no. 164)
V1 = (m*R*1000*T1)/(M*P1*10**3)
#Conditions at state 2
V2 = V1/r;
gama = Cp/Cv;
T2 = T1*(r**(gama-1))
P2 = P1*(r**gama )
print '(a)'
print ' At the end of first process'
print ' Temperature = %f K'%T2
print ' Pressure = %f kPa'%P2
#Conditions at state 3
#Constant volume process
V3 = V2;
T3 = Q1/Cv + T2;
P3 = (T3/T2)*P2;
print ' At the end of second process'
print ' Temperature = %f K'%T3
print ' Pressure = %f kPa'%P3
#Conditions at state 4
T4 = T3/(r**(gama-1))
P4 = P3/(r**gama)
print ' At the end of third process'
print ' Temperature = %f K'%T4
print ' Pressure = %f kPa'%P4
Q2 = Cv*(T4-T1) #heat rejected during the constant volume process
#(b)
#Using eq. 5.88 (Page no. 165)
eff = 1 - ((1./r)**(gama-1))
print ' (b)'
print ' Thermal efficiency is %f'%eff
#(c)
W = Q1-Q2; #work done
print ' (c)'
print ' Work done is %f kJ/kg'%W
#(d)
Pm = W/(V1-V2)
print ' (d)'
print ' Mean effective pressure is %f kPa'%Pm
# Variables
#Given:
r = 15.; #compression ratio
P1 = 100.; #pressure in the beginning (kPa)
T1 = 300.; #temperature in thebeginning (K)
Q1 = 500.; #heat transfer rate (kJ/kg)
M = 29.; #molecular wt of air
R = 8.314; #ideal gas constant
gama = 1.3997214
#Specific heats of air (kJ/kg K)
Cp = 1.005;
Cv = 0.718;
# Calculations and Results
#To determine work done thermal efficiency and mean effective pressure
#(a)
#Isentropic compression 1-2
V1 = (R*1000*T1)/(M*P1*10**3)
T2 = T1*r**(gama-1)
P2 = P1*r**gama;
V2 = V1/r;
print '(a)'
print ' At the end of first process'
print ' Temperature = %f K'%T2
print ' Pressure = %f kPa'%P2
#Consatnt pressure heat addition 2-3
T3 = Q1/Cp + T2;
V3 = (T3/T2)*V2;
P3 = P2;
print ' At the end of second process'
print ' Temperature = %f k'%T3
print ' Pressure = %f kPa'%P3
#Isentropic math.expansion 3-4
V4 = V1;
T4 = T3/((V4/V3)**(gama-1))
P4 = P3*((V3/V4)**gama)
print ' At the end of third process'
print ' Temperature = %f K'%T4
print ' Pressure = %f kPa'%P4
Q2 = Cv*(T4-T1) #heat rejected 4-1
#(b)
Wnet = Q1-Q2;
print ' (b)'
print ' Net work done per cycle per kg air is %f kJ/kg'%Wnet
#(c)
eff = Wnet/Q1; #thermal efficiency
print ' (c)'
print ' Thermal efficiency is %f'%eff
#(d)
Pm = Wnet/(V1-V2) #mean effective pressure
print ' (d)'
print ' Mean effective pressure is %f kPa'%Pm
# Variables
#Given:
T1 = 300.; #initial temperature (K)
P1 = 100.; #initial pressure (kPa)
T3 = 1200.; #max temperature (K)
P3 = 500.; #max pressure (kPa)
Cp = 1.005; #(kJ/kg K)
Cv = 0.718; #(kJ/kg K)
# Calculations and Results
#To determine pressure and temperature work and thermal efficiency
gama = Cp/Cv;
#(a)
P4 = P1;
P2 = P3;
#Isentropic compression 1-2
T2 = T1*((P2/P1)**((gama-1)/gama))
print '(a)'
print ' At the end of first process'
print ' Temperature = %f K'%T2
print ' Pressure = %f kPa'%P2
#Process 2-3
print ' At the end of second process'
print ' Temperature = %f K'%T3
print ' Pressure = %f kPa'%P3
#Isentropic math.expansion 3-4
T4 = T3/((P3/P4)**((gama-1)/gama))
print ' At the end of third process'
print ' Temperature = %f K'%T4
print ' Pressure = %f kPa'%P4
#(b)
W_comp = Cp*(T2-T1) #work required by compressor
print ' (b)'
print ' Work required by compressor is %f kJ/kg'%W_comp
#(c)
W_turb = Cp*(T3-T4 ) #work done by turbine
print ' (c)'
print ' Work done by turbine is %f kJ/kg'%W_turb
#(d)
eff = 1-(P1/P2)**((gama-1)/gama)
print ' (d)'
print ' Thermal efficiency is %f'%eff