0% found this document useful (0 votes)
36 views13 pages

Python (1) Merged

The document describes three Python programming problems related to civil engineering applications. The first problem involves calculating the number of rails, sleepers, and fish bolts for a given railway track length. The second problem calculates soil properties from input parameters. The third problem determines the bed slope of a trapezoidal channel.

Uploaded by

Pratik Sakat
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)
36 views13 pages

Python (1) Merged

The document describes three Python programming problems related to civil engineering applications. The first problem involves calculating the number of rails, sleepers, and fish bolts for a given railway track length. The second problem calculates soil properties from input parameters. The third problem determines the bed slope of a trapezoidal channel.

Uploaded by

Pratik Sakat
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
You are on page 1/ 13

KIT’S College Of Engineering

(Autonomous), Kolhapur
2023-2024

STUDIO LAB (UCVC0606)

ACTIVITY NO: - 03
APPLICATION OF PYTHON LANGUAGE IN CIVIL ENGINEERING

CLASS :- T.Y (B-TECH) CIVIL –B, BATCH :- B3.


ROLL NO. NAME

LAB INCHARGE: - SUB. COORDINATOR:


CERTIFICATE

This is to certify that, following students of Semester -VI, B.Tech.(Civil


Engineering), KIT’s College of Engineering (Autonomous), Kolhapur
affiliated to Shivaji University, Kolhapur has successfully completed the lab
work connected with the Studio ab (UCVC 0606) as prescribed by the college
during the Academic year 2023-2024.

ROLL NO. NAME

Date: - / /2024
Place: - Kolhapur.
ALGORITHM FOR 1st PROBLEM
STEP 1 :- Start.

STEP 2:- Create a class named RailTrack to handle rail track calculations.
And initialize their parameter such as length , Rail length & Sleeper distance
etc.

STEP 3:- Define methods to calculate the number of rails , sleepers & Fish
Bolts .

 Calculate the number of rails by -


(Total length of track / length of rail )*2
 Calculate the number of sleepers by -
(Total length of Track / length of each sleeper) + 1
 Calculate the number of fish bolts by –
(Number of sleepers * 2)

STEP 4:- Prompt the user to input the length of the track ,length of each rail
& distance between each sleeper

STEP 5:- Create an instance of the RailTrack class with the provided user
inputs. Call the methods to calculate rail, sleepers & fish bolts.

STEP 6:- Print the calculated number of rails, sleepers & fish bolts to the user

STEP 7:- Stop.


ALGORITHM FOR 2nd PROBLEM
STEP 1 :- Start.

STEP 2:- Read inputs

 Total Unit weight of soil.


 Specific gravity of soil.
 Water content of soil

STEP 3:-Define methods to calculate Dry Unit weight & porosity.

a) Dry unit weight :


(Total unit wt.- (water content * Total unit weight ))
b) Porosity :
(Specific Gravity – 1)/ specific gravity

STEP 4:-Define methods to calculate void ratio & Degree of saturation

a) Void Ratio :
Porosity /(1- porosity )
b) Degree of saturation :
(water content * specific gravity ) / ((specific gravity– 1)*(1- porosity))

STEP 5:-Output print calculated properties

 Dry unit weight


 Porosity
 Void ratio
 Degree of Saturation

STEP 6:-Stop.s
ALGORITHM FOR 3rd PROBLEM
STEP 1 :- Start.

STEP 2:-Read inputs

 Bottom width
 Side slope
 Discharge
 Chezy’s constant

STEP 3:-Create an instance of the Trapezoidal Channel class with the


input parameters.

STEP 4:-Define methods to calculate radius & Chezy’s velocity of


trapezoidal channel

a) Radius : (Bottom width + side Slope *2)/(2*side slope)


b) Chezy’s velocity : Chezy’s constant * √Radius

STEP 5:-Define methods to calculate bed slope of trapezoidal channel :

(Chezy’s velocity * 2 ) / ( radius *2/3) / (bottom width * 2/3 )

STEP 6:-Print the calculated bed slope.

STEP 7:-Stop.
FLOWCHART FOR 1st PROBLEM

START

Input length of track , rail


length & Sleeper distance

Create RailTrack Object with input Parameter

Calculate number of rails using calculated rails method

Calculate number of sleepers using calculated sleeper’s method

Calculate number of fish bolts using calculated fish bolts method

Display number of rails,


sleepers & fish bolts.

STOP
FLOWCHART FOR 2nd PROBLEM

START

Input total unit weight, specific


gravity, water content

Calculation of dry unit weight

Calculation of porosity

Calculation of void ratio

Calculation of degree of saturation

Print result

STOP
FLOWCHART FOR 3rd PROBLEM

START

Input bottom width, side slope,


discharge & Chezy’s Constant

Create trapezoidal channel object with input parameters

Calculate hydraulic radius using given inputs

Calculate chezy’s velocity using chezy’s constant & hydraulic radius

Calculate bed slope using chezy’s velocity & hydraulic radius

