<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 A Reheat–Regenerative Cycle with Two Feedwater Heaters
Michael J . Mora. Fundamentals of Engineering Thermodynamics (7th Edition).  John Wiley & Sons, Inc. 2011
Chapter 8 vapor Power System
Step1:  The schematic diagram of the cycle is labeled with the fractions of the total flow into the turbine that remain
at various locations. The fractions of the total flow diverted to the closed heater and open heater, respectively,
are $y^{'}=\frac{\dot{m}_2}{\dot{m}_1}$ and $y^{"}=\frac{\dot{m}_5}{\dot{m}_1}$, where $\dot{m}_1$ denotes the mass flow rate entering the first turbine.
The fraction $y^{'}$  can be determined by application of mass and energy rate balances to a control volume enclosing the closed heater. The result is
$y^{'}=\frac{h_{11}-h_{10}}{h_2-h_{12}}$
The fraction $y^{"}$ can be determined by application of mass and energy rate balances to a control volume enclosing
the open heater, resulting in
$0=y^{"}h_5+(1-y^{'}-y^{"})h_8+ y^{'}h_{13}-h_9$
Solving for $y^{"}$
$y^{"}=\frac{(1-y^{'})h_8+ y^{'}h_{13}-h_9}{h_8-h_5}$
Step2:  SOLUTION
(a) The following work and heat transfer values are expressed on the basis of a unit mass entering the first turbine. 
The work developed by the first turbine per unit of mass entering is the sum
$\frac{\dot{W}_{t1}}{\dot{m}_1}=(h_1-h_2)+(1-y^{'})(h_2-h_3)$
Similarly, for the second turbine
$\frac{\dot{W}_{t2}}{\dot{m}_1}=(1-y^{'})(h_4-h_5)+(1-y^{'}-y^{"})(h_5-h_6)$
For the first pump
$\frac{\dot{W}_{p1}}{\dot{m}_1}=(1-y^{'}-y^{"})(h_8-h_7)$
and for the second pump
$\frac{\dot{W}{p2}}{\dot{m}_1}=(h{10}-h_9)$
The total heat added is the sum of the energy added by heat transfer during boiling/superheating and reheating. When expressed on the basis of a unit of mass entering the first turbine, this is
$\frac{\dot{Q}{in}}{\dot{m}_1}=(h_1-h{11})+(1-y^{'})(h_4-h_3)$
With the foregoing values, the thermal efficiency is
$\eta =\frac{\dot{W}{t1}/\dot{m}_1+\dot{W}{t2}/\dot{m}1-\dot{W}{p1}/\dot{m}1-\dot{W}{p2}/\dot{m}1}{\dot{Q}{in}/\dot{m}_1}$
Step3:  (b) The mass flow rate entering the first turbine can be determined using the given value of the net power output. Thus
$m_1=\frac{W_{cycle}}{W_{t1}/m_1+W_{t2}/m_1-W_{p1}/m_1-W_{p2}/m_1}$
<ASSISTANT_TASK:>
Python Code:
# determine the specific enthalpies at the principal states of the cycle. 
import seuif97 as if97
# State 1 is superheated vapor at 8MPa, 480C.
p1=8
t1=480
h1 = if97.pt2h(p1,t1)
s1 =if97.pt2s(p1,t1)   
print(h1,s1)
# State 2 is fixed by p2 =2.0MPa and the specific entropy s2, which is the same as that of state 1
p2=2.0
s2=s1
h2 = if97.ps2h(p2,s2)        
t2=if97.ps2t(p2,s2) 
print(h2,t2)
# State 3  is fixed by p2 =0.7MPa and the specific entropy s2, which is the same as that of state 1
p3=0.7
s3=s1
h3 = if97.ps2h(p3,s3)
t3=if97.ps2t(p3,s3) 
print(h3,t3)   
# State 4 is superheated vapor at 0.7 MPa, 440C.
p4=0.7
t4=440
h4 = if97.pt2h(p4,t4)                                                                      # in kj/kg
s4 =if97.pt2s(p4,t4)   
print(h4,s4)
# State 5 : p5 =0.3MPa and s5 = s4
p5=0.3
s5=s4
h5 =if97.ps2h(p5,s5)  
t5=if97.ps2t(p5,s5)
print(h5,t5) 
# State 6: p6=0.008MPA, s6= s4
p6=0.008
s6=s4
h6 =if97.ps2h(p6,s6)
t6 =if97.ps2t(p6,s6) 
print(h6,t6) 
# State 7 : p7=0.008MP Saturated water at the condenser exit
p7=0.008
t7=if97.px2t(p7,0)
h7=if97.px2h(p7,0)
s7=if97.px2s(p7,0)
v7=if97.px2v(p7,0)
print(t7,h7,s7,v7) 
# State 8 : p8=0.3MP at the exit of the first pump 
p8=0.3
s8=s7
h8=if97.ps2h(p8,s8)
t8=if97.ps2t(p8,s8)
print(h8,t8)
# state 9 : The liquid leaving the open feedwater heater at is saturated liquid at 0.3 MPa
p9=0.3
t9=if97.px2t(p9,0)
h9=if97.px2h(p9,0) 
s9=if97.px2s(p9,0)
print(t9,h9,s9) 
# State 10 p=8.0Mpa, at the exit of the second pump,
p10=8.0
s10=s9
h10 =if97.ps2h(p10,s10)
t10 =if97.ps2t(p10,s10) 
print(h10,t10) 
# State 11: the feedwater exiting the closed heater
p11=8.0
t11=205
h11 = if97.pt2h(p11,t11)                                                                      # in kj/kg
s11 =if97.pt2s(p11,t11)  
print(h11,s11) 
# State 12: the condensate leaving the closed heater is saturated at 2 MPa.
p12=2.0
t12=if97.px2t(p12,0)
h12=if97.px2h(p12,0)
s12=if97.px2s(p12,0)
print(t12,h12,s12)
# State 13:  the fluid passing through the trap undergoes a throttling process
p13=0.3
h13=h12
s13=if97.ph2s(p13,h13)
t13=if97.ph2t(p13,h13)
print(s13,t13)
Explanation: A Reheat–Regenerative Cycle with Two Feedwater Heaters
Michael J . Mora. Fundamentals of Engineering Thermodynamics (7th Edition).  John Wiley & Sons, Inc. 2011
Chapter 8 vapor Power System: (Page 460-463)
Example 8.6 : Considering a Reheat–Regenerative Cycle with Two Feedwater Heaters, a closed feedwater heater and an an
open feedwater heater.
Steam enters the first turbine at 8.0 MPa, 480°C and expands to 0.7 MPa. 
The steam is reheated to 440°C before entering the second turbine, where it expands to the condenser pressure of 0.008 MPa.
Steam is extracted from the first turbine at 2 MPa and fed to the closed feedwater heater. 
Feedwater leaves the closed heater at 205°C and 8.0 MPa, and condensate exits as saturated liquid at 2 MPa. 
The condensate is trapped into the open feedwater heater. 
Steam extracted from the second turbine at 0.3 MPa is also fed into the open feedwater heater, which operates at 0.3 MPa. The stream exiting the open feedwater heater is saturated liquid at 0.3 MPa. 
The net power output of the cycle is 100 MW. 
There is no stray heat transfer from any component to its surroundings. 
If the working fluid experiences no irreversibilities as it passes through the turbines, pumps, steam generator, reheater, and condenser, 
SOLUTION
Known: A reheat–regenerative vapor power cycle operates with steam as the working fluid. Operating pressures
and temperatures are specified, and the net power output is given.
Find: Determine the thermal efficiency and the mass flow rate entering the first turbine, in kg/h.
  
Engineering Model:
Each component in the cycle is analyzed as a control volume at steady state. The control volumes are
shown on the accompanying sketch by dashed lines.
There is no stray heat transfer from any component to its surroundings.
The working fluid undergoes internally reversible processes as it passes through the turbines, pumps,
steam generator, reheater, and condenser.
The expansion through the trap is a throttling process.
Kinetic and potential energy effects are negligible.
Condensate exits the closed heater as a saturated liquid at 2 MPa. Feedwater exits the open heater as a saturated liquid at 0.3 MPa. Condensate exits the condenser as a saturated liquid.
Analysis
Let us determine the specific enthalpies at the principal states of the cycle.
End of explanation
ydash = (h11-h10)/(h2-h12)                          # the fraction of the total flow diverted to the closed heater
ydashdash = ((1-ydash)*h8+ydash*h13-h9)/(h8-h5)     # the fraction of the total flow diverted to the open heater
print(ydash,ydashdash)
Explanation: The schematic diagram of the cycle is labeled with the fractions of the total flow into the turbine that remain
at various locations. The fractions of the total flow diverted to the closed heater and open heater, respectively,
are $y^{'}=\frac{\dot{m}_2}{\dot{m}_1}$ and $y^{"}=\frac{\dot{m}_5}{\dot{m}_1}$, where $\dot{m}_1$ denotes the mass flow rate entering the first turbine.
The fraction $y^{'}$  can be determined by application of mass and energy rate balances to a control volume enclosing the closed heater. The result is
$y^{'}=\frac{h_{11}-h_{10}}{h_2-h_{12}}$
The fraction $y^{"}$ can be determined by application of mass and energy rate balances to a control volume enclosing
the open heater, resulting in
$0=y^{"}h_5+(1-y^{'}-y^{"})h_8+ y^{'}h_{13}-h_9$
Solving for $y^{"}$
$y^{"}=\frac{(1-y^{'})h_8+ y^{'}h_{13}-h_9}{h_8-h_5}$
End of explanation
# Part(a)
wt1dot = (h1-h2) + (1-ydash)*(h2-h3)                       # The work developed by the first turbine per unit of mass entering in kj/kg
wt2dot = (1-ydash)*(h4-h5) + (1-ydash-ydashdash)*(h5-h6)   # The work developed by the second turbine per unit of mass in kj/kg
wp1dot = (1-ydash-ydashdash)*(h8-h7)                # The work for the first pump per unit of mass in kj/kg
wp2dot = h10-h9                                     # The work for the second pump per unit of mass in kj/kg
qindot = (h1-h11) + (1-ydash)*(h4-h3)  # The total heat added expressed on the basis of a unit of mass entering the first   turbine
eta = (wt1dot+wt2dot-wp1dot-wp2dot)/qindot  # thermal efficiency
# Result
print(' The thermal efficiency is {:>.2f}%'.format(100.0*eta))
Explanation: SOLUTION
(a) The following work and heat transfer values are expressed on the basis of a unit mass entering the first turbine. 
The work developed by the first turbine per unit of mass entering is the sum
$\frac{\dot{W}_{t1}}{\dot{m}_1}=(h_1-h_2)+(1-y^{'})(h_2-h_3)$
Similarly, for the second turbine
$\frac{\dot{W}_{t2}}{\dot{m}_1}=(1-y^{'})(h_4-h_5)+(1-y^{'}-y^{"})(h_5-h_6)$
For the first pump
$\frac{\dot{W}_{p1}}{\dot{m}_1}=(1-y^{'}-y^{"})(h_8-h_7)$
and for the second pump
$\frac{\dot{W}{p2}}{\dot{m}_1}=(h{10}-h_9)$
The total heat added is the sum of the energy added by heat transfer during boiling/superheating and reheating. When expressed on the basis of a unit of mass entering the first turbine, this is
$\frac{\dot{Q}{in}}{\dot{m}_1}=(h_1-h{11})+(1-y^{'})(h_4-h_3)$
With the foregoing values, the thermal efficiency is
$\eta =\frac{\dot{W}{t1}/\dot{m}_1+\dot{W}{t2}/\dot{m}1-\dot{W}{p1}/\dot{m}1-\dot{W}{p2}/\dot{m}1}{\dot{Q}{in}/\dot{m}_1}$
End of explanation
# Part(b)
Wcycledot = 100.0                                                               # the net power output of the cycle in MW
m1dot = (Wcycledot*3600*10**3)/(wt1dot+wt2dot-wp1dot-wp2dot)
# Result
print(' The mass flow rate of the steam entering the first turbine is {:>.2f}kg/h'.format(m1dot))
Explanation: (b) The mass flow rate entering the first turbine can be determined using the given value of the net power output. Thus
$m_1=\frac{W_{cycle}}{W_{t1}/m_1+W_{t2}/m_1-W_{p1}/m_1-W_{p2}/m_1}$
End of explanation
<END_TASK>