Esempio n. 1
0
	def from_yaml_file(cls, filePath):

		## Read in yaml file as a dictionary
		with open(filePath, 'r') as stream:
			try:
				data = yaml.safe_load(stream)
			except yaml.YAMLError as exc:
				print(exc)

		## Initialize structure
		xsection = xs.generalSection(**data['XSection'])
		material = ma.Custom(**data['Material'])
		s1 = cls(cross=xsection, material=material)

		## Add nodes
		nodeMap = {} # map nodes to indicies
		for i, node in enumerate(data['Nodes']):
			for key, value in node.items():
				try:
					s1.addNode(value['x'], value['y'], fixity=value['fixity'])
				except KeyError:
					s1.addNode(value['x'], value['y'])

				nodeMap.update({key: i})

		## Add members
		for member in data['Members']:
			for key, value in member.items():
				SN, EN = key.split(',')
				s1.addMember(nodeMap[SN], nodeMap[EN], expectedaxial=value['axial'])

		return s1
Esempio n. 2
0
 def test_knownframe(self):
     xs1 = xs.generalSection(A=1, Ix=1)
     s1 = sc.Structure(xs1, ma.Steel(E=144))
     s1.addNode(0, 0, fixity='fixed')
     s1.addNode(24, 0, fixity='roller')
     s1.addNode(42, 0, fixity='roller')
     s1.addMember(0, 1)
     s1.addMember(2, 1)
Esempio n. 3
0
    def __init__(self, SN, EN, material=ma.Steel(), cross=xs.generalSection()):
        self.cross = cross
        self.material = material

        # assign start and end node properties
        self.SN = SN
        self.EN = EN

        #the axial force
        self.axial = 0
Esempio n. 4
0
def test_basic():
    xs1 = xs.generalSection(A=1, Ix=1)
    ma1 = ma.Custom(E=29000)

    f1 = Frame.Frame(cross=xs1, material=ma1)
    f1.addNode(0, 0, fixity='fixed')
    f1.addNode(10, 0)
    f1.addMember(0, 1)

    assert isSymmetric(f1.K)
    assert isSymmetric(f1.members[0].k)
    assert (f1.K == f1.members[0].k).all()
    assert (f1.K == f1.members[0].kglobal).all()
Esempio n. 5
0
    def test_Frame(self):

        # global stiffness matrix must be symmetric
        xs1 = xs.generalSection(A=30, Ix=700)
        s1 = sc.Structure(xs1, ma.Steel(E=29000))
        s1.addNode(0, 0)
        s1.addNode(0, 144)
        s1.addNode(144, 144)
        s1.addMember(0, 1)
        s1.addMember(1, 2)
        m1 = s1.members[0]
        stiff1 = m1.T.T * m1.kframe * m1.T
        v = np.all(stiff1 == stiff1.T)
        self.assertEqual(v, True)
Esempio n. 6
0
	def test_Truss(self):
			
			xs1 = xs.generalSection(A=1.2)
			ma1 = ma.Custom(E=30*10**6, fy=60) #psi
			
			# Example 6.2.4
			T1 = Truss.Truss(cross=xs1,material=ma1)
			
			# Make nodes
			n1 = T1.addNode(0,-180)
			n2 = T1.addNode(0,0)
			n3 = T1.addNode(120,0,fixity='pin')
			n4 = T1.addNode(120,-180,fixity='wallslider')
			
			m1 = T1.addMember(0,3)
			m2 = T1.addMember(1,2)
			m3 = T1.addMember(1,0)
			m4 = T1.addMember(2,3)
			m5 = T1.addMember(0,2)
			m6 = T1.addMember(1,3)
			
			length = math.sqrt(120**2+180**2)
			
			self.assertEqual(m1.length, 120)
			self.assertEqual(m2.length, 120)
			self.assertEqual(m3.length, 180)
			self.assertEqual(m4.length, 180)
			
			self.assertEqual(m5.length, length)
			self.assertEqual(m6.length, length)
			
			self.assertEqual(m1.unVec[0],1)
			self.assertEqual(m1.unVec[1],0)
			
			loading = np.array([0,0,0,-4000,0,0,0,0])
			T1.directStiffness(loading)
			
			self.assertAlmostEqual(m1.axial[0,0],1333 + 1/3)
			self.assertAlmostEqual(m2.axial[0,0], - 1333 - 1/3)
			self.assertAlmostEqual(m3.axial[0,0], 2000)
			self.assertAlmostEqual(m4.axial[0,0], -2000)
			self.assertAlmostEqual(m5.axial[0,0], -2403.7008503093257)
			self.assertAlmostEqual(m6.axial[0,0], 2403.7008503093257)
Esempio n. 7
0
def test_6_2_5():
    """
	Continuous Beam (Rajan, pg. 369)
	"""
    xs1 = xs.generalSection(A=0.01, Ix=0.0001)
    ma1 = ma.Custom(E=2 * 10**11)
    f1 = Frame.Frame(cross=xs1, material=ma1)

    # Nodes
    f1.addNode(0, 0, fixity='fixed')
    f1.addNode(2, 0, fixity='roller')
    f1.addNode(5, 0, fixity='roller')

    # Members
    f1.addMember(0, 1)
    f1.addMember(1, 2)
    # node, x, y, theta
    # 0
    # 1
    loading = np.array([
        0, -2000, -666.6666667, 0, -5000, -833.3333333333333333333333333, 0,
        -3000, 1500
    ])

    f1.directStiffness(loading)

    handCalc = 10**7 * np.array([[166.7, 0, -66.7, 0], [0, 6.67, 0, 1.33],
                                 [-66.7, 0, 66.7, 0], [0, 1.33, 0, 2.67]])

    assert isSymmetric(f1.K)
    assert np.allclose(f1.reducedK, handCalc, 0.01)
    assert f1.nodes[1].deformation_dict['x'] == 0
    assert approx(f1.nodes[2].deformation_dict['θz'],
                  0.01) == 6.92851 * 10**(-5)
    assert approx(f1.nodes[1].deformation_dict['θz'],
                  0.01) == -2.63092 * 10**(-5)
Esempio n. 8
0
import StructPy.cross_sections as xs
import StructPy.structural_classes as sc
import StructPy.materials as ma
import StructPy.Truss as Truss

# Define material
A992 = ma.A992()

# Define cross section
xs1 = xs.generalSection(A=1)

# define blank structure
# the cross section and material are defaults for the members
# we will add to this later
s1 = Truss.Truss(cross=xs1, material=A992)

# Add nodes to the structure
s1.addNode(0, 0, fixity='pin')
s1.addNode(1, 1)
s1.addNode(2, 0, fixity='roller')

# Add members to the structure
s1.addMember(0, 1)
s1.addMember(1, 2)
s1.addMember(0, 2)

s1.plot()

Forces = np.matrix('0; 0; 1000; 1000; 0; 0')
disp = s1.directStiffness(Forces)
s1.plotDeformation(nfig=1, mag=1)
Esempio n. 9
0
            member.axial = member.axialstiff * np.matrix(
                [l, m, -l, -m]) * np.asmatrix(d[ind]).T

        return d


import structural_classes as sc
import cross_sections as xs
import materials as ma
import Truss

# Define material
A992 = ma.Steel(E=2e11)

# Define cross section
xs1 = xs.generalSection(A=1e-2, Ix=5e-6)

# define blank structure
# the cross section and material are defaults for the members
# we will add to this later
s1 = Frame(cross=xs1, material=A992)

# Add nodes to the structure
s1.addNode(0, 0, xfix=0, yfix=0, fixity='pin')
s1.addNode(0, 2)
s1.addNode(1.5, 3)
s1.addNode(3, 2)
s1.addNode(3, 0, xfix=0, yfix=0, fixity='pin')

# Add members to the structure
s1.addMember(0, 1)
Esempio n. 10
0
import StructPy.cross_sections as xs
import StructPy.structural_classes as sc
import StructPy.materials as ma

xs1 = xs.generalSection(A=30, Ix=700)

s1 = sc.Structure(xs1, ma.Steel(E=29000))

s1.addNode(0, 0)
s1.addNode(0, 144)
s1.addNode(144, 144)

s1.addMember(0, 1)
s1.addMember(1, 2)

m1 = s1.members[0]
stiff1 = m1.T.T * m1.kframe * m1.T

s1.plot()

xs1 = xs.AISC('W8X48').printProperties()