Display calculated bed slope

STOP
PROBLEM No. 2
Q.2) This problem aims to develop a Python application to calculate
various properties of soil based on given parameters, including the total
unit weight, specific gravity, and water content. The properties to be
determined include the dry unit weight, porosity, void ratio, and degree
of saturation.
ANS:
def calculate_dry_unit_weight(total_unit_weight, water_content):
return total_unit_weight - (water_content * total_unit_weight)

def calculate_porosity(specific_gravity):
return (specific_gravity - 1) / specific_gravity

def calculate_void_ratio(porosity):
return porosity / (1 - porosity)

def calculate_degree_of_saturation(water_content, specific_gravity,


porosity):
return (water_content * specific_gravity) / ((specific_gravity - 1)
* (1 - porosity))

def main():

total_unit_weight = float(input("Enter the total unit weight of


soil: "))
specific_gravity = float(input("Enter the specific gravity of soil:
"))
water_content = float(input("Enter the water content of soil: "))

print("Define methods to calculate Dry Unit weight & porosity.")


dry_unit_weight = calculate_dry_unit_weight(total_unit_weight,
water_content)
porosity = calculate_porosity(specific_gravity)

print("Define methods to calculate void ratio & Degree of


saturation")
void_ratio = calculate_void_ratio(porosity)
degree_of_saturation =
calculate_degree_of_saturation(water_content, specific_gravity,
porosity)

print("Output print calculated properties")


print("Dry unit weight:", dry_unit_weight)
print("Porosity:", porosity)
print("Void ratio:", void_ratio)
print("Degree of Saturation:", degree_of_saturation)

if __name__ == "__main__":
main()

Enter the total unit weight of soil: 20


Enter the specific gravity of soil: 2.5
Enter the water content of soil: 20
Define methods to calculate Dry Unit weight & porosity.
Define methods to calculate void ratio & Degree of saturation
Output print calculated properties
Dry unit weight: -380.0
Porosity: 0.6
Void ratio: 1.4999999999999998
Degree of Saturation: 83.33333333333331
PROBLEM No. 3
Q.3) To develop a Python application for determining the bed slope of a
trapezoidal channel based on given channel dimensions and discharge,
using Chezy's constant.
ANS:import math

class TrapezoidalChannel:
def __init__(self, bottom_width, side_slope, discharge, chezy_constant):
self.bottom_width = bottom_width
self.side_slope = side_slope
self.discharge = discharge
self.chezy_constant = chezy_constant

def hydraulic_radius(self):
return (self.bottom_width + self.side_slope**2) / (2 *
self.side_slope)

def chezy_velocity(self):
return self.chezy_constant * math.sqrt(self.hydraulic_radius())

def bed_slope(self):
return (self.chezy_velocity() ** 2) / (self.hydraulic_radius() **
(2/3)) / (self.bottom_width ** (2/3))

if __name__ == "__main__":
bottom_width = float(input("Enter bottom width of the trapezoidal channel
(in meters): "))
side_slope = float(input("Enter side slope of the trapezoidal channel: "))
discharge = float(input("Enter discharge (in cubic meters per second): "))
chezy_constant = float(input("Enter Chezy's constant: "))

channel = TrapezoidalChannel(bottom_width, side_slope, discharge,


chezy_constant)

bed_slope = channel.bed_slope()

print("\nBed Slope of the trapezoidal channel:", bed_slope)


Enter bottom width of the trapezoidal channel (in meters): 6
Enter side slope of the trapezoidal channel: 0.33
Enter discharge (in cubic meters per second): 14.04
Enter Chezy's constant: 50
Bed Slope of the trapezoidal channel: 1589.6891200331402
PROBLEM No. 1
Q1) To develop a Python application for determining no of rails ,no of
sleepers , no of fish bolts etc on given length of rail track
ANS:
def calculate_rails(track_length, rail_length):
return (track_length // rail_length)*2

def calculate_sleepers(track_length, sleeper_spacing):


return (track_length // sleeper_spacing) + 1

def calculate_fish_bolts(track_length, sleeper_spacing):


return calculate_sleepers(track_length, sleeper_spacing) *2

def main():
track_length = float(input("Enter the length of the track (in meters):
"))
rail_length = float(input("Enter the length of each rail (in meters):
"))
sleeper_spacing = float(input("Enter the spacing between sleepers (in
meters): "))

rails = calculate_rails(track_length, rail_length)


sleepers = calculate_sleepers(track_length, sleeper_spacing)
fish_bolts = calculate_fish_bolts(track_length, sleeper_spacing)

print("Number of rails:", rails)


print("Number of sleepers:", sleepers)
print("Number of fish bolts:", fish_bolts)

if __name__ == "__main__":
main()

Enter the length of the track (in meters): 2000


Enter the length of each rail (in meters): 200
Enter the spacing between sleepers (in meters): 1
Number of rails: 20.0
Number of sleepers: 2001.0
Number of fish bolts: 4002.0

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy