Saturday, September 12, 2020

Python(Programming Language) Code to Solve a Horizontal Curve, Degree, Radius, Length, Long Chords and Tangent Length

 For Civil Engineers, Curves are to be taught in their Surveying course. Once you understand everything on the conceptual level, you can go to the next level by creating programs on software languages such as Python. Python can be easily installed on your computer, and you can run the following codes on that to get the solution. You can run it on Pycharm or IntelliJ etc. Try the code that I am giving below. 

So here is the problem. 

Given: So you are given two elements of a horizontal circular curve - Radius, and Intersection Angle. 

To Find Degrees, Length, Tangent Length, External Ordinate, Middle Ordinate, and Long Chord. 


Solution Code in Python:

import math
R = float(input('Radius, R: '))
u = input('units ')
D = 5729.57 / R
print('Degree of Curve, D = 5729.57/R = ', D,'degrees')
a = float(input('Intersection Angle(degrees) , I: '))
i = math.radians(a)
T = R*(math.tan(i/2))
print('Tangent Length, T= R*tan(I/2) =', T, u)
L = float(a*100/D)
print('Length of the Curve, L = I*100/D = ', L, u)
e = R*(1/math.cos(i/2)-1)
print('External Distant, E = R*(Sec(I/2) - 1) = ', e, u)
M = R*(1-math.cos(i/2))
print('Middle Ordinate, M = R*(1 - cos(I/2)) = ', M, u)
Lc = 2*R*math.sin(i/2)
print(f'Long Chords, Lc = 2R*Sin(I/2) = ', Lc, u)

I hope it works for you!
Thanks!


No comments:

Post a Comment

loading GIF

Blog Archive