Python (1) Merged
Python (1) Merged
(Autonomous), Kolhapur
2023-2024
ACTIVITY NO: - 03
APPLICATION OF PYTHON LANGUAGE IN CIVIL ENGINEERING
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 .
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
a) Void Ratio :
Porosity /(1- porosity )
b) Degree of saturation :
(water content * specific gravity ) / ((specific gravity– 1)*(1- porosity))
STEP 6:-Stop.s
ALGORITHM FOR 3rd PROBLEM
STEP 1 :- Start.
Bottom width
Side slope
Discharge
Chezy’s constant
STEP 7:-Stop.
FLOWCHART FOR 1st PROBLEM
START
STOP
FLOWCHART FOR 2nd PROBLEM
START
Calculation of porosity
Print result
STOP
FLOWCHART FOR 3rd PROBLEM
START
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 main():
if __name__ == "__main__":
main()
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: "))
bed_slope = channel.bed_slope()
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): "))
if __name__ == "__main__":
main()