コード例 #1
0
def display_truss_design(x):
    """
    find the displacements in the specified truss as well as the weight of the truss
    :param x: the defining parameters of the truss.  a list of values, in the order on/off, beam number
    :return:
    """
    ss = SystemElements()

    beam_locations = []
    side_length = 120
    beam_locations.append([[0, 0], [0, side_length]])
    beam_locations.append([[0, side_length], [side_length, side_length]])
    beam_locations.append([[side_length, side_length], [side_length, 0]])
    beam_locations.append([[side_length, 0], [0, side_length]])
    beam_locations.append([[0, 0], [side_length, side_length]])

    for i, beam in enumerate(beam_locations):
        if x[i * 2]:
            area = a[x[i * 2 + 1]]
            ss.add_element(location=beam, EA=e * area, EI=e * ix[x[i * 2 + 1]])

    ss.add_support_fixed(node_id=1)

    ss.add_support_roll(node_id=4)

    ss.point_load(Fx=50, node_id=2)
    ss.point_load(Fz=-50, node_id=3)
    ss.solve()

    # ss.show_structure()
    ss.show_displacement()
    return
コード例 #2
0
def truss_constraints(x):
    """
    find the displacements in the specified truss as well as the weight of the truss
    :param x: the defining parameters of the truss.  a list of values, in the order on/off, beam number
    :return:
    """
    ss = SystemElements()
    weight = 0

    max_displ = 0.5
    max_weight = 500

    beam_locations = []
    side_length = 120
    beam_locations.append([[0, 0], [0, side_length]])
    beam_locations.append([[0, side_length], [side_length, side_length]])
    beam_locations.append([[side_length, side_length], [side_length, 0]])
    beam_locations.append([[side_length, 0], [0, side_length]])
    beam_locations.append([[0, 0], [side_length, side_length]])

    for i, beam in enumerate(beam_locations):
        if x[i * 2]:
            length = calc_length(beam)
            area = a[x[i * 2 + 1]]
            weight += area * dens * length
            ss.add_element(location=beam, EA=e * area, EI=e * ix[x[i * 2 + 1]])

    ss.add_support_fixed(node_id=1)

    ss.add_support_roll(node_id=4)

    ss.point_load(Fx=50, node_id=2)
    ss.point_load(Fz=-50, node_id=3)
    ss.solve()

    # ss.show_structure()
    # ss.show_displacement()
    node_disp = []
    displacements = ss.get_node_displacements()
    for (node, ux, uy, phi) in displacements:
        displ = np.sqrt(ux**2 + uy**2)
        displ = (displ - max_displ) / max_displ
        node_disp.append(displ)
    weight = (weight - max_weight) / max_weight
    node_disp.append(weight)
    return node_disp
コード例 #3
0
E = 210e3
profile = HEA[180]
EA = to_kN(E * profile['A'])
EI = to_kNm2(E * profile['Iy'])
mp = profile["Wy"] * 235 * 1e-6

ss = SystemElements(EA=EA, EI=EI, load_factor=load_factor)
ss.add_element([[0, 0], [0, 4]], mp={2: mp})
ss.add_element([0, 8], mp={1: mp, 2: mp})
ss.add_element([2, 8], mp={1: mp, 2: mp})
ss.add_element([4, 8], mp={1: mp, 2: mp})
ss.add_element([4, 4], mp={1: mp, 2: mp})
ss.add_element([4, 0], mp={1: mp, 2: mp})
ss.add_truss_element([[0, 4], [4, 4]])
ss.add_support_hinged(1)
ss.add_support_fixed(7)

ss.q_load(-20, 3)
ss.q_load(-20, 4)
ss.q_load(-1, 1)
ss.q_load(-1, 2)

if __name__ == "__main__":
    ss.solve()
    ss.show_structure()
    ss.show_displacement()
    ss.show_bending_moment()


コード例 #4
0
from anastruct.fem.system import SystemElements
"""
Test the primary force vector when applying a q_load at a hinged element.
"""

ss = SystemElements()
ss.add_element([[0, 0], [3.5, 0]])
ss.add_element([7, 0], spring={1: 100})
ss.add_support_fixed([1])
ss.add_support_hinged(3)
ss.point_load(2, Fz=-100)

if __name__ == "__main__":
    ss.show_displacement()
    ss.show_reaction_force()
    ss.show_bending_moment()
コード例 #5
0
ファイル: ex_1.py プロジェクト: harshavardhan-99/anaStruct
from anastruct.fem.system import SystemElements


ss = SystemElements()
ss.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000)
ss.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000)

ss.q_load(element_id=2, q=-10)

ss.add_support_hinged(node_id=1)
ss.add_support_fixed(node_id=3)

ss.solve()
ss.show_structure()
ss.show_reaction_force()
ss.show_axial_force()
ss.show_shear_force()
ss.show_bending_moment()
ss.show_displacement()
コード例 #6
0
from anastruct.fem.system import SystemElements

"""
Test the primary force vector when applying a q_load at a hinged element.
"""

ss = SystemElements()
ss.add_element([[0, 0], [7, 0]], spring={2: 0})
ss.add_element([7.1, 0])
ss.add_support_fixed([1, 3])
ss.q_load(-10, 1)
ss.solve()
ss.show_reaction_force()
ss.show_bending_moment()

コード例 #7
0
ファイル: ex_13.py プロジェクト: yasser64b/anaStruct
from anastruct.fem.system import SystemElements

ss = SystemElements()
ss.add_element([[0, 0], [2, 0]])
ss.add_element([4, 0])
ss.add_element([6, 0])
ss.add_support_fixed([1, 4])

ss.point_load([2, 3], [20, -20])

if __name__ == "__main__":
    ss.solve()
    ss.show_axial_force()
コード例 #8
0
ファイル: test.py プロジェクト: landonbw/575HW
from anastruct.fem.system import SystemElements
import numpy as np

ss = SystemElements(EA=15000, EI=5000)

# Add beams to the system.
ss.add_element(location=[[0, 0], [0, 5]])
ss.add_element(location=[[0, 5], [5, 5]])
ss.add_element(location=[[5, 5], [5, 0]])
ss.add_element(location=[[5, 0], [0, 5]])

# Add a fixed support at node 1.
ss.add_support_fixed(node_id=1)

# Add a rotational spring support at node 4.
ss.add_support_fixed(node_id=4)

# Add loads.
ss.point_load(Fx=30, node_id=2)
ss.q_load(q=-20, element_id=2)

# Solve
ss.solve()

# Get visual results.
# ss.show_structure()
# ss.show_reaction_force()
# ss.show_axial_force()
# ss.show_shear_force()
# ss.show_bending_moment()
# ss.show_displacement()
コード例 #9
0
from anastruct.fem.system import SystemElements


ss = SystemElements()
ss.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000)
ss.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000)

ss.q_load(element_id=2, q=-10)

ss.add_support_hinged(node_id=1)
ss.add_support_fixed(node_id=3)

ss.solve()
ss.show_structure()
ss.show_reaction_force()
ss.show_axial_force()
ss.show_shear_force()
ss.show_bending_moment()
ss.show_displacement()


コード例 #10
0
from anastruct.fem.system import SystemElements

"""
Test the primary force vector when applying a q_load at a hinged element.
"""

ss = SystemElements()
ss.add_element([[0, 0], [3.5, 0]])
ss.add_element([7, 0], spring={1: 100})
ss.add_support_fixed([1])
ss.add_support_hinged(3)
ss.point_load(2, Fy=-100)

if __name__ == "__main__":
    ss.solve()
    ss.show_displacement()
    ss.show_reaction_force()
    ss.show_bending_moment()
コード例 #11
0
E = 210e3
profile = HEA[180]
EA = to_kN(E * profile["A"])
EI = to_kNm2(E * profile["Iy"])
mp = profile["Wy"] * 235 * 1e-6

ss = SystemElements(EA=EA, EI=EI, load_factor=load_factor)
ss.add_element([[0, 0], [0, 4]], mp={2: mp})
ss.add_element([0, 8], mp={1: mp, 2: mp})
ss.add_element([2, 8], mp={1: mp, 2: mp})
ss.add_element([4, 8], mp={1: mp, 2: mp})
ss.add_element([4, 4], mp={1: mp, 2: mp})
ss.add_element([4, 0], mp={1: mp, 2: mp})
ss.add_truss_element([[0, 4], [4, 4]])
ss.add_support_hinged(1)
ss.add_support_fixed(7)

ss.q_load(-20, 3)
ss.q_load(-20, 4)
ss.q_load(-1, 1)
ss.q_load(-1, 2)

if __name__ == "__main__":
    import time
    from copy import deepcopy

    ELEMENT_MAP = deepcopy(ss.element_map)
    min_ = 1e8
    n = 25
    save = True