Пример #1
0
##	print(el_result['length'])
##	print(el_result['Mmin'])
##	print(el_result['Mmax'])

for i in range(1, 4):
    print("element_id" + str(i))
    print(ss.get_element_results(element_id=i))
    print(ss.get_element_results(element_id=i)['length'])
    print(ss.get_element_results(element_id=i)['Mmin'])
    print(ss.get_element_results(element_id=i)['Mmax'])
    print(ss.get_element_results(element_id=i))

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


class Beam:
    def __init__(self, depth, breadth, Asc, Ast, fck, fy, fsc, Asv, spacing):
        self.depth = depth
        self.breadth = breadth
        self.Asc = Asc
        self.Ast = Ast
        self.fck = fck
        self.fy = fy
        self.fsc = fsc
        self.Asv = Asv
Пример #2
0
class connections:
    def __init__(self, main_window, main_window_functions):
        self.mw = main_window
        self.fn = main_window_functions
        self.ss = SystemElements()
        self.ss.color_scheme = "dark"
        self.was_solved = False
        self.states = []

    def add_beam(self):
        try:
            self.workaround()
            e = self.mw.elementtype.currentIndex()

            if self.mw.utilizeinfo.isChecked():
                EI = float(self.fn.filter(self.mw.beam_E.text())) * float(
                    self.fn.filter(self.mw.beam_I.text()))
                EA = float(self.fn.filter(self.mw.beam_E.text())) * float(
                    self.fn.filter(self.mw.beam_A.text()))
                element_types = ["beam", "truss"]
                self.ss.add_element(location=[
                    [
                        float(self.fn.filter(self.mw.beam_x1.text())),
                        float(self.fn.filter(self.mw.beam_y1.text()))
                    ],
                    [
                        float(self.fn.filter(self.mw.beam_x2.text())),
                        float(self.fn.filter(self.mw.beam_y2.text()))
                    ]
                ],
                                    EI=EI,
                                    EA=EA,
                                    element_type=element_types[e])

            else:
                self.ss.add_element(
                    location=[[
                        float(self.fn.filter(self.mw.beam_x1.text())),
                        float(self.fn.filter(self.mw.beam_y1.text()))
                    ],
                              [
                                  float(self.fn.filter(
                                      self.mw.beam_x2.text())),
                                  float(self.fn.filter(self.mw.beam_y2.text()))
                              ]])

            self.visualize_structure()
            self.states.append(pickle.dumps(self.ss))
        except:
            self.fn.warning()

    def beam_info(self):
        if self.mw.utilizeinfo.isChecked():
            self.mw.frame_4.setHidden(False)
        else:
            self.mw.frame_4.setHidden(True)

    def element_type_list(self):
        if self.mw.elementtype.currentIndex() == 1:
            self.mw.beam_I.setEnabled(False)
        elif self.mw.elementtype.currentIndex() == 0:
            self.mw.beam_I.setEnabled(True)

    def add_node(self):
        try:
            if int(self.mw.node_id.text()) in self.ss.node_map.keys():
                self.workaround()
                self.ss.insert_node(element_id=int(self.mw.node_id.text()),
                                    location=[
                                        self.fn.filter(self.mw.node_x.text()),
                                        self.fn.filter(self.mw.node_y.text())
                                    ])
                self.mw.last_figure.click()
                self.states.append(pickle.dumps(self.ss))
            else:
                self.fn.invalid_id_warning()
        except:
            self.fn.warning()

    def add_support(self):
        try:
            if int(self.mw.support_pos.text()) in self.ss.node_map.keys():
                self.workaround()
                if self.mw.support_hinged.isChecked():
                    self.ss.add_support_hinged(
                        node_id=int(self.mw.support_pos.text()))
                elif self.mw.support_roll.isChecked():
                    self.ss.add_support_roll(
                        node_id=int(self.mw.support_pos.text()),
                        angle=float(
                            self.fn.filter(self.mw.support_angle.text())))
                elif self.mw.support_fixed.isChecked():
                    self.ss.add_support_fixed(
                        node_id=int(self.mw.support_pos.text()))
                elif self.mw.support_spring.isChecked():
                    self.ss.add_support_spring(
                        node_id=int(self.mw.support_pos.text()),
                        translation=self.mw.spring_translation.text(),
                        k=self.mw.spring_k.text())
                elif self.mw.support_internal_hinge.isChecked():
                    pass

                self.mw.last_figure.click()
                self.states.append(pickle.dumps(self.ss))
                self.fn.enable_buttons()
            else:
                self.fn.invalid_id_warning()

        except:
            self.fn.warning()

    def show_support_stuff(self):
        if self.mw.support_roll.isChecked():
            self.mw.support_angle.setHidden(
                True)  # Always true due to anaStruct bug
            self.mw.label_113.setHidden(
                True)  # Always true due to anaStruct bug
            self.mw.label_27.setHidden(
                True)  # Always true due to anaStruct bug
            self.mw.label_71.setHidden(True)
            self.mw.label_73.setHidden(True)
            self.mw.spring_k.setHidden(True)
            self.mw.spring_translation.setHidden(True)
        elif self.mw.support_spring.isChecked():
            self.mw.label_71.setHidden(False)
            self.mw.label_73.setHidden(False)
            self.mw.spring_k.setHidden(False)
            self.mw.spring_translation.setHidden(False)
            self.mw.support_angle.setHidden(
                True)  # Always true due to anaStruct bug
            self.mw.label_27.setHidden(True)
            self.mw.label_127.setHidden(False)
        else:
            self.mw.support_angle.setHidden(
                True)  # Always true due to anaStruct bug
            self.mw.label_27.setHidden(True)
            self.mw.label_71.setHidden(True)
            self.mw.label_73.setHidden(True)
            self.mw.spring_k.setHidden(True)
            self.mw.label_113.setHidden(True)
            self.mw.label_127.setHidden(True)
            self.mw.spring_translation.setHidden(True)

    def add_point_load(self):
        try:
            if int(self.mw.load_pos.text()) in self.ss.node_map.keys():
                self.workaround()
                if self.mw.load_moment.text() != '' and float(
                        self.mw.load_moment.text()) != 0:
                    self.ss.moment_load(
                        node_id=int(self.mw.load_pos.text()),
                        Ty=float(self.fn.filter(self.mw.load_moment.text())))

                if float(self.mw.load_y.text()) == 0 and float(
                        self.mw.load_x.text()) == 0 and float(
                            self.mw.load_angle.text()) == 0:
                    pass
                elif self.mw.load_y.text() != '' and self.mw.load_x.text(
                ) != '' and self.mw.load_angle.text() != '':
                    self.ss.point_load(
                        node_id=int(self.mw.load_pos.text()),
                        Fy=float(self.fn.filter(self.mw.load_y.text())),
                        Fx=float(self.fn.filter(self.mw.load_x.text())),
                        rotation=float(
                            self.fn.filter(self.mw.load_angle.text())))
                self.mw.last_figure.click()
                self.states.append(pickle.dumps(self.ss))
                self.fn.enable_buttons()
            else:
                self.fn.invalid_id_warning()
        except:
            self.fn.warning()

    def add_q_load(self):
        try:
            if int(self.mw.qload_pos.text()) in self.ss.node_map.keys():
                if float(self.mw.qload_initial.text()) >= 0 and float(self.mw.qload_final.text()) >= 0 or \
                        float(self.mw.qload_initial.text()) <= 0 and float(self.mw.qload_final.text()) <= 0:
                    self.workaround()
                    if self.mw.qload_initial.text() == '':
                        self.mw.qload_final.setText(
                            self.fn.filter(self.mw.qload_final.text()))
                    if self.mw.qload_final.text() == '':
                        self.mw.qload_final.setText(
                            self.fn.filter(self.mw.qload_initial.text()))
                    self.ss.q_load(
                        element_id=int(self.mw.qload_pos.text()),
                        q=(float(self.fn.filter(self.mw.qload_initial.text())),
                           float(self.fn.filter(self.mw.qload_final.text()))))
                    self.mw.last_figure.click()
                    self.states.append(pickle.dumps(self.ss))
                    self.fn.enable_buttons()
                else:
                    msg = QMessageBox()
                    msg.setWindowTitle(self.mw.warning_title)
                    msg.setText(self.mw.qload_warning)
                    msg.setIcon(QMessageBox.Warning)
                    x = msg.exec_()
            else:
                self.fn.invalid_id_warning()
        except:
            self.fn.warning()

    def visualize_structure(self):
        if self.ss.element_map:
            self.mw.MplWidget.canvas.figure.clear()
            ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
            self.fn.visualize(
                self.ss.show_structure(show=False,
                                       figure=(self.mw.MplWidget.canvas.figure,
                                               ax)))
            ax.patch.set_alpha(0.2)
            self.mw.last_figure = self.mw.show_structure
        else:
            self.mw.MplWidget.plot(has_grid=self.mw.gridBox.isChecked())
            self.fn.figurefix()
            self.mw.last_figure = None

    def visualize_diagram(self):
        self.solve()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_structure(show=False,
                                   free_body_diagram=1,
                                   figure=(self.mw.MplWidget.canvas.figure,
                                           ax)))
        self.mw.last_figure = self.mw.show_diagram

    def visualize_supports(self):
        self.solve()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_reaction_force(
                show=False, figure=(self.mw.MplWidget.canvas.figure, ax)))
        self.mw.last_figure = self.mw.show_supports

    def visualize_normal(self):
        self.solve()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_axial_force(show=False,
                                     figure=(self.mw.MplWidget.canvas.figure,
                                             ax)))
        self.mw.last_figure = self.mw.show_normal

    def visualize_shear(self):
        self.solve()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_shear_force(show=False,
                                     figure=(self.mw.MplWidget.canvas.figure,
                                             ax)))
        self.mw.last_figure = self.mw.show_shear

    def visualize_moment(self):
        self.solve()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_bending_moment(
                show=False, figure=(self.mw.MplWidget.canvas.figure, ax)))
        self.mw.last_figure = self.mw.show_moment

    def visualize_displacement(self):
        self.solve()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_displacement(show=False,
                                      figure=(self.mw.MplWidget.canvas.figure,
                                              ax)))
        self.mw.last_figure = self.mw.show_displacement

    def solve(self):
        self.was_solved = True
        self.ss.solve()

    def static_solver(self, clean=True):
        if find_executable('latex'):
            if self.mw.show_moment.isEnabled():
                if (len(self.ss.supports_roll) == 1 and len(self.ss.supports_hinged) == 1) \
                        or (len(self.ss.supports_fixed) == 1):
                    dialog = QDialog()
                    prompt = PathPrompt(self.mw.language, dialog)
                    dialog.exec_()
                    if not prompt.userTerminated:
                        solve_path = prompt.path
                        file, ok = QFileDialog.getSaveFileName(
                            self.mw, self.mw.pdf_title, self.mw.pdf_text,
                            "PDF (*.pdf)")
                        if ok:
                            try:
                                self.mw.toolBox.setCurrentIndex(0)
                                pdf_dir, filename = split_dir_filename(file)
                                make_pdf_folders(pdf_dir)

                                self.ss.color_scheme = "bright"
                                plt.style.use('default')

                                mn = Manager(self.ss)

                                pdf_generator_thread = PDFGeneratorThread(
                                    mn.generate_pdf,
                                    self.mw.language,
                                    pdf_path=pdf_dir,
                                    filename=filename,
                                    solve_path=solve_path,
                                    path_warning=self.fn.path_warning,
                                )

                                self.fn.setupLoading(pdf_generator_thread)

                                pdf_generator_thread.finished.connect(
                                    self.on_finished)

                                pdf_generator_thread.start()
                                self.mw.loadingScreen.exec_()

                                if not self.mw.loadingUi.userTerminated:
                                    self.fn.pdf_generated_prompt()
                                if clean:
                                    delete_folder(pdf_dir)
                                self.ss.color_scheme = "dark"
                                plt.style.use('dark_background')

                            except:
                                self.fn.latex_packages_warning()
                else:
                    self.fn.static_warning()
            else:
                self.fn.warning()
        else:
            self.fn.latex_warning()

    def on_finished(self):
        self.mw.loadingScreen.close()

    def reset_struct_elems(self):
        self.ss = SystemElements()
        self.ss.color_scheme = "dark"
        self.states.clear()
        self.mw.MplWidget.plot(has_grid=self.mw.gridBox.isChecked())
        self.mw.MplWidget.set_background_alpha()
        self.mw.MplWidget.set_subplot_alpha()
        self.fn.figurefix()
        self.was_solved = False
        self.fn.disable_buttons()

    def load_structure_aux(self, file):
        with open(f'{file}', 'rb') as f:
            self.ss, _, _ = pickle.load(f)
        self.mw.struct_loaded = True

    def workaround(self):
        if self.was_solved:
            self.ss = pickle.loads(self.states[-1])
            self.was_solved = False

    def reset(self):
        self.workaround()
        self.ss.remove_loads()
        self.mw.MplWidget.canvas.figure.clear()
        ax = self.mw.MplWidget.canvas.figure.add_subplot(111)
        ax.patch.set_alpha(0.2)
        self.fn.visualize(
            self.ss.show_structure(show=False,
                                   figure=(self.mw.MplWidget.canvas.figure,
                                           ax)))
        self.states.append(pickle.dumps(self.ss))
        self.fn.disable_buttons()
Пример #3
0
def get_diagram():
    '''
    Recebe um parâmetro numerico que identifica o tipo de diagrama a ser retornado
        0 = Estrutural
        1 = Forças de reação
        2 = Axial
        3 = Cortante
        4 = Fletor
        5 = Displacement ?
    Requisita os parâmetros, via json:
        apoio1 e apoio2, que são os tipos dos apoios
        apoio1pos e apoio2pos, que são as posições dos dois apoios
        cargap, que é a posição da carga
        cargam, que é o módulo da carga
    Tipo dos apoios:
        0 = Primeiro gênerio (roll)
        1 = Segundo gênero (hinged)
        2 = Tercêiro Gênero (fixed)
    '''
    tipo = int(request.args.get('tipo'))

    r = requests.get('https://calculusapi.herokuapp.com/test')
    
    apoio1tipo, apoio2tipo  = r.json().get('apoio1'), r.json().get('apoio2')
    apoio1pos, apoio2pos = r.json().get('apoio1p'), r.json().get('apoio2p')

    cargapos  = r.json().get('cargap')
    cargamod = r.json().get('cargam')

  
    ss = SystemElements()

    #criação da barra
    ss.add_element(location=[[0, 0], [3, 0]])
    ss.add_element(location=[[3, 0], [8, 0]])
    
    #adição do primeiro apoio
    if apoio1tipo == 0:
        ss.add_support_roll(node_id=apoio1pos)
    elif apoio1tipo == 1:
        ss.add_support_hinged(node_id=apoio1pos)
    else:
        ss.add_support_fixed(node_id=apoio1pos)

    
    #adição do segundo apoio
    if apoio2tipo == 0:
        ss.add_support_roll(node_id=apoio2pos)
    elif apoio2tipo == 1:
        ss.add_support_hinged(node_id=apoio2pos)
    else:
        ss.add_support_fixed(node_id=apoio2pos)

    
    #adição da carga
    ss.q_load(element_id=cargapos, q=cargamod)
    
    #geração dos diagramas
    ss.solve()
    img = io.BytesIO()
    if tipo == 0:
        ss.show_structure(show=False).savefig(img)
    elif tipo == 1:
    	ss.show_reaction_force(show=False).savefig(img)
    elif tipo == 2:
    	ss.show_axial_force(show=False).savefig(img)
    elif tipo == 3:
    	ss.show_shear_force(show=False).savefig(img)
    elif tipo == 4:
    	ss.show_bending_moment(show=False).savefig(img)
    elif tipo == 5:
    	ss.show_displacement(show=False).savefig(img) 	
    img.seek(0)
    return send_file(img, mimetype='image/png')
Пример #4
0
def temporary_diagram():
    '''
    Recebe um parâmetro numerico que identifica o tipo de diagrama a ser retornado
        0 = Estrutural
        1 = Forças de reação
        2 = Axial
        3 = Cortante
        4 = Fletor
        5 = Displacement ?
    Requisita os parâmetros, via json:
        apoio1 e apoio2, que são os tipos dos apoios
        apoio1pos e apoio2pos, que são as posições dos dois apoios
        cargap, que é a posição da carga
        cargam, que é o módulo da carga
    Tipo dos apoios:
        0 = Primeiro gênerio (roll)
        1 = Segundo gênero (hinged)
        2 = Tercêiro Gênero (fixed)
    '''
    if not request.args.get('tipo'):
        return "Erro, falta o parametro 'tipo', ex: /get_diagram?tipo=0 "
    

    if not 'parametros' in globals() or parametros == "":
        return "Erro, falta gerar informações, use /generate_new"


    tipo = int(request.args.get('tipo'))

    ss = SystemElements(EI=1900)

    #criação da barra
    ss.add_multiple_elements([[0, 0], [10, 0]], 10)

    
    #adição do primeiro apoio
    addap(ss,parametros['apoios'][0][0],round(int(parametros['apoios'][0][1]['posicao'])/10))
    
    #adição do segundo apoio
    if(round(int(parametros['apoios'][1][1]['posicao'])/10)<11):
        newpos = round(int(parametros['apoios'][1][1]['posicao'])/10)+1
    else:
        newpos = round(int(parametros['apoios'][1][1]['posicao'])/10)
    addap(ss,parametros['apoios'][1][0],newpos)
    
    #adição das cargas pontuais
    if('cargasP' in parametros and parametros['cargasP'] and parametros['cargasP']!=" "):
        
        for cargaP in parametros['cargasP'][0]:
            addloadP(ss,round(int(cargaP['posicao'])/10),-int(cargaP['modulo']))
   

    #adição das cargas distribuidas
    if('cargasD' in parametros and parametros['cargasD'] and parametros['cargasD']!=" "):
        
        for cargaD in parametros['cargasD'][0]:
            addloadD(ss,round(int(cargaD['posicao_i'])/10),round(int(cargaD['posicao_f'])/10),-int(cargaD['modulo']))    


    #adição das cargas triangulares
    if('cargasT' in parametros and parametros['cargasT'] and parametros['cargasT']!=" "):
        
        for cargaT in parametros['cargasT'][0]:
            addloadT(ss,round(int(cargaT['posicao_i'])/10),round(int(cargaT['posicao_f'])/10),int(cargaT['modulo']))    
    
    
    #geração dos diagramas
    ss.solve()
    img = io.BytesIO()
    if tipo == 0:
        ss.show_structure(show=False).savefig(img)
    elif tipo == 1:
    	ss.show_reaction_force(show=False).savefig(img)
    elif tipo == 2:
    	ss.show_axial_force(show=False).savefig(img)
    elif tipo == 3:
    	ss.show_shear_force(show=False).savefig(img)
    elif tipo == 4:
    	ss.show_bending_moment(show=False).savefig(img)
    elif tipo == 5:
    	ss.show_displacement(show=False).savefig(img) 	
    img.seek(0)
    return send_file(img, mimetype='image/jpg')
