from __future__ import division
# Given data
H1 = 2600 # in kJ/kg
H2 = 1850 # in kJ/kg
g = 9.81
C1 = 10 # in meter/second
C2 = 20 # in meter/secon
Q = 120 # in kJ/kg
Z1 = 30 # in meter
Z2 = 10 # in meter
W = g*(Z1-Z2)/1000+H1-H2+(C1**2-C2**2)/(2*1000)+Q
print "The work done = %0.0f kJ/kg " %W
# Given data
H1 = 3100 # in kJ/kg
H2 = 1950 # in kJ/kg
C1 = 20 # in meter/second
C2 = 30 # in meter/secon
Q = 0 # in kJ/kg
Q_desh= 20 # in kJ/kg
Vs= 1.1 # in m**3/kg
W = H1-H2+(C1**2-C2**2)/(2*1000)+Q-Q_desh # in kJ/kg
m= 2 #mass flow rate in kg/sec
Power= m*W # in kW
print "Power output of the turbine = %0.1f kW" %Power
Area= m*Vs/C2 # in m**2
print "Area of exhaust pipe = %0.3f m**2 " %Area
from math import sqrt
# Given data
H1 = 2940 # in kJ/kg
H2 = 2630 # in kJ/kg
C = sqrt((H1-H2)*1000*2) # in m/sec
print "Velocity of the steam leaving the nozzle = %0.1f m/sec " %C
from math import sqrt
# Given data
H1 = 2800 # in kJ/kg
H2 = 2600 # in kJ/kg
C2 = sqrt(2*(H1-H2)*1000) # in m/s
print "Exit velocity = %0.0f m/s" %C2
m_f = 25 # mass flow rate in kg/sec
V = 0.154 # in m**3/kg
A = (m_f*V)/C2 # in m**2
print "Total exit area = %0.4f m**2" %A
# Given data
Q = 20 # in kJ/kg
P = 10 # in MW
P = P * 10**3 # in kW
H1 = 3248 # in kJ/kg
H2 = 2552 # in kJ/kg
C1 = 20 # m/s
C2 = 40 # m/s
m = P/((H1-H2+(C1**2-C2**2)/(2*1000))-Q) # in kg/s
print "Mass = %0.3f kg " %m
# Given data
h_f1 = 2584 # in kJ/kg
h_fg1 = 2392 # in kJ/kg
H2 = 192 # in kJ/kg
x = 0.2
H1 = round(h_f1- (x*h_fg1)) # in kJ/kg
x1 = 0.8
Vs = 14.67 # in m**3
V1 = x1*Vs # in m**3/kg
A = 0.45 # in m**2
C1 = V1/A # in m/s
Q = 5 # kJ/s
C2 = 0
W = 0
Q_desh = W-H1 - C1**2/(2*1000)-Q+H2+C2**2/2 # in kJ/s
print "Rate of heat transfer = % 0.3f kJ/s " %Q_desh
# Note : The calculation in the book is not accurate