Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We are using Python When your program is run, it should print the following (natching the number of decinal places for the values) Name: Turbine

image text in transcribedimage text in transcribed

image text in transcribed

We are using Python

When your program is run, it should print the following (natching the number of decinal places for the values) Name: Turbine Inlet Region: saturated p 7350.00 kPa T 289.1 degrees C h 2619.54 kJ/kg s5.5262 kJ/kg K v 0.023507 m 3/kg x = 0.9000 2619.5353753709596 5.526158880004161 Name: Turbine Exit Region: saturated p 100.00 kPa T-99.6 degrees C h = 1991.68 kJ/kg s 5.5262 kJ/(kg K) v 1.184378 mA3/kg x = 0.6974 Name: State 3 Region: saturated p 8575.00 kPa T 299.9 degrees C h 2050.00 kJ/kg s 4.4855 kJ/kg K) v = 0.011 599 m13/kg x = 0.5022 Name: State 4 Region: superheated p 8900.00 kPa T-nan degrees C h 41250.00 kJ/kg s = nan kJ/(kg K) In Thermo I, you studied the Rankine Cycle for power generation. Our BrightSpace site contains a substantial amount of review material for the Rankine Cycle A core capability for performing calculations with the Rankine Cycle is the ability to determine the properties of STEAM, at the states. In Thermo I, you learned how to use the steam tables in your textbook, and learned how to interpolate between the lines in the table For this assignment, you will define a Python Class named Steam. The attributes and methods are defined below. The behavior of this class will be demonstrated with an example main program that uses the class The class named Steam has 8 attributes, an three methods:init defined below: calc, and print, as import numpy as np from scipy.interpolate import griddata class Steam def init self.p pressure # pressure-kPa self.T = T # Temperature-degrees C self.x-x # quality (a value between 0 and 1) selfv v # specific volume-m"3/kg selfh h # enthalpy _ kJ/kg selfs s # entropy-kJ/(kg K) self.name-name # a useful identifier selfregion None # superheated' or 'saturated' if T=-None and x==None and v==None and h=-None and s==None: return self.calc0 (self pressure. T=None. h=None. s=None. x=None. v=None, name=None) def calc(sel.): # calculate the "missing" steam properties using griddata() and the steam tables given earlier. IMPORTANT: a)look carefully at the PRESSURE units in the two tables. They are DIFFERENT. b) Beware of the GAP IN THE DATA problem! derprint(sel): # print the available (not None) Steam values Note: calc(self) should "raise errors" if asked to do things in cannot handle such as raise ValueEror(Error this function cannot operate in the sub-cooled region) raise ValueError(Not enough properties specified) def main inlet=Steam (7350, name=' Turbine Inlet') inlet . x-0.9 # 90 percent quality -accessed inlet.print () inlet. calc() print (hl,s1, n') outlet Steam (100, s-inlet.s, nameTurbine Exit') outlet.print () #notice- s inlet. S another Steam (8575, h 2050, name State 3) another.print () yetanother-steam (8900, h41250, nameState 4') yetanother.print ) #un commenting the next to lines will cause a ValueError error #fina 11 Steam (7000, T-250, name 'State 5') #fina 11. print ( ) ifname main ) main When your program is run, it should print the following (natching the number of decinal places for the values) Name: Turbine Inlet Region: saturated p 7350.00 kPa T 289.1 degrees C h 2619.54 kJ/kg s5.5262 kJ/kg K v 0.023507 m 3/kg x = 0.9000 2619.5353753709596 5.526158880004161 Name: Turbine Exit Region: saturated p 100.00 kPa T-99.6 degrees C h = 1991.68 kJ/kg s 5.5262 kJ/(kg K) v 1.184378 mA3/kg x = 0.6974 Name: State 3 Region: saturated p 8575.00 kPa T 299.9 degrees C h 2050.00 kJ/kg s 4.4855 kJ/kg K) v = 0.011 599 m13/kg x = 0.5022 Name: State 4 Region: superheated p 8900.00 kPa T-nan degrees C h 41250.00 kJ/kg s = nan kJ/(kg K) In Thermo I, you studied the Rankine Cycle for power generation. Our BrightSpace site contains a substantial amount of review material for the Rankine Cycle A core capability for performing calculations with the Rankine Cycle is the ability to determine the properties of STEAM, at the states. In Thermo I, you learned how to use the steam tables in your textbook, and learned how to interpolate between the lines in the table For this assignment, you will define a Python Class named Steam. The attributes and methods are defined below. The behavior of this class will be demonstrated with an example main program that uses the class The class named Steam has 8 attributes, an three methods:init defined below: calc, and print, as import numpy as np from scipy.interpolate import griddata class Steam def init self.p pressure # pressure-kPa self.T = T # Temperature-degrees C self.x-x # quality (a value between 0 and 1) selfv v # specific volume-m"3/kg selfh h # enthalpy _ kJ/kg selfs s # entropy-kJ/(kg K) self.name-name # a useful identifier selfregion None # superheated' or 'saturated' if T=-None and x==None and v==None and h=-None and s==None: return self.calc0 (self pressure. T=None. h=None. s=None. x=None. v=None, name=None) def calc(sel.): # calculate the "missing" steam properties using griddata() and the steam tables given earlier. IMPORTANT: a)look carefully at the PRESSURE units in the two tables. They are DIFFERENT. b) Beware of the GAP IN THE DATA problem! derprint(sel): # print the available (not None) Steam values Note: calc(self) should "raise errors" if asked to do things in cannot handle such as raise ValueEror(Error this function cannot operate in the sub-cooled region) raise ValueError(Not enough properties specified) def main inlet=Steam (7350, name=' Turbine Inlet') inlet . x-0.9 # 90 percent quality -accessed inlet.print () inlet. calc() print (hl,s1, n') outlet Steam (100, s-inlet.s, nameTurbine Exit') outlet.print () #notice- s inlet. S another Steam (8575, h 2050, name State 3) another.print () yetanother-steam (8900, h41250, nameState 4') yetanother.print ) #un commenting the next to lines will cause a ValueError error #fina 11 Steam (7000, T-250, name 'State 5') #fina 11. print ( ) ifname 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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions