You have analyzed a pipe network with sprinklers in homework 6. Modify your program, appropriately, to analyze the pipe network below and output a nicely formatted report for the: i) flow rate and...

Attached file has code with missing code that needs to be filled out according to the problem


You have analyzed a pipe network with sprinklers in homework 6. Modify your program, appropriately, to analyze the pipe network below and output a nicely formatted report for the: i) flow rate and direction in each pipe, ii) the head loss in each pipe (in inches of water), and iii) the pressure at each node in psi with the knowledge that the node h pressure is 80 psi. Notes: 1. The 12” and 16” pipes are cast iron (roughness = 0.00085 ft) while the 18” and 24” pipes are concrete (roughness = 0.003 ft). 2. Minor losses may be ignored. 3. cfs stands for cubic feet per second. 4. Room temperature water is the fluid (μ=20.50×10-6 lb⋅s/ft2, γ=62.3 lb/ft3). 5. You must use object orient programming to accomplish the requirements of this problem. My output looks like: The flow in segment a-b is 3.57 (cfs) and Re=286475.8 The flow in segment a-h is -3.57 (cfs) and Re=214856.8 The flow in segment b-c is 2.57 (cfs) and Re=205762.6 The flow in segment b-e is 1.01 (cfs) and Re=90802.3 The flow in segment c-d is 0.53 (cfs) and Re=42434.3 The flow in segment c-f is 2.04 (cfs) and Re=183744.4 The flow in segment d-g is -1.47 (cfs) and Re=132658.6 The flow in segment e-f is 1.46 (cfs) and Re=175422.0 The flow in segment e-i is -3.45 (cfs) and Re=276764.5 The flow in segment f-g is -1.50 (cfs) and Re=180909.5 The flow in segment g-j is -2.97 (cfs) and Re=238525.1 The flow in segment h-i is 6.43 (cfs) and Re=386467.2 The flow in segment i-j is 2.97 (cfs) and Re=178893.9 Check node flows: net flow into node a is 0.00 (cfs) net flow into node b is 0.00 (cfs) net flow into node h is 0.00 (cfs) net flow into node c is -0.00 (cfs) net flow into node e is 0.00 (cfs) net flow into node d is -0.00 (cfs) net flow into node f is 0.00 (cfs) net flow into node g is 0.00 (cfs) net flow into node i is -0.00 (cfs) net flow into node j is 0.00 (cfs) Check loop head loss: head loss for loop A is 0.00 (psi) head loss for loop B is -0.00 (psi) head loss for loop C is 0.00 (psi) head loss for loop D is -0.00 (psi) head loss in pipe a-b (L=1000.00 in, d=18.00 in) is 12.22 in of water head loss in pipe a-h (L=1600.00 in, d=24.00 in) is 4.39 in of water head loss in pipe b-c (L=500.00 in, d=18.00 in) is 3.18 in of water head loss in pipe b-e (L=800.00 in, d=16.00 in) is 1.23 in of water head loss in pipe c-d (L=500.00 in, d=18.00 in) is 0.15 in of water head loss in pipe c-f (L=800.00 in, d=16.00 in) is 4.67 in of water head loss in pipe d-g (L=800.00 in, d=16.00 in) is 2.51 in of water head loss in pipe e-f (L=500.00 in, d=12.00 in) is 6.63 in of water head loss in pipe e-i (L=800.00 in, d=18.00 in) is 9.13 in of water head loss in pipe f-g (L=500.00 in, d=12.00 in) is 7.03 in of water head loss in pipe g-j (L=800.00 in, d=18.00 in) is 6.81 in of water head loss in pipe h-i (L=1000.00 in, d=24.00 in) is 8.70 in of water head loss in pipe i-j (L=1000.00 in, d=24.00 in) is 1.92 in of water Pressure at node a = 79.84 psi Pressure at node b = 79.40 psi Pressure at node h = 80.00 psi Pressure at node c = 79.29 psi Pressure at node e = 79.36 psi Pressure at node d = 79.28 psi Pressure at node f = 79.12 psi Pressure at node g = 79.37 psi Pressure at node i = 79.69 psi Pressure at node j = 79.62 psi Given code: # region imports import numpy as np import math from scipy.optimize import fsolve import random as rnd # endregion # region class definitions class UC(): # a units conversion class def __init__(self): """ This unit converter class is useful for the pipe network and perhaps other problems. The strategy is (number in current units)*(conversion factor)=(number desired units), for instance: 1(ft)*(self.ft_to_m) = 1/3.28084 (m) 1(in^2)*(self.in2_to_m2) = 1*(1/(12*3.28084))**2 (m^2) """ ft_to_m = 1 / 3.28084 ft2_to_m2 = ft_to_m ** 2 ft3_to_m3 = ft_to_m ** 3 ft3_to_L = ft3_to_m3 * 1000 L_to_ft3 = 1 / ft3_to_L in_to_m = ft_to_m / 12 m_to_in = 1 / in_to_m in2_to_m2 = in_to_m ** 2 m2_to_in2 = 1 / in2_to_m2 g_SI = 9.80665 # m/s^2 g_EN = 32.174 # 32.174 ft/s^2 gc_EN = 32.174 # lbm*ft/lbf*s^2 gc_SI = 1.0 # kg*m/N*s^2 lbf_to_kg = 1 / 2.20462 lbf_to_N = lbf_to_kg * g_SI pa_to_psi = (1 / (lbf_to_N)) * in2_to_m2 @classmethod # this notation allows this method to be directly used from the class by UC.viscosityEnglishToSI def viscosityEnglishToSI(cls, mu, toSI=True): """ Converts between lb*s/ft^2 and Pa*s :param mu: the viscosity in english units :param toSI: True assumes english in, False assumes SI in :return: the viscosity in Pa*s if toSI=True, lb*s/ft^2 if toSI=False """ #(lb*s)/ft^2*((3.3 ft/m)^2)*(1kg/2.2lb)*(9.81m/s^2)->(Pa*s) cf=(1/cls.ft2_to_m2)*(cls.lbf_to_kg)*cls.g_SI return mu*cf if toSI else mu/cf @classmethod def densityEnglishToSI(cls, rho, toSI=True ): """ Converts between lb/ft^3 and kg/m^3 :param rho: specific weight or density :param toSI: True assumes english in, False assumes SI in :return: density in SI or EN """ #(lb/ft^3)*((3.3ft/m)^3)*(1kg/2.2lb) -> kg/m^3 cf=cls.lbf_to_kg/cls.ft3_to_m3 return rho*cf if toSI else rho/cf @classmethod def head_to_pressure(cls, h, rho, SI=True): """ Convert from height of column of fluid to pressure in consistent units :param h: head in height of fluid (in or m) :return: pressure in (psi or Pa) """ if SI: # p = rho*g*h = g*cf cf=rho*cls.g_SI/cls.gc_SI # kg*m/m^3*s^2 return h*cf else: # p = rho*g*h = g*cf (h in in) cf = rho*cls.g_EN/cls.gc_EN*(1/12)**2 # (lbm*ft/ft^3*s^2)(lbf*s^2/lbm*ft)(ft^2/in^2) return h*cf #convert m of water to psi #(m)*(3.3*12in/m)*rho(kg/m^3)*(2.2lb/kg)*(1m/(3.3*12in))^3 psi=p*cls.rho*2.2/((3.3*12)**2) return psi @classmethod def m_to_psi(cls, h, rho): """ For converting from height of fluid to psi :param h: height of fluid in m :param rho: density of fluid in kg/m^3 :return: pressure in psi """ return cls.head_to_pressure(h,rho)*cls.pa_to_psi @classmethod def psi_to_m(cls, p, rho): """ For converting from psi to height of fluid. first convert psi to pa :param p: pressure in psi :param rho: density of fluid in kg/m^3 :return: height of fluid in m """ pa=p/cls.pa_to_psi h= pa/(rho*cls.g_SI) return h class Fluid(): def __init__(self, mu=0.00089, rho=1000, SI=True): ''' default properties are for water in the SI system :param mu: dynamic viscosity in Pa*s -> (kg*m/s^2)*(s/m^2) -> kg/(m*s) or (lb*s/ft^2) :param rho: density in kg/m^3 or (lb/ft^3) :param SI: tells constructor if unit conversion is needed from english to si if SI==False ''' self.mu= mu if SI==True else UC.viscosityEnglishToSI(mu) self.rho= rho if SI==True else UC.densityEnglishToSI(rho) self.nu= self.mu/self.rho # calculate the kinematic viscosity in units of m^2/s class Node(): def __init__(self, Name='a', Pipes=[], ExtFlow=0): ''' A node in a pipe network. :param Name: name of the node :param Pipes: a list/array of pipes objects connected to this node :param ExtFlow: any external flow into (+) or out (-) of this node in L/s ''' self.name = Name self.pipes = Pipes self.extFlow = ExtFlow self.QNet=0 self.P = 0 # the pressure head at the node in m of fluid self.oCalculated=False def getNetFlowRate(self): ''' Calculates the net flow rate into this node in L/s # :return: the net flow rate into this node ''' Qtot = self.extFlow #count the external flow first for p in self.pipes: #retrieves the pipe flow rate (+) if into node (-) if out of node. see class for pipe. Qtot += p.getFlowIntoNode(self.name) self.QNet=Qtot return self.QNet def setExtFlow(self, E, SI=True): """ Sets the external flow rate for the node. SI=False causes a conversion from ft^3/s to L/s :param E: External (volumetric) flow rate :param SI: boolean, False means units for E are in ft^3/s. True means L/s :return: nothing """ self.extFlow=E if SI else E*UC.ft3_to_L class Loop(): def __init__(self, Name='A', Pipes=[]): ''' Defines a loop in a pipe network.
Mar 23, 2023
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here