Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Expert please write the missing code solve with python language following each step. Thank from Steam import steam class rankine(): def __init__(self, p_low, p_high, t_high=None,

Expert please write the missing code solve with python language following each step. Thank 
from Steam import steam class rankine(): def __init__(self, p_low, p_high, t_high=None, name='Rankine Cycle'): ''' Constructor for the Rankine power cycle :param p_low: low pressure isobar (kPa) states 4&1 :param p_high: high pressure isobar (kPa) states 2&3 :param t_high: the highest temperature in the cycle (degrees C) state 1 :param name: a convenient name ''' #set the class property values self.p_low=p_low self.p_high=p_high self.t_high=t_high self.name=name #define more class properties self.efficiency=None self.turbine_work=0 self.pump_work=0 self.heat_added=0 self.state1=None #a steam object at t_high, p_high self.state2=None #a steam object at p_low, s_2 (s_2s) self.state3=None #a steam object at p_low, sat liq. self.state4=None #a steam object at p_high def calc_efficiency(self): #calculate the 4 states #state 1: turbine inlet (p_high, t_high) superheated or saturated vapor if(self.t_high==None): self.state1 = steam(p_high,name = 'turbine Inlet' ) #$MISSING CODE HERE$# #instantiate a steam object assuming saturated vapor at p_high, name='Turbine Inlet' else: #probably superheated self.state1= steam (p_high, t_high, name= "turbine Inlet")#$MISSING CODE HERE$# #instantiate a steam object at p_high, t_high, name='Turbine Inlet' #state 2: turbine exit (p_low, s=s_turbine inlet) two-phase self.state2=steam(p_high,s= s_turbine inlet)#$MISSING CODE HERE$# #instantiate a steam object #state 3: pump inlet (p_low, x=0) saturated liquid self.state3=steam(p_high, s)#$MISSING CODE HERE$# #instantiate a steam object #state 4: pump exit (p_high,s=s_pump_inlet) typically sub-cooled, but estimate as saturated liquid self.state4=float(griddata((pcol, scol), hcol, (p_high,s)))#$MISSING CODE HERE$# #instantiate a steam object #assume incompressible fluid, but h increases because of increase in p while v remains constant self.state4.h=self.state3.h+self.state3.v*(self.p_high-self.p_low) self.turbine_work= self.state1 - self.state2 #$MISSING CODE HERE$# self.pump_work= self.state4- self.state3 #$MISSING CODE HERE$# self.heat_added=self.state1- self.state4 #$MISSING CODE HERE$# self.efficiency=((self.turbine_work- self.pump_work)/self.heat_added)*100) #$MISSING CODE HERE$# return self.efficiency def print_summary(self): if self.efficiency==None: self.calc_efficiency() print('Cycle Summary for: ', self.name) print('\tEfficiency: {:0.3f}%'.format(self.efficiency)) print('\tTurbine Work: {:0.3f} kJ/kg'.format(self.turbine_work)) print('\tPump Work: {:0.3f} kJ/kg'.format(self.pump_work)) print('\tHeat Added: {:0.3f} kJ/kg'.format(self.heat_added)) self.state1.print() self.state2.print() self.state3.print() self.state4.print() def main(): rankine1=rankine(8,8000,t_high=500,name='Rankine Cycle - Superheated at turbine inlet') #t_high is specified #if t_high were not specified, then x_high = 1 is assumed eff=rankine1.calc_efficiency() print(eff) rankine1.state3.print() rankine1.print_summary() #hf=rankine1.state1.hf #hg=rankine1.state1.hg rankine2=rankine(8,8000, name='Rankine Cycle - Saturated at turbine inlet') eff2=rankine2.calc_efficiency() print(eff2) rankine2.print_summary() if __name__=="__main__": main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago