Пример #1
0
"""

# Example 103
# -----------
# - 2 Trusses with 1 DOF ("Zweibock" with geometric imperfection)
# - material: linear elastic

# import TrussPy (absolute path to local copy if trusspy not installed)
try:
    import trusspy as tp
except ImportError:
    import sys
    sys.path.append(r'../../')
    import trusspy as tp

M = tp.Model('e103_input.xlsx')

M.Settings.dlpf = 0.005
M.Settings.du = 0.05

M.Settings.incs = 250

M.Settings.stepcontrol = True
M.Settings.maxfac = 1

M.Settings.ftol = 8
M.Settings.xtol = 8
M.Settings.nfev = 8

M.Settings.dxtol = 1.25
Пример #2
0
"""

# Example NTA (A)
# ---------------
# - 3D truss system
# - material: linear elastic

# import TrussPy (absolute path to local copy if trusspy not installed)
try:
    import trusspy as tp
except ImportError:
    import sys
    sys.path.append(r'../../')
    import trusspy as tp

M = tp.Model('eNTA_X_input.xlsx', logfile=True)

M.Settings.dlpf = 0.005
M.Settings.du = 0.05

M.Settings.incs = 180

M.Settings.stepcontrol = True
M.Settings.maxfac = 1

M.Settings.ftol = 8
M.Settings.xtol = 8
M.Settings.nfev = 8

M.Settings.dxtol = 1.25
Пример #3
0
"""

# Example 201
# -----------
# - 1 Truss with 1 DOF
# - material: linear elastic - plastic (isotropic hardening)

# import TrussPy (absolute path to local copy if trusspy not installed)
try:
    import trusspy as tp
except ImportError:
    import sys
    sys.path.append(r'../../')
    import trusspy as tp

M = tp.Model('e201_input.xlsx')
M.Settings.nstatev = 2

# Create Model, Run, show Results
M.build()
M.run()

# model plot: undeformed and deformed configuration for last increment
fig, ax = M.plot_model(config=['undeformed', 'deformed'],
                       view='xz',
                       contour='force',
                       lim_scale=2,
                       force_scale=0.2,
                       inc=-1)
fig.savefig('model_contour-force_inc-last.pdf')
Пример #4
0
# -----------
# - 1 Truss with 1 DOF
# - material: linear elastic

# import TrussPy (absolute path to local copy if trusspy not installed)
import numpy as np
try:
    import trusspy as tp
except ImportError:
    import sys
    sys.path.append(r'../../')
    import trusspy as tp

nnodes = 2

M = tp.Model()

M.Settings.du = 0.1
M.Settings.dlpf = 0.05
M.Settings.incs = (20, 20, 20, 20)
M.Settings.xlimit = (1, 1)
M.Settings.nsteps = 4
M.Settings.stepcontrol = False

NN = []
for i in range(1, nnodes + 1):
    N = tp.Node(i, (0, 0, -(i - 1) / (nnodes - 1)))
    NN.append(N)

EE = []
for i in range(1, nnodes):
Пример #5
0
# Example 302
# -----------
# - 2 Trusses with 1 DOF
# - material: linear elastic - plastic (isotropic hardening)
# - 2 steps with restart after fixed amount of increments

# import TrussPy (absolute path to local copy if trusspy not installed)
try:
    import trusspy as tp
except ImportError:
    import sys
    sys.path.append(r'../../')
    import trusspy as tp

M = tp.Model('e302_input.xlsx')

M.Settings.dlpf = 0.05
M.Settings.du = 0.05

M.Settings.incs = (170, 10)
M.Settings.xlimit = ((0, 1), (0, 1))

M.Settings.stepcontrol = True
M.Settings.maxfac = 1

M.Settings.ftol = 8
M.Settings.xtol = 8
M.Settings.nfev = 8

M.Settings.dxtol = 1.25
Пример #6
0
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 17:29:06 2018

@author: adutz
"""

# Example 102
# -----------
# - 2 Trusses with 1 DOF
# - material: linear elastic

# import TrussPy
import trusspy as tp

M1 = tp.Model(logfile=False)

with M1.Nodes as MN:
    MN.add_node(1, coord=(0, 0, 0))
    MN.add_node(2, coord=(1, 0, 3))
    MN.add_node(3, coord=(2, 0, 0))

with M1.Elements as ME:
    ME.add_element(1, conn=(1, 2), gprop=[1])
    ME.add_element(2, conn=(2, 3), gprop=[1])

    E = 1  # elastic modulus
    ME.assign_material('all', [E])

with M1.Boundaries as MB:
    MB.add_bound_U(1, (0, 0, 0))
Пример #7
0
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 17:29:06 2018

@author: adutz
"""

# Example NTA (A)
# ---------------
# - 3D truss system
# - material: linear elastic

# import TrussPy
import trusspy as tp

M = tp.Model(logfile=False)

with M.Nodes as MN:
    MN.add_node( 1, coord=( 2.5 , 0   , 0  ))
    MN.add_node( 2, coord=(-1.25, 1.25, 0  ))
    MN.add_node( 3, coord=( 1   , 2   , 0  ))
    MN.add_node( 4, coord=(-0.5 , 1.5 , 1.5))
    MN.add_node( 5, coord=(-2.5 , 4.5 , 2.5))

with M.Elements as ME:
    ME.add_element( 1, conn=(1,4), gprop=[0.75] )
    ME.add_element( 2 ,conn=(2,4), gprop=[1   ] )
    ME.add_element( 3, conn=(3,4), gprop=[0.5 ] )
    ME.add_element( 4, conn=(3,5), gprop=[0.75] )
    ME.add_element( 5, conn=(2,5), gprop=[1   ] )
    ME.add_element( 6, conn=(4,5), gprop=[1   ] )
Пример #8
0
from Function import *

# Input parameters
truss_input_file = "truss1.xlsx"
sol_per_pop = 8
num_parents_mating = 4
num_weights = 10

# Defining the population size.
pop_size = (sol_per_pop, num_weights)

# Creating the initial population.
new_population = np.random.uniform(low=0.006, high=0.0085, size=pop_size)

M = tp.Model(truss_input_file, logfile=False, log=0, print_term=False)
M.Settings.log = 0
ga_truss = GA_truss(M)

# Generic Algorithm
best_outputs_fit = [15000]
best_outputs_W = [2000]

num_generations = 20000

file_name = 'first'
data = []
Dataframe = pd.DataFrame()

for generation in range(num_generations):
Пример #9
0
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 17:29:06 2018

@author: adutz
"""

import numpy as np

# import TrussPy
import trusspy as tp
import matplotlib.pyplot as plt

M = tp.Model('tests/Input_NTA_X.xlsx', logfile=True)

M.Settings.dlpf = 0.005
M.Settings.du = 0.05

M.Settings.incs = (180, 10)
M.Settings.xlimit = ((0, 1), (0, 1))
#M.Settings.cycl = 10

M.Settings.stepcontrol = True
M.Settings.maxfac = 1

M.Settings.ftol = 8
M.Settings.xtol = 8
M.Settings.nfev = 8

M.Settings.dxtol = 1.25
Пример #10
0
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 17:29:06 2018

@author: adutz
"""

# Example NTA (A)
# ---------------
# - 3D truss system
# - material: linear elastic

# import TrussPy
import trusspy as tp

M = tp.Model(logfile=True)

with M.Nodes as MN:
    MN.add_node( 1, coord=( 2.5 , 0   , 0  ))
    MN.add_node( 2, coord=(-1.25, 1.25, 0  ))
    MN.add_node( 3, coord=( 1   , 2   , 0  ))
    MN.add_node( 4, coord=(-0.5 , 1.5 , 1.5))
    MN.add_node( 5, coord=(-2.5 , 4.5 , 2.5))

with M.Elements as ME:
    ME.add_element( 1, conn=(1,4), gprop=[0.75] )
    ME.add_element( 2 ,conn=(2,4), gprop=[1   ] )
    ME.add_element( 3, conn=(3,4), gprop=[0.5 ] )
    ME.add_element( 4, conn=(3,5), gprop=[0.75] )
    ME.add_element( 5, conn=(2,5), gprop=[1   ] )
    ME.add_element( 6, conn=(4,5), gprop=[1   ] )
Пример #11
0
"""

# Example 101
# -----------
# - 1 Truss with 1 DOF
# - material: linear elastic

# import TrussPy (absolute path to local copy if trusspy not installed)
try:
    import trusspy as tp
except ImportError:
    import sys
    sys.path.append(r'../../')
    import trusspy as tp

M = tp.Model('e101_input.xlsx', logfile=False)

# Create Model, Run, show Results
M.build()
M.run()

# model plot: undeformed and deformed configuration for last increment
fig, ax = M.plot_model(config=['undeformed', 'deformed'],
                       view='xz',
                       contour='force',
                       lim_scale=2,
                       force_scale=0.2,
                       inc=-1)
fig.savefig('model_contour-force_inc-last.pdf')

# history plot