You are on page 1of 2

1 #-------------------------------------------------------------------------------

2 # Name: module2
3 # Purpose:
4 #
5 # Author:
6 #
7 # Created: 21/08/2014
8 # Copyright: (c) 2014
9 # Licence: <your licence>
10 #-------------------------------------------------------------------------------
11
12 import math
13 import numpy as np
14 import matplotlib.pyplot as plt
15 from scipy.optimize import fsolve
16
17
18 def cat(a):
19 # defining catenary function
20 #catenary eq (math): a*sinh(L/(2*a)+atanh(d/S))+a*sinh(L/(2*a)-atanh(d/S))-S=0
21 return a*math.sinh(L/(2*a))+math.atanh(d/S)+a*math.sinh(L/(2*a))-math.atanh(d/S)-S
22
23 L=1.6 #float(input("Horizontal Distance between supports [m]: "))
24 d=0 #float(input ("Vertical Distance between supports [m]: "))
25 S=2.979 #float(input("Length of cable [m] - must be greater than distance between
supports: "))
26 w=0.064 #float(input("Unit weight of cable [kg/m]: "))
27 za=0 #float(input("Elevation of higher support from reference plane [m]: "))
28
29 #checking if cable length is bigger than total distance between supports
30 distance=(L**2+d**2)**0.5
31 if S <= distance:
32 print ("Length of cable must be greater than TOTAL distance between supports!")
33 S=float(input("Length of cable [m]: "))
34 else:
35 pass
36
37 # solving catenary function for 'a'
38
39
40 a=fsolve(cat, 1)
41
42 # hor. distance between lowest catenary point (P) to higher support point (La)
43 La=a*(L/(2*a)+math.atanh(d/S))
44 # hor. distance between lowest catenary point (P) to lower support point (Lb)
45 Lb=L-La
46 # vert. distance from higher support point to lowest point (P) in catenary (ha)
47 ha=a*math.cosh(La/a)-a
48 ## calculating reaction forces and angles
49 # catenary lenght between support "A" (higher) and "P" - Sa
50 Sa=a*math.sinh(La/a)
51 # catenary lenght between support "B" )lower) and "P" - Sb
52 Sb=a*math.sinh(Lb/a) #Lwant=a*math.asinh(1.5/a) #1.5
53 # horizontal tension - constant through catenary: H
54 H=w*a
55 # vertical tension at "A" (Va) and "B" (Vb)
56 Va=Sa*w
57 Vb=Sb*w
58 # tension at "A" (TA) and B (TB)
59 TA=(H**2+Va**2)**0.5
60 TB=(H**2+Vb**2)**0.5
61 # inclination angles from vertical at "A" (ThetA) and B (ThetB)
62 ThetA=math.atan(H/Va)
63 ThetB=math.atan(H/Vb)
64 ThetAd=ThetA*180/math.pi;
65 ThetBd=ThetB*180/math.pi;
66 # establishing A, B and P in coordinate system
67 # index "a" corresponding to point "A", "b" to "B"-point and "P" to lowest caten.
point
68 zb=za-d
69 zp=za-ha
70 xa=La
71 xp=0
72 xb=-Lb
73
74
75
76
77 # graphing catenary curve - matplotlib & writting coordinates in file
78 xinc=L/100
79 y=[]
80 xc=[]
81 fncoords="catenary_coords.txt"
82 fn=open(fncoords, "a")
83
84 for x in np.arange (xb, xa+xinc, xinc):
85 ycal=a*math.cosh(x/a)
86 fn.write("\n")
87 fn.write(str(round(x,3)))
88 fn.write("\t")
89 fn.write(str(round(ycal[0],3)))
90 y.append(ycal)
91 xc.append(x)
92 fn.close()
93
94 # plotting, finally
95 plt.plot(xc,y)
96 plt.xlabel("X-distance [m]")
97 plt.ylabel("Y-distance [m]")
98 plt.grid()
99 plt.show()

You might also like