Untitled

 avatar
unknown
plain_text
5 months ago
1.8 kB
2
Indexable
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 23 21:13:00 2024

@author: Joshua
"""
from math import *
import pandas as pd

"""Givens"""
gamma = 55  # specific weight of fluid, lb/ft³
da = 4      # pipe diameter, inches
l = 180     # pipe length, feet
PA = 4      # pressure at point A, psi
hf = 0.25   # friction factor
hl_p = 1    # minor loss factor for pipe
elbow_num = 4  # number of elbows
Q = 400     # flow rate, gallons per minute
g = 32.2    # gravitational acceleration, ft/s²
z = 30      # elevation difference, feet
Q_ft = Q * (1 / 7.48) * (1 / 60)  # Convert GPM to ft³/s
PA_ft = PA * 144 / gamma          # Convert psi to feet of fluid

"""Solution"""
# Area of the pipe
A = pi * (da / (2 * 12))**2  # Convert diameter from inches to feet
#Conversion
Q_ft = Q * (1 / 7.48) * (1 / 60)  # Convert GPM to ft³/s
PA_ft = PA * 144 / gamma          # Convert psi to feet of fluid

results = []
for V_A in range(5, 16):

    # Friction head loss in the system
    hf_s = (hf / 12) * l  # Convert friction factor to feet of head loss

    # Minor losses from elbows
    hl_elbow = 0.9 * (V_A**2) / (2 * g)
    hm_elbow = elbow_num * hl_elbow + hl_p * (V_A**2 / (2 * g))

    # Total head loss
    hl = hf_s + hm_elbow

    # Energy Equation
    h_pump = (V_A**2 / (2 * g)) + z + hl - (PA_ft) - (V_A**2 / (2 * g))

    # Power Output
    W = Q_ft * gamma * h_pump  # Power in ft-lb/s

    # Horsepower
    hpw = W / 550  # Convert to horsepower

  # Store results
    results.append((V_A, W, hpw))

# Convert results to a DataFrame for better visualization
results_df = pd.DataFrame(results, columns=["V_A (ft/s)", "Power Output (ft*lb/s)", "Horsepower (hp)"])

# Display results
def display_results():
    print(results_df)

display_results()


Editor is loading...
Leave a Comment