## Question 1(c) ## Autograded Answer import numpy as np ## Question 1(c) ####### def calc_error (T): #Your code here # Data from steam table T = 220 # temperature in degrees Celsius Psat 373.7 # saturation pressure in kPa vg_data= 0.00368 # specific volume in m^3/kg # Constants R = 461.5 # J/kg-K, specific gas constant for steam Tcrit = 647.3 #K, critical temperature of steam # Coefficients for Affandi equation a = -7.20694 b=1.44318 c = -1.01348 d = 0.18748 e = -0.01650 ## Write code here to print out values of error for each temperature in csv table # Function to calculate saturation pressure def saturation_pressure (T): # Constants for Antoine equation for vapor pressure of water A 8.07131 B 1730.63 C = 233.426 = #Vapor pressure in kPa P= np.exp(A - B / (T + C)) P = 1000 # convert kPa to Pa return P # Function to calculate specific volume using ideal gas equation def specific_volume_ideal_gas (T): P = saturation_pressure (T) #saturation pressure in Pa Tsat = T + 273.15 # saturation temperature in K vg = = R + Tsat / P # specific volume in m^3/kg return vg # Function to calculate specific volume using Affandi equation def specific_volume_Affandi (T): Tr= T / Tcrit # reduced saturation temperature 1n_vg = a + b (np.log(1/ Tr))** 0.4+ c/ Tr* 2 + d / Tr** 4+e / Tr 5 vg = np.exp(1n_vg) # specific volume in m^3/kg return vg # Calculate specific volumes and percentage error vg_ideal_gas = specific_volume_ideal_gas (T) vg_Affandi = specific_volume_Affandi (T) error_ideal_gas = 100 abs (vg_data - vg_ideal_gas) / vg_data error_Affandi = 100 abs (vg_data - vg_Affandi) / vg_data #Print results

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
How can I get the final answer?
7]: ## Question 1(c)
## Autograded Answer
import numpy as np
## Question 1(c) ######
def calc_error (T):
# Your code here
# Data from steam table
T= 220 #temperature in degrees Celsius
Psat = 373.7 #saturation pressure in kPa
vg_data= 0.00368 # specific volume in m^3/kg
# Constants
R = 461.5 # J/kg-K, specific gas constant for steam
Tcrit 647.3 #K, critical temperature of steam
# Coefficients for Affandi equation
a = -7.20694
b=1.44318
c = -1.01348
d = 0.18748
e-0.01650
## Write code here to print out values of error for each temperature in csv table
#Function to calculate saturation pressure
def saturation_pressure (T):
# Constants for Antoine equation for vapor pressure of water
A 8.07131
B 1730.63
C = 233.426
#Vapor pressure in kPa
Pnp.exp(A - B / (T + C))
P *= 1000 #convert kPa to Pa
return P
#Function to calculate specific volume using ideal gas equation
def specific_volume_ideal_gas (T):
P = saturation_pressure (T) # saturation pressure in Pa
Tsat T + 273.15 #saturation temperature in K
vg RTsat / P # specific volume in m^3/kg
return vg
#Function to calculate specific volume using Affandi equation
def specific_volume_Affandi (T):
Tr= T / Tcrit # reduced saturation temperature
1n_vg = a + b
**
(np.log (1 / Tr))** 0.4+ c/ Tr** 2 + d / Tr** 4+ e / Tr 5
np.exp(1n_vg) # specific volume in m^3/kg
vg =
return vg
# Calculate specific volumes and percentage error
vg_ideal_gas = specific_volume_ideal_gas (T)
vg_Affandi specific_volume_Affandi (T)
=
error_ideal_gas= 100 abs (vg_data - vg_ideal_gas) / vg_data
error_Affandi = 100 abs (vg_data - vg_Affandi) / vg_data
#Print results
Transcribed Image Text:7]: ## Question 1(c) ## Autograded Answer import numpy as np ## Question 1(c) ###### def calc_error (T): # Your code here # Data from steam table T= 220 #temperature in degrees Celsius Psat = 373.7 #saturation pressure in kPa vg_data= 0.00368 # specific volume in m^3/kg # Constants R = 461.5 # J/kg-K, specific gas constant for steam Tcrit 647.3 #K, critical temperature of steam # Coefficients for Affandi equation a = -7.20694 b=1.44318 c = -1.01348 d = 0.18748 e-0.01650 ## Write code here to print out values of error for each temperature in csv table #Function to calculate saturation pressure def saturation_pressure (T): # Constants for Antoine equation for vapor pressure of water A 8.07131 B 1730.63 C = 233.426 #Vapor pressure in kPa Pnp.exp(A - B / (T + C)) P *= 1000 #convert kPa to Pa return P #Function to calculate specific volume using ideal gas equation def specific_volume_ideal_gas (T): P = saturation_pressure (T) # saturation pressure in Pa Tsat T + 273.15 #saturation temperature in K vg RTsat / P # specific volume in m^3/kg return vg #Function to calculate specific volume using Affandi equation def specific_volume_Affandi (T): Tr= T / Tcrit # reduced saturation temperature 1n_vg = a + b ** (np.log (1 / Tr))** 0.4+ c/ Tr** 2 + d / Tr** 4+ e / Tr 5 np.exp(1n_vg) # specific volume in m^3/kg vg = return vg # Calculate specific volumes and percentage error vg_ideal_gas = specific_volume_ideal_gas (T) vg_Affandi specific_volume_Affandi (T) = error_ideal_gas= 100 abs (vg_data - vg_ideal_gas) / vg_data error_Affandi = 100 abs (vg_data - vg_Affandi) / vg_data #Print results
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY