-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStructure_Operations.py
More file actions
61 lines (49 loc) · 1.87 KB
/
Structure_Operations.py
File metadata and controls
61 lines (49 loc) · 1.87 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 14 14:34:19 2021
@author: kendrick shepherd
"""
import sys
# determine if the bar is statically determinate (and belongs to a truss)
def StaticallyDeterminate(nodes,bars):
# Determine the number of nodes in the truss
n_nodes = len(nodes)
n_bars = len(bars)
# Determine number of (valid) reactions supported by nodes of the truss
n_reactions = 0
for node in nodes:
if(any(node.ConstraintType())):
if(2 in node.ConstraintType()):
sys.exit("Truss cannot support a moment reaction force")
elif(-1 in node.ConstraintType()):
sys.exit("Invalid constraint type specified for the truss")
else:
n_reactions += len(node.ConstraintType())
# Compute if b + r = 2j (Equation 3-1 of the textbook)
if(n_bars + n_reactions < 2*n_nodes):
sys.exit("The truss is unstable")
elif(n_bars + n_reactions > 2*n_nodes):
sys.exit("The truss is statically indeterminate, and cannot be resolved using method of joints")
else:
return True
def ComputeReactions(nodes):
# assume that there is one pin and one roller for our statically determinate structure
n_pins = 0
n_roller = 0
for node in nodes:
if(node.constraint=="pin"):
pin_node = node
n_pins += 1
elif(node.constraint=="roller_no_xdisp"):
roller_node = node
n_roller += 1
elif(node.constraint=="roller_no_ydisp"):
roller_node = node
n_roller += 1
if(n_pins != 1 or n_roller != 1):
sys.exit("A more clever way must be found to compute the reaction forces")
# Continue from here
# Sum of moments about the pin
# sum of forces in y direction
# sum of forces in x direction