Пример #5
0
 def accept(self):
     try:
         E = float(self.form.editE.text())  # N/mm2
         I = float(self.form.editI.text())  # mm4
         A = float(self.form.editA.text())  # mm2
         ss = SystemElements()
         frame = FreeCAD.ActiveDocument.getObjectsByLabel(
             self.form.comboBox.currentText())[0]
         sk = frame.Base
         j = 0
         # CREATE MEMBERS OF STRUCTURE
         for l in sk.Geometry:
             sp = [i * 1e-3 for i in list(l.StartPoint)[:2]]
             ep = [i * 1e-3 for i in list(l.EndPoint)[:2]]
             if self.combotypes[j].currentText() == 'beam':
                 ss.add_element([sp, ep], EA=E * A * 1e-3, EI=E * I * 1e-9)
             elif self.combotypes[j].currentText() == 'brace':
                 ss.add_truss_element([sp, ep], EA=E * A * 1e-3)
             j += 1
         # SET DISTRIBUTED LOADS
         if self.form.radioFrame.isChecked():
             for i in list(range(len(sk.Geometry))):
                 if self.form.tableDistrib.item(i, 2):
                     item = self.form.tableDistrib.item(i, 2)
                     try:
                         load = float(item.text())  # kN/m
                         ss.q_load(element_id=(i + 1), q=load)
                     except:
                         pass
         for c in self.combos:
             i = self.combos.index(c) + 1
             # SET NODE CONSTRAINTS
             if c.currentText() == 'fix': ss.add_support_fixed(node_id=i)
             elif c.currentText() == 'hinge':
                 ss.add_support_hinged(node_id=i)
             elif c.currentText() == 'roll':
                 ss.add_support_roll(node_id=i)
             # SET NODE FORCES
             if self.form.tableConc.item(
                     i - 1, 1) or self.form.tableConc.item(i - 1, 2):
                 itemX = self.form.tableConc.item(i - 1, 1)
                 try:
                     loadX = float(itemX.text())  # kN
                 except:
                     loadX = 0
                 itemY = self.form.tableConc.item(i - 1, 2)  # kN
                 try:
                     loadY = float(itemY.text())
                 except:
                     loadY = 0
                 ss.point_load(node_id=(i), Fx=loadX, Fy=loadY)
         # SOLVE AND VALIDATE
         ss.solve()
         # stable=ss.validate(.0000001)
         # SHOW RESULTS ACCORDING THE CALC TYPE
         if True:  #stable:
             if self.form.radioFrame.isChecked():
                 ss.show_results()
             elif self.form.radioTruss.isChecked():
                 ss.show_axial_force()
         else:
             FreeCAD.Console.PrintError('The structure is not stable.\n')
     except:
         FreeCAD.Console.PrintError('Invalid input\n')
         for l in self.labNodes + self.labEl:
             l.removeLabel()
def trussbridge(Ediag,
                Adiag,
                Ebot,
                Abot,
                Etop,
                Atop,
                p,
                w_tri=4,
                h_tri=2,
                num_tri=6,
                disp=False):
    """
    Calculate displacement of middle point in bridge truss

    Args:
         Ediag (list): list of Young's modulus for each pair of diagonal trusses (Pa)
         Adiag (list): list of cross-sectional area for each pair of diagonal trusses (m2)
         Ebot (list): list of Young's modulus for each bottom truss (Pa)
         Abot (list): list of cross-sectional area for each bottom truss (m2)
         Etop (list): list of Young's modulus for each top truss (Pa)
         Atop (list): list of cross-sectional area for each top truss (m2)t
         p (list): list of force applied on the top nodes (N)
         num_tri (int): number of triangles
         disp (bool): display image or not

    """
    Ediag = np.array(Ediag)
    Adiag = np.array(Adiag)
    Ebot = np.array(Ebot)
    Abot = np.array(Abot)
    Etop = np.array(Etop)
    Atop = np.array(Atop)
    EAdiag = Ediag * Adiag
    EAbot = Ebot * Abot
    EAtop = Etop * Atop

    ss = SystemElements()

    # Triangle coord
    x_base = np.arange(0, num_tri + 1) * w_tri
    x_top = np.arange(0, num_tri) * w_tri + h_tri
    y = np.ones(num_tri) * h_tri

    # Create 6 triangles
    for i in range(num_tri):
        p1 = [x_base[i], 0]
        p2 = [x_top[i], y[i]]
        p3 = [x_base[i + 1], 0]
        ss.add_truss_element(location=[p1, p2], EA=EAdiag[i])
        ss.add_truss_element(location=[p2, p3], EA=EAdiag[i])
        ss.add_truss_element(location=[p1, p3], EA=EAbot[i])

    # Create 5 horizontal trusses
    for i in range(num_tri - 1):
        ss.add_truss_element(location=[[x_top[i], y[i]],
                                       [x_top[i + 1], y[i + 1]]],
                             EA=EAtop[i])

    # Create support
    ss.add_support_hinged(node_id=1)
    ss.add_support_roll(node_id=13, direction=2)

    # Create Load
    loadnode = [2, 4, 6, 8, 12]
    for index, point in enumerate(loadnode):
        ss.point_load(node_id=point, Fy=p[index])
        ss.point_load(node_id=point, Fy=p[index])
        ss.point_load(node_id=point, Fy=p[index])
        ss.point_load(node_id=point, Fy=p[index])

    ss.solve()
    disp7 = ss.get_node_displacements(node_id=7)

    if disp is True:
        ss.show_axial_force()
        ss.show_displacement(factor=10)

    return disp7