from anastruct.fem.system import SystemElements

"""
Test dead loads on the structure. TO DO! Distributed axial force
"""

ss = SystemElements()
ss.add_element([[0, 0], [10, 5]], g=1)
ss.add_support_hinged(1)
ss.add_support_roll(2, 2)

if __name__ == '__main__':
    ss.solve()
    ss.show_reaction_force()
    ss.show_axial_force()
    ss.show_bending_moment()
Beispiel #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
Beispiel #3
0
from anastruct.fem.system import SystemElements

ss = SystemElements(mesh=250)
ss.add_element(location=[(0, 0), (1.33, 0)], EA=356, EI=1332)
ss.add_element(location=[(1.33, 0), (2.0, 0)], EA=356, EI=1332)
ss.add_support_hinged(node_id=ss.find_node_id((0, 0)))
ss.add_support_hinged(node_id=ss.find_node_id((1.33, 0)))
ss.q_load(q=-1000.0, element_id=1, direction="y")
ss.q_load(q=-1000.0, element_id=2, direction="y")

if __name__ == "__main__":
    ss.solve()
    ss.show_displacement()
Beispiel #4
0
from anastruct.fem.system import SystemElements
from anastruct import LoadCase, LoadCombination
import matplotlib.pyplot as plt
import numpy as np

ss = SystemElements()

height = 10

x = np.cumsum([0, 4, 7, 7, 4])
y = np.zeros(x.shape)
x = np.append(x, x[::-1])
y = np.append(y, y + height)

ss.add_element_grid(x, y)
ss.add_element([[0, 0], [0, height]])
ss.add_element([[4, 0], [4, height]])
ss.add_element([[11, 0], [11, height]])
ss.add_element([[18, 0], [18, height]])
ss.add_support_hinged([1, 5])
ss.show_structure()

lc_wind = LoadCase("wind")
lc_wind.q_load(q=-1, element_id=[10, 11, 12, 13, 5])

print(lc_wind)

ss.apply_load_case(lc_wind)
ss.show_structure()

# reset the structure
Beispiel #5
0
from anastruct.fem.system import SystemElements
import time
import os
import subprocess

save = True
min_ = 1e8
n = 25

for i in range(n):
    t0 = time.time()
    ss = SystemElements()
    el = ss.add_multiple_elements([[0, 0], [10, 10]], n=500)
    ss.point_load(ss.node_map.values(), Fy=1)
    ss.q_load(1, el)
    t = time.time() - t0
    print(t)
    min_ = min(min_, t)

print(f"Best of {n} = {min_} s.")

if save:
    with open("system-creation.csv", "a") as f:
        os.chdir("../../..")
        git_label = (str(subprocess.check_output(["git", "describe",
                                                  "--tags"])).replace(
                                                      "\\n",
                                                      "").replace("'", "")[1:])
        f.write(f"{git_label}, {min_}\n")
Beispiel #6
0
from anastruct.fem.system import SystemElements
"""
Test dead loads on the structure. TO DO! Distributed axial force
"""

ss = SystemElements()
ss.add_element([[0, 6], [5, 4]], g=5)
ss.add_element([7, 3.2], g=5)
ss.add_element([[0, 0], [5, 4]], spring={2: 0})
ss.add_support_hinged([1, 4])

if __name__ == "__main__":
    ss.solve()
    ss.show_axial_force()
Beispiel #7
0
from anastruct.fem.system import SystemElements

ss = SystemElements(mesh=10)
ss.add_element([10, 0])
ss.add_element([20, 0])
ss.q_load(-10, [1, 2])
ss.add_support_hinged([1, 2, 3])

if __name__ == "__main__":
    ss.solve()
    for el in ss.element_map.values():
        print(el.deflection.max())
    ss.show_results()
Beispiel #8
0
from modABC import *
from GColumn_ABC import *
from anastruct.fem.system import SystemElements

# Create a new system object.
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]])
# Add a fixed support at node 1.
ss.add_support_fixed(node_id=1)
ss.add_support_fixed(node_id=4)
# Add a rotational spring at node 4.
#ss.add_support_spring(node_id=4, translation=3, k=4000)
# Add loads.
ss.point_load(Fx=30, node_id=2)
ss.q_load(q=-100, element_id=2)
ss.show_structure()
ss.solve()
ss.show_reaction_force()
ss.show_axial_force()
ss.show_bending_moment()
ss.show_displacement()
print(ss.get_element_results(element_id=2)['length'])
print(ss.get_element_results(element_id=2)['Mmin'])
B_Moment = ss.get_element_results(element_id=2)['Mmax']
print(B_Moment)
#Beam_main(B_Moment)
#solution :
#-0.005188154477119511
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()
Beispiel #10
0
from anastruct.fem.system import SystemElements

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]])

# 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_spring(node_id=4, translation=3, k=4000)

# Add loads.
ss.point_load(Fx=30, node_id=2)
ss.q_load(q=-10, 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()
from anastruct.fem.system import SystemElements

ss = SystemElements(EI=5e3, EA=1e5)

ss.add_element([0, 10])

ss.add_support_hinged(1)
ss.add_support_roll(2, 1)

ss.point_load(2, Fy=-1)

if __name__ == "__main__":
    ss.solve(geometrical_non_linear=True, discretize_kwargs=dict(n=15))
    print(ss.buckling_factor)
    ss.show_displacement()
from anastruct.fem.system import SystemElements

ss = SystemElements()

ss.add_element([0, 10])
ss.add_element([5, 10])
ss.add_element([5, 0])

ss.add_support_hinged(1)
ss.add_support_hinged(4)

ss.point_load(2, Fy=-10, rotation=30)

if __name__ == "__main__":
    ss.show_structure()
Beispiel #13
0
from anastruct.fem.system import SystemElements
from anastruct.material.profile import HEA
from anastruct.material.units import to_kNm2, to_kN

load_factor = 3

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
from anastruct.fem.system import SystemElements

ss = SystemElements(plot_backend="plotly")
ss.add_element([[0, 0], [1, 0]])
ss.add_element([2, 0])

ss.add_support_hinged(1)
ss.add_support_spring(3, 2, 3000)
ss.point_load(2, Fy=-1000)
ss.solve()
ss.show_structure()
ss.show_bending_moment()
ss.show_displacement()
Beispiel #15
0
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()
Beispiel #16
0
from anastruct.fem.system import SystemElements

"""
Geting section form sectionbase
"""

ss = SystemElements()

ss.add_element([[0, 0], [10, 0]], steelsection="IPE 300", E=210e9, sw=True, orient="z")
ss.add_element([[0, 1], [10, 1]], b=1.0, h=1.0, E=210e9, gamma=20)
ss.add_element([[0, 2], [10, 2]], d=0.6, E=210e9)

if __name__ == "__main__":
    ss.show_structure(verbosity=0, annotations=True)
from anastruct.fem.system import SystemElements
"""
Test dead loads on the structure. TO DO! Distributed axial force
"""


ss = SystemElements()
ss.add_element([[0, 6], [5, 4]], g=5)
ss.add_element([7, 3.2], g=5)
ss.add_element([[0, 0], [5, 4]], spring={2: 0})
ss.add_support_hinged([1, 4])

if __name__ == "__main__":
    ss.solve()
    ss.show_axial_force()
Beispiel #18
0
from anastruct.fem.system import SystemElements
"""
Test dead loads on the structure. TO DO! Distributed axial force
"""

ss = SystemElements()
ss.add_element([[0, 0], [10, 5]], g=1)
ss.add_support_hinged(1)
ss.add_support_roll(2, 2)

if __name__ == '__main__':
    ss.solve()
    ss.show_reaction_force()
    ss.show_axial_force()
    ss.show_bending_moment()
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()

Beispiel #20
0
from anastruct.fem.system import SystemElements

ss = SystemElements(EI=5e3, EA=1e5)

ss.add_element([0, 10])

ss.add_support_hinged(1)
ss.add_support_roll(2, 1)

ss.point_load(2, Fz=-1)

if __name__ == "__main__":
    ss.solve(geometrical_non_linear=True, discretize_kwargs=dict(n=15))
    print(ss.buckling_factor)
    ss.show_displacement()
Beispiel #21
0
from anastruct.fem.system import SystemElements

ss = SystemElements()
ss.add_element(location=[[0, 0], [5, 0]], EA=5e9, EI=8000)
ss.add_element(location=[[5, 0], [5, 5]], EA=5e9, EI=4000)
ss.moment_load(Ty=10, node_id=3)
ss.add_support_hinged(node_id=1)
ss.add_support_hinged(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()
from anastruct.fem.system import SystemElements

ss = SystemElements(plot_backend="plotly")
ss.add_element([[0, 0], [1, 0]])
ss.add_element([2, 0])

ss.add_support_hinged(1)
ss.add_support_spring(3, 2, 3000)
ss.point_load(2, Fz=-1000)
ss.solve()
ss.show_structure()
ss.show_bending_moment()
ss.show_displacement()
from anastruct.fem.system import SystemElements

ss = SystemElements()

ss.add_element([10, 0])
ss.insert_node(1, factor=0.3)
ss.insert_node(2, [5, 5])

if __name__ == "__main__":
    ss.show_structure(values_only=True)
Beispiel #24
0
    def build(self):
        builds = np.zeros(self.pop_size, dtype=object)
        middle_node = np.zeros(self.pop_size, dtype=int)
        all_lengths = np.zeros(self.pop_size, dtype=int)
        n_elements = np.zeros(self.pop_size, dtype=int)

        for i in range(self.pop.shape[0]):
            ss = SystemElements()
            on = np.argwhere(self.pop[i] == 1)

            for j in on.flatten():
                n1, n2 = self.comb[j]
                l1 = self.loc[n1]
                l2 = self.loc[n2]

                ss.add_element([l1, l2])
                # add mirror
                ss.add_element([
                    mirror(l1, self.mirror_line),
                    mirror(l2, self.mirror_line)
                ])

            # Placing the supports on the outer nodes, and the point load on the middle node.
            x_range = ss.nodes_range('x')
            if len(x_range) <= 2:
                builds[i] = None
                all_lengths[i] = 0
                n_elements[i] = 0
            else:
                length = max(x_range)
                start = min(x_range)
                ids = list(ss.node_map.keys())

                max_node_id = ids[np.argmax(x_range)]

                for j in range(self.height):
                    middle_node_id = ss.nearest_node(
                        "both",
                        np.array([(length + start) / 2, self.height - j]))
                    if middle_node_id:
                        break

                if middle_node_id is None:
                    middle_node_id = ids[np.argmin(
                        np.abs(np.array(x_range) - (length + start) / 2))]

                ss.add_support_hinged(1)
                ss.add_support_hinged(max_node_id)
                ss.point_load(middle_node_id, Fz=-100)

                builds[i] = ss
                middle_node[i] = middle_node_id
                all_lengths[i] = length
                n_elements[i] = on.size

        self.builds = builds
        return builds, middle_node, all_lengths, n_elements
Beispiel #25
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
Beispiel #26
0
import math
from anastruct.fem.system import SystemElements

ss = SystemElements(EA=5000)
ss.add_truss_element(location=[[0, 0], [0, 5]])
ss.add_truss_element(location=[[0, 5], [5, 5]])
ss.add_truss_element(location=[[5, 5], [5, 0]])
ss.add_truss_element(location=[[0, 0], [5, 5]], EA=5000 * math.sqrt(2))

ss.add_support_hinged(node_id=1)
ss.add_support_hinged(node_id=4)

ss.point_load(Fx=10, node_id=2)

ss.solve()
ss.show_structure()
ss.show_reaction_force()
ss.show_axial_force()
ss.show_shear_force()
ss.show_displacement(factor=10)

from anastruct.material.units import to_kN, to_kNm2
from anastruct.fem.system import SystemElements

I_ligger = HEA[list(HEA)[11]]["Iy"]
I_kolommen = HEA[list(HEA)[0]]["Iy"]
print(I_ligger/I_kolommen)
A_ligger = HEA[list(HEA)[11]]["A"]
A_kolommen = HEA[list(HEA)[0]]["A"]

EG_profiel_ligger = HEA[list(HEA)[11]]["G"] / 100
EG_profiel_kolommen = HEA[list(HEA)[0]]["G"] / 100

E = 210000
hoogte = 4.7
overspanning = 8.0
ss = SystemElements()

ss.add_element(location=[[0, 0], [0, 4.7]], EA=to_kN(E * A_kolommen),
               EI=to_kNm2(E * I_kolommen))
ss.add_element(location=[[0, hoogte], [overspanning, hoogte]], EA=to_kN(E * A_ligger),
               EI=to_kNm2(E * I_ligger))
ss.add_element(location=[[overspanning, hoogte], [overspanning, 0]],
               EA=to_kN(E * A_kolommen), EI=to_kNm2(E * I_kolommen))

ss.add_support_hinged(node_id=1)
ss.add_support_hinged(node_id=4)
print(-1.1 * 2 * 5.6 * 1.25 - 1.1 * EG_profiel_ligger - 1.35 * 1.5 * 5.6 * 1.25)
ss.q_load(q=-1.1 * 2 * 5.6 * 1.25 - 1.1 * EG_profiel_ligger - 1.35 * 1.5 * 5.6 * 1.25, element_id=2)
ss.point_load(node_id=2, Fz=- 1.1 * EG_profiel_kolommen * 4.7)
ss.point_load(node_id=3, Fz=- 1.1 * EG_profiel_kolommen * 4.7)
Beispiel #28
0
def plot_truss(x):
    ss = SystemElements()
    p1 = Vertex(0, 0)
    p2 = Vertex(x[30], 0)
    p3 = Vertex(240, 0)
    p4 = Vertex(x[31], 0)
    p5 = Vertex(480, 0)
    p6 = Vertex(x[32], x[33])
    p7 = Vertex(x[34], x[35])
    p8 = Vertex(x[36], x[37])
    verticies = [p1, p2, p3, p4, p5, p6, p7, p8]
    members = [(0, 1),
               (1, 2),
               (2, 3),
               (3, 4),
               (0, 5),
               (1, 5),
               (2, 5),
               (5, 6),
               (1, 6),
               (2, 6),
               (3, 6),
               (6, 7),
               (2, 7),
               (3, 7),
               (4, 7)]
    weight = 0
    for i in range(0, 30, 2):
        if x[i]:
            start = verticies[members[int(i / 2)][0]]
            end = verticies[members[int(i / 2)][1]]
            length = calc_length(start, end)
            area = a[x[i + 1]]
            Ix = ix[x[i + 1]]
            weight += length * area * dens
            EI = e * Ix
            EA = e * area
            ss.add_element(location=[start, end], EA=EA, EI=EI)
    ss.add_support_hinged(1)
    ss.add_support_roll(3)
    ss.add_support_roll(5)
    # ss.q_load(element_id=[1, 2, 3, 4], q=-0.1)
    ss.point_load(node_id=[2, 4], Fz=[-10000, -10000])
    ss.solve()
    # ss.show_structure()
    ss.show_displacement()
Beispiel #29
0
from anastruct.fem.system import SystemElements
# tests parallel direction of the q-load and dead load.

ss = SystemElements()
a = 1
ss.add_element([2, 2], g=a)
ss.add_element([4, 0], g=a)
ss.add_element([6, 2], g=a)
ss.add_element([8, 0], g=a)

ss.add_support_hinged(1)
ss.add_support_hinged(5)

if __name__ == "__main__":
    ss.solve()
    print([a[1] for a in ss.get_node_results_system()])
    ss.show_results()
Beispiel #30
0
def solve_truss(x):
    ss = SystemElements()
    p1 = Vertex(0, 0)
    p2 = Vertex(x[30], 0)
    p3 = Vertex(240, 0)
    p4 = Vertex(x[31], 0)
    p5 = Vertex(480, 0)
    p6 = Vertex(x[32], x[33])
    p7 = Vertex(x[34], x[35])
    p8 = Vertex(x[36], x[37])
    verticies = [p1, p2, p3, p4, p5, p6, p7, p8]
    members = [(0, 1),
               (1, 2),
               (2, 3),
               (3, 4),
               (0, 5),
               (1, 5),
               (2, 5),
               (5, 6),
               (1, 6),
               (2, 6),
               (3, 6),
               (6, 7),
               (2, 7),
               (3, 7),
               (4, 7)]
    weight = 0
    for i in range(0, 30, 2):
        if x[i]:
            start = verticies[members[int(i/2)][0]]
            end = verticies[members[int(i/2)][1]]
            length = calc_length(start, end)
            area = a[x[i+1]]
            Ix = ix[x[i+1]]
            weight += length * area * dens
            EI = e * Ix
            EA = e * area
            ss.add_element(location=[start, end], EA=EA, EI=EI)
    ss.add_support_hinged(1)
    ss.add_support_roll(3)
    ss.add_support_roll(5)
    # ss.q_load(element_id=[1, 2, 3, 4], q=-0.1)
    ss.point_load(node_id=[2, 4], Fz=[-10000, -10000])
    try:
        ss.solve()
        # ss.show_structure()
        # ss.show_reaction_force()
        # ss.show_displacement()
        displ = ss.get_node_displacements()
        phi_1 = np.abs(displ[0][3])
        d2x = np.abs(displ[1][1])
        d2y = np.abs(displ[1][2])
        d3x = np.abs(displ[2][1])
        d4x = np.abs(displ[3][1])
        d4y = np.abs(displ[3][2])
        d5x = np.abs(displ[4][1])
        fitness = [phi_1, d2x, d2y, d3x, d4x, d4y, d5x, weight]
    except:
        fitness = [999, 999, 999, 999, 999, 999, 999, 99999999]
    # print(weight)
    # print(ss.get_node_displacements())
    return fitness
Beispiel #31
0
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.moment_load([2, 3], [20, -20])

if __name__ == "__main__":
    ss.solve()
    ss.show_bending_moment()
from anastruct.fem.system import SystemElements
from anastruct import LoadCase, LoadCombination
import matplotlib.pyplot as plt
import numpy as np

ss = SystemElements()

height = 10

x = np.cumsum([0, 4, 7, 7, 4])
y = np.zeros(x.shape)
x = np.append(x, x[::-1])
y = np.append(y, y + height)

ss.add_element_grid(x, y)
ss.add_element([[0, 0], [0, height]])
ss.add_element([[4, 0], [4, height]])
ss.add_element([[11, 0], [11, height]])
ss.add_element([[18, 0], [18, height]])
ss.add_support_hinged([1, 5])
ss.show_structure()

lc_wind = LoadCase('wind')
lc_wind.q_load(q=-1, element_id=[10, 11, 12, 13, 5])

print(lc_wind)

ss.apply_load_case(lc_wind)
ss.show_structure()

# reset the structure
Beispiel #33
0
from modABC import *
from GColumn_ABC import *
from anastruct.fem.system import SystemElements

# Create a new system object.
ss = SystemElements()
# Add beams to the system.
ss.add_element(location=[[0, 0], [0, 5]],EA=3000000.0, EI=40000)
ss.add_element(location=[[0, 5], [5, 5]],EA=2250000.0, EI=16875)
ss.add_element(location=[[5, 5], [5, 0]],EA=3000000.0, EI=40000)
ss.add_element(location=[[0, 5], [0, 10]],EA=3000000.0, EI=40000)
ss.add_element(location=[[0, 10], [5, 10]],EA=2250000.0, EI=16875)
ss.add_element(location=[[5, 10], [5, 5]],EA=3000000.0, EI=40000)
# Add a fixed support at node 1.
ss.add_support_fixed(node_id=1)
ss.add_support_fixed(node_id=4)
# Add a rotational spring at node 4.
#ss.add_support_spring(node_id=4, translation=3, k=4000)
# Add loads.
ss.point_load(Fx=30, node_id=2)
ss.q_load(q=-100, element_id=2)
ss.point_load(Fx=30, node_id=5)
ss.q_load(q=-100, element_id=5)
ss.show_structure()
ss.solve()
#ss.show_reaction_force()
#ss.show_axial_force()
ss.show_bending_moment()
#ss.show_displacement()

print(ss.get_element_results(element_id=2)['length'])
from anastruct.fem.system import SystemElements
from anastruct.material.profile import HEA
from anastruct.material.units import to_kNm2, to_kN


load_factor = 3

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 anastruct.fem.system import SystemElements

ss = SystemElements()
ss.add_element(location=[[0, 0], [5, 0]], EA=5e9, EI=8000)
ss.add_element(location=[[5, 0], [5, 5]], EA=5e9, EI=4000)
ss.moment_load(Ty=10, node_id=3)
ss.add_support_hinged(node_id=1)
ss.add_support_hinged(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()

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()


Beispiel #37
0
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()
from anastruct.fem.system import SystemElements
import time
import os
import subprocess

save = True
min_ = 1e8
n = 25

for i in range(n):
    t0 = time.time()
    ss = SystemElements()
    el = ss.add_multiple_elements([[0, 0], [10, 10]], n=500)
    ss.point_load(ss.node_map.values(), Fy=1)
    ss.q_load(1, el)
    t = time.time() - t0
    print(t)
    min_ = min(min_, t)

print(f"Best of {n} = {min_} s.")

if save:
    with open("system-creation.csv", "a") as f:
        os.chdir("../../..")
        git_label = str(subprocess.check_output(["git", "describe", "--tags"])).replace('\\n', '').replace("'", "")[1:]
        f.write(f"{git_label}, {min_}\n")
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()
from anastruct.fem.system import SystemElements

ss = SystemElements()

ss.add_element([0, 10])
ss.add_element([5, 10])
ss.add_element([5, 0])

ss.add_support_hinged(1)
ss.add_support_hinged(4)

ss.point_load(2, Fz=-10, rotation=30)

if __name__ == "__main__":
    ss.show_structure()
Beispiel #41
0
from anastruct.fem.system import SystemElements
# tests parallel direction of the q-load and dead load.

ss = SystemElements()

ss.add_element([-2, 2])
ss.add_element([0, 4])
ss.add_element([-2, 6])
ss.add_element([0, 8])

ss.add_support_hinged(1)
ss.add_support_hinged(5)

ss.q_load(1, (1, 2, 3, 4), "x")

if __name__ == "__main__":
    ss.solve()
    print([a[1] for a in ss.get_node_results_system()])
    ss.show_results()
Beispiel #42
0
def build_single_bridge(dna,
                        comb,
                        loc,
                        height,
                        get_ss=False,
                        unit="deflection",
                        EI=15e3,
                        roll=True,
                        support_btm=False,
                        es=False):
    """
    Build a single bridge structure.

    :param dna: (array) DNA from population.
    :param comb: (array) All possible combinations.
    :param loc: (array) All possible locations.
    :param height: (int) Maximum height of the bridge.
    :param unit: (str) Make this important in the fitness score evaluation. {deflection, axial compression,
                                                                         tension, moment)
    :param EI: (flt) Bending stiffness of the structure.
    :param roll: (bool) Add a support that is free in x.
    :param support_btm: (bool) Place the support at the bottom of the grid.
    :param es: (bool) Special code for Evolution Strategies.
    :return: (unit, length, number of elements)
    """
    ss = SystemElements(EI=EI, mesh=3)
    on = np.argwhere(dna == 1).flatten()

    # Add the elements based on the dna
    mirror_line = 0
    for j in on:
        n1, n2 = comb[j]
        l1 = loc[n1]
        l2 = loc[n2]
        ss.add_element([l1, l2])
        mirror_line = max(mirror_line, l1[0], l2[0])

    # add mirrored element
    for j in on:
        n1, n2 = comb[j]
        l1 = loc[n1]
        l2 = loc[n2]
        ss.add_element([mirror(l1, mirror_line), mirror(l2, mirror_line)])

    # Placing the supports on the outer nodes, and the point load on the middle node.
    x_range = ss.nodes_range('x')

    # A bridge of one element is no bridge, it's a beam.
    if len(x_range) <= 2:
        return None
    else:
        length = max(x_range)
        start = min(x_range)
        ids = list(ss.node_map.keys())

        # Find the ids of the middle node for the force application,
        # and the most right node for the support of the bridge
        max_node_id = ids[np.argmax(x_range)]

        for j in range(height):
            middle_node_id = ss.nearest_node(
                "both", np.array([(length + start) / 2, height - j]))
            if middle_node_id:
                break

        if middle_node_id is None:
            middle_node_id = ids[np.argmin(
                np.abs(np.array(x_range) - (length + start) / 2))]

        # Find the support ids in case the supports should be place in the middle.
        if support_btm:
            left_node_id = 1
            right_node_id = max_node_id
        else:
            idx = np.argsort(np.abs(np.arange(height) - height // 2))

            for j in idx:
                left_node_id = ss.nearest_node("both", np.array([start, j]))
                if left_node_id:
                    break
            for j in idx:
                right_node_id = ss.nearest_node("both",
                                                np.array([start + length, j]))
                if right_node_id:
                    break

        # Add support conditions
        ss.add_support_hinged(left_node_id)
        if roll and right_node_id is not None:
            ss.add_support_roll(right_node_id)
        elif right_node_id is not None:
            ss.add_support_hinged(right_node_id)
        ss.point_load(middle_node_id, Fz=-100)

        if ss.validate():
            if get_ss:
                return ss

            ss.solve()

            if unit == "deflection":
                val = np.abs(ss.get_node_displacements(middle_node_id)["uy"])
            elif unit == "axial compression":
                val = -np.min(ss.get_element_result_range("axial"))
            elif unit == "tension":
                val = np.max(ss.get_element_result_range("axial"))
            elif unit == "moment":
                val = np.abs((ss.get_element_result_range("moment")))
            else:
                raise LookupError("Unit is not defined")

            if es:
                return val, length - start, on.size, max(ss.nodes_range('y'))

            return val, length - start, on.size
from anastruct.fem.system import SystemElements
from anastruct.material.profile import HEA
from anastruct.material.units import to_kNm2, to_kN


load_factor = 3

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()
from anastruct.fem.system import SystemElements

"""
Geting section form sectionbase
"""

ss = SystemElements()

ss.add_element([[0, 0], [10, 0]], steelsection='IPE 300', E=210e9, sw=True, orient='z')
ss.add_element([[0, 1], [10, 1]], b=1.0, h=1.0, E=210e9, gamma=20)
ss.add_element([[0, 2], [10, 2]], d=0.6, E=210e9)

if __name__ == '__main__':
    ss.show_structure(verbosity=0, annotations=True)
Beispiel #45
0
from anastruct.fem.system import SystemElements

ss = SystemElements(EI=5e3, EA=1e5)

ss.add_multiple_elements([[0, 0], [0, 10]], 10)

top_node = ss.nearest_node('y', 10) + 1
ss.add_support_roll(top_node, 1)
ss.add_support_hinged(1)

ss.point_load(top_node, Fz=-1)

if __name__ == "__main__":
    print(ss.solve(geometrical_non_linear=True))
    ss.show_displacement()
from anastruct.fem.system import SystemElements
# tests parallel direction of the q-load and dead load.

ss = SystemElements()
a = 1
ss.add_element([3, 0], g=a)
ss.add_element([[3, 0], [6, 3]], g=a)
ss.add_element([12, 3], g=a)
ss.add_element([15, 0], g=a)

ss.add_support_hinged(1)
ss.add_support_hinged(5)

if __name__ == "__main__":
    ss.solve()
    print([a[1] for a in ss.get_node_results_system()])
    ss.show_results()