-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathforce.py
67 lines (49 loc) · 2.72 KB
/
force.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import numpy as np
'''
It defines coefficients of the force for different uses, especially in the calculation of the internal forces
'''
class force(object):
def __init__(self, position, sign = 1.):
'''sign might be +1 or -1
force position refers to the x position of the force in the reference frame specified in the report
x line on hinge line, '''
self.force_position = position
self.force_sign = sign
def coeff(self, current_position):
'''output is coefficient of the force, givrn position considered'''
return self.force_sign * np.heaviside(current_position-self.force_position, 0.)
def moment(self, current_position):
'''output is moment coefficient of the force, givrn position considered'''
return self.force_sign*(current_position - self.force_position) \
* np.heaviside(current_position-self.force_position, 0.)
def slope(self, current_position):
'''output is slope coefficient'''
return self.force_sign*((current_position - self.force_position)**2.)/2.\
* np.heaviside(current_position-self.force_position, 0.)
def displacement(self, current_position):
'''output is displacement coefficient'''
return self.force_sign * ((current_position - self.force_position) ** 3.) / 6.\
* np.heaviside(current_position-self.force_position, 0.)
class distributed_load(object):
def __init__(self, position, sign = 1.):
'''sign might be +1 or -1
force position refers to the x position of the force in the reference frame specified in the report
x line on hinge line, '''
self.force_position = position
self.force_sign = sign
def coeff(self, current_position):
'''output is coefficient of the force, givrn position considered'''
return self.force_sign*(current_position - self.force_position)\
* np.heaviside(current_position-self.force_position, 0.)
def moment(self, current_position):
'''output is moment coefficient of the force, givrn position considered'''
return self.force_sign*((current_position - self.force_position)**2.)/2.\
* np.heaviside(current_position-self.force_position, 0.)
def slope(self, current_position):
'''output is slope coefficient'''
return self.force_sign * ((current_position - self.force_position) ** 3.) / 6.\
* np.heaviside(current_position-self.force_position, 0.)
def displacement(self, current_position):
'''output is displacement coefficient'''
return self.force_sign * ((current_position - self.force_position) ** 4.) / 24.\
* np.heaviside(current_position-self.force_position, 0.)