0% found this document useful (0 votes)
4 views10 pages

Python Mini Project Report Codesquad

The document is a project report for a Python mini-project titled 'Discharge Rate Calculator' developed by students of Mechanical Engineering. It details the project's objectives, methodology, and applications in fluid mechanics, along with the Python code used to create a Streamlit web application for calculating discharge rates. The report concludes that the application effectively demonstrates fluid dynamics principles and suggests future enhancements.

Uploaded by

joyen73066
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Python Mini Project Report Codesquad

The document is a project report for a Python mini-project titled 'Discharge Rate Calculator' developed by students of Mechanical Engineering. It details the project's objectives, methodology, and applications in fluid mechanics, along with the Python code used to create a Streamlit web application for calculating discharge rates. The report concludes that the application effectively demonstrates fluid dynamics principles and suggests future enhancements.

Uploaded by

joyen73066
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON MINI PROJECT REPORT

Project Title DISCHARGE RATE CALCULATOR

Course Name Semetser-3: Python Programming

Class Name Mechanical-3A

Branch Name Mechanical Engineering / Automation & Robotics

Patel Het Milankumar 23012251210003

Jeet Deepak Panchal 23012250610010

Prepared By Patil Mayank Rajendrabhai 23012250610033

Sanghavi Umang Kunjeshbhai 23012250610041

Patel Daksh Prakashbhai 23012250610028

Guided By Mr. MohammedAzim Shaikh

Department of Mechanical Engineering,


Submitted to LJ Polytechnic,
Lok Jagruti Kendra University,
Ahmedabad, Gujarat, India.
CERTIFICATE

This certificate is proudly presented to the following students for successfully completing

the Python Mini-Project entitled “DISCHARGE RATE CALCULATOR” as part of their

Diploma in Mechanical Engineering curriculum. This project work has been carried out

under my guidance and supervision and it is up to my satisfaction.

Name of Students Enrolment Number Class


Automation &
Patel Het Milankumar 23012251210003
Robotics -3A
Jeet Deepak Panchal 23012250610010 Mechanical-3A

Patil Mayank Rajendrabhai 23012250610033 Mechanical-3A

Sanghavi Umang Kunjeshbhai 23012250610041 Mechanical-3A

Patel Daksh Prakashbhai 23012250610028 Mechanical-3A

Date: 30 September 2024 Name & Signature of Guide

Place: Ahmedabad Mr. MohammedAzim Shaikh

Page 2 of 10
TABLE OF CONTENTS

CERTIFICATE .................................................................................................................... 2

TABLE OF CONTENTS .................................................................................................... 3

1. INTRODUCTION ........................................................................................................... 4

2. OBJECTIVE .................................................................................................................... 4

3. METHODOLOGY .......................................................................................................... 4

4. MECHANICAL ENGINEERING APPLICATION .................................................... 4

5. PYTHON CODE .............................................................................................................. 5

6. SCREENSHOTS .............................................................................................................. 8

7. RESULTS AND DISCUSSIONS .................................................................................... 9

8. CONCLUSION ................................................................................................................ 9

9. REFERENCES................................................................................................................. 9

10. COURSE CERTIFICATES ........................................................................................ 10

Page 3 of 10
1. INTRODUCTION

Fluid mechanics is a branch of physics that studies the behavior of fluids (liquids and gases)
at rest and in motion. One of the critical aspects of fluid mechanics is understanding flow
rates, which are essential for designing systems in various engineering applications. This
project focuses on calculating the discharge rate through different diameters of a pipe using
a computational approach via a Streamlit web application.

2. OBJECTIVE

 Develop a user-friendly web application for discharge rate calculation.

 Use Streamlit and Python to create an interactive interface.

3. METHODOLOGY

 Programing Language: Python

 Framework: Streamlit

 Libraries:

 math: For mathematical calculations.

 PIL: For handling images.

4. MECHANICAL ENGINEERING APPLICATION

The calculation of discharge rates has numerous applications in mechanical engineering,


including:

 Design and analysis of piping systems in industrial processes.

 Assessing the performance of hydraulic machinery like pumps and turbines.

 Evaluating flow measurements in various engineering contexts such as water


treatment plants, irrigation systems, and HVAC systems.

Page 4 of 10
5. PYTHON CODE

[Link]

import streamlit as st
import math
from PIL import Image

st.set_page_config(page_title="Discharge Rate Calculation",


page_icon=":bar_chart:", layout="wide")

[Link]("""
<style>
body {
background-image: url('[Link]'); /* Use a relative
path */
background-size: cover;
background-attachment: fixed;
background-position: center;
margin: 0;
}
.main {
background-color: rgba(255, 255, 255, 0.8);
color: #333;
}
.header {
background-color: rgba(240, 237, 229, 0.9);
padding: 10px;
border-radius: 10px;
text-align: center;
color: #3C3C3C;
}
.footer {
background-color: rgba(240, 237, 229, 0.9);
color: #333;
padding: 10px;
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
border-top: 1px solid #DDD;
}
</style>
""", unsafe_allow_html=True)

[Link]("<h1 class='header'>Discharge Rate Calculation</h1>",


unsafe_allow_html=True)

col1, col2 = [Link](2)

with col1:
d1 = st.number_input("Diameter 1 (mm):", value=1.0, format="%.2f")
/ 1000

with col2:
d2 = st.number_input("Diameter 2 (mm):", value=1.0, format="%.2f")
/ 1000

Page 5 of 10
h = [Link]("Head (m):", min_value=0.1, max_value=50.0, value=0.1,
format="%.2f")

pi = [Link]
pi2 = pi / 4
A1 = (d1 ** 2)
a1 = pi2 * A1
A2 = (d2 ** 2)
a2 = pi2 * A2
cd = 0.66
g = 9.81
v = (2 * g * h)
V = v ** (1 / 2)
q1 = cd * A1 * A2 * V
p1 = (A1 ** 2)
p2 = (A2 ** 2)
d = (p1 - p2)
q2 = d ** (1 / 2)
flag = False

if d1 == d2:
[Link]("Diameter of both sections can never be the same!")
elif d1 < d2:
[Link]("Diameter-1 cannot be smaller than Diameter-2!")
elif q2 == 0 or q1 == 0 or h == 0:
[Link]("Diameter 2 cannot be zero")
else:
Q = q1 / q2
flag = True

def format_value(value):
if value < 0.01:
exponent = int([Link](math.log10(abs(value))))
mantissa = value / (10 ** exponent)
return f"{mantissa:.2f} \\times 10^{{{exponent}}}"
else:
return f"{value:.2f}"

if flag:
formatted_value = format_value(Q)
[Link](rf"Discharge Rate (Q): {formatted_value}\,
\text{{m}}^3/\text{{s}}")

[Link]('Discharge Rate Formula')


[Link](r'''
Q_{th} = C_d \cdot a_1 \cdot a_2 \cdot
\left\{\frac{\sqrt{2gh}}{\sqrt{a_1^2 - a_2^2}}\right\}
''')

[Link]("### Where,")
[Link](r'''
Q_{th} = \text{Discharge measurement}
''')
[Link](r'''
a_1 = \text{Area of pipe}
''')
[Link](r'''
a_2 = \text{Area of throat}

Page 6 of 10
''')
[Link](r'''
h = \text{Pressure head}
''')
[Link](r'''
C_d = 0.66 \, \text{(Discharge coefficient)}
''')
[Link](r'''
g = 9.81 \, \text{m/s}^2 \, \text{(Acceleration due to gravity)}
''')

[Link]('Venturimeter Used to Measure Flow Rate')

images = [
("Venturi [Link]", "Venturi meter"),
("[Link]", "Diameter 1"),
("[Link]", "Diameter 2 (throat)"),
("[Link]", "U-tube manometer"),
]

cols = [Link](2)

for i, (img_path, title) in enumerate(images):


with cols[i % 2]:
[Link](f"### {title}")
[Link](img_path)

[Link]("<h1 style='text-align: center;'>THANK YOU</h1>",


unsafe_allow_html=True)

[Link]("""
<style>
@import
url('[Link]
wap');
.footer {
background: linear-gradient(to right, #ffffff, #e3e3e3,
#ffffff);
color: #333;
padding: 15px;
text-align: center;
border-top: 1px solid #DDD;
margin-top: 20px;
width: 100%;
box-sizing: border-box;
position: relative;
font-family: 'Roboto', sans-serif;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
}
</style>
<div class='footer'>
<p>By,</p><p> Het Patel, Mayank Patil, Umang Sanghavi, Jeet
Panchal, Daksh Patel</p>
</div>
""", unsafe_allow_html=True)

Page 7 of 10
6. SCREENSHOTS

Page 8 of 10
7. RESULTS AND DISCUSSIONS

Upon testing various inputs, the application accurately calculates the discharge rates based
on the specified diameters and head. The results indicate that as the diameter increases, the
discharge rate also increases, illustrating the fundamental principles of fluid mechanics.

8. CONCLUSION

The project successfully developed a Streamlit application to calculate discharge rates in


fluid mechanics. It not only serves as a practical tool for students and engineers but also
enhances understanding of fluid dynamics concepts. Future work could involve expanding
the application to include different fluid types and flow conditions.

9. REFERENCES

 Khorasani, M., Abdou, M., & Fernández, J. H. (2022). Streamlit use cases. In Apress
eBooks (pp. 309–361).

 Lutz, M., & Ascher, D. (2003). Learning Python. O’Reilly Media, Inc.

 Mandal, D. K. (2015). Fluid mechanics and hydraulic machines.

 Willis, K. D. D., Pu, Y., Luo, J., Chu, H., Du, T., Lambourne, J. G., Solar-Lezama,
A., & Matusik, W. (2021). Fusion 360 gallery. ACM Transactions on Graphics,
40(4), 1–24.

Page 9 of 10
10. COURSE CERTIFICATES

Page 10 of 10

You might also like