Analisis Dinamico Eje X
Analisis Dinamico Eje X
Analisis Dinamico Eje X
—————————————————————————————————————————
—————————————
Análisis Dinámico Modal Espectral
Docente: Ing. Omar Caballero Sanchez
Curso: Ingenieria Antisismica
Grupo: 11
Estudiantes:
Carhuapoma Chahuayo, Branny Aldair
Hidalgo Ayaipoma, John Alexander
Huaman Matamoros Jaime
—————————————————————————————————————————
—————————————
[1]: import numpy as np
import pandas as pd
from sympy import *
from funciones import *
import matplotlib.pyplot as plt
from tabulate import tabulate
from IPython.core.interactiveshell import InteractiveShell
from IPython.display import display, Latex
#Configuraciones para grafico
tabulate.PRESERVE_WHITESPACE = True
tabulate.WIDE_CHARS_MODE = False
#-------------------------------------
# Some plot settings
#-------------------------------------
#plt.style.use('ggplot')
plt.rcParams['lines.linewidth'] = 2.0
plt.rcParams['lines.color'] = 'black'
plt.rcParams['legend.frameon'] = True
plt.rcParams['font.family'] = 'serif'
plt.rcParams['legend.fontsize'] = 14
plt.rcParams['font.size'] = 16
1
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.top'] = False
plt.rcParams['axes.spines.left'] = True
plt.rcParams['axes.spines.bottom'] = True
plt.rcParams['axes.axisbelow'] = True
#-------------------------------------
# Some plot functions
#-------------------------------------
def graf01(par_x,par_y,factor,color,title,xlabel,ylabel,label):
#Definimos los parametros del plot
plt.rcParams['font.size'] = 14
plt.figure(u'Espectro de Diseño Sismico', figsize=(8, 5), tight_layout =␣
↪True)
if factor>0:
kk = len(par_y)
aux_factor = factor*np.ones((kk,1))
plt.plot(aux_factor,par_y,'#FF5733',linewidth=2, marker =␣
↪'^',markersize = 10,label ='Deriva permitida')
H = np.array([385, 325, 325, 325, 325, 325, 325, 325, 325]) #cm
#Parametros sismicos
Z = 0.45
U = 1.50
S = 1.10
R = 4.8
TP = 1
TL = 1.6
g = 981 #cm/s
2
[3]: n = len(k)
K = np.zeros((n,n))
for i in range(n-1):
K[i,i] = k[i] + k[i+1]
K[i,i+1] = -k[i+1]
K[i+1,i] = -k[i+1]
if i==(n-2):
K[i+1,i+1] = k[i+1]
Matrix(np.round(K,3))
[3]: 326.48 −123.7 0 0 0 0 0 0 0
⎡−123.7 226.82 −103.12 0 0 0 0 0 0 ⎤
⎢ ⎥
⎢ 0 −103.12 206.24 −103.12 0 0 0 0 0 ⎥
⎢ 0 0 −103.12 206.24 −103.12 0 0 0 0 ⎥
⎢ 0 0 0 −103.12 206.24 −103.12 0 0 0 ⎥
⎢ ⎥
⎢ 0 0 0 0 −103.12 206.24 −103.12 0 0 ⎥
⎢ 0 0 0 0 0 −103.12 206.24 −103.12 0 ⎥
⎢ 0 0 0 0 0 0 −103.12 188.51 −85.39⎥
⎣ 0 0 0 0 0 0 0 −85.39 85.39 ⎦
3
list_niveles = []
for i in range(n):
head_modos.append("Modo " + str(i+1))
head_modos_norm.append("Modo norm " + str(i+1))
list_niveles.append("Nivel " + str(i+1))
index.append("")
aux[i,0] = val2[i]
aux[i,1] = val[i]
aux[i,2] = TT[i]
[5]: �i² �i Ti
Modo 1 7.77174 2.78778 2.25383
Modo 2 64.37125 8.02317 0.78313
Modo 3 158.52849 12.59081 0.49903
Modo 4 284.68904 16.87273 0.37239
Modo 5 438.76785 20.94679 0.29996
Modo 6 593.30781 24.35791 0.25795
Modo 7 705.47871 26.56085 0.23656
Modo 8 819.76494 28.63154 0.21945
Modo 9 922.79988 30.37762 0.20684
[6]: n = len(K)
formas = np.zeros((n,n))
KT = K[1:,1:]
AT = K[1:,0]
MT = M[1:,1:]
for j in range(n):
aux = np.dot(np.linalg.inv(KT - val2[j] * MT),(-AT))
#ordenar valores
for i in range(n):
if i==0:
formas[i,j]=1
else:
formas[i,j]=aux[i-1]
4
print("\033[1;34m" + " ")
print("\nMatriz de formas modales")
Modo 9
Nivel 1 1.0000
Nivel 2 -1.9133
Nivel 3 4.7879
Nivel 4 -6.8807
Nivel 5 7.8502
Nivel 6 -7.5378
Nivel 7 5.9948
Nivel 8 -3.4729
Nivel 9 1.1849
#Lineas en el texto
#Coordenadas
coor = []
coorx = []
for i in range(n):
coorxaux = np.append([0],formas[:,i])
#print(coorxaux)
5
coorx.append(coorxaux)
coord = np.zeros((n,4))
for j in range(n):
coord[j,0] = 0
coord[j,1] = coorxaux[j+1]
coord[j,2] = coory[j+1]
coord[j,3] = coory[j+1]
#print(j)
coor.append(coord)
fig1.tight_layout()
plt.suptitle(u'Modos de Vibración\n', fontsize=40, color="black")
#Realizamos los subplots
for i in range(1,n+1):
ax = plt.subplot(filas,3,i)
ax.plot(coorx[i-1],coory,'b', marker = 'o',markersize = 8)
ax.plot(zeros,coory,'b',linewidth=0.8, marker = '^',markersize = 12)
#Agregamos grafico de lineas
x,y = transform_xy(coor[i-1])
plt.plot(x, y,'b-',linewidth = 0.8)
#Agregamos las etiquetas al texto
aux = coorx[i-1]
for j in range(n+1):
ax.text(aux[j]+0.08,coory[j]+0.03,"({:.3f})".format(aux[j]),fontsize=11)
ax.set_title('Modo ' + str(i))
plt.show()
del aux
6
7
[8]: #Variables usadas
# n: tamaño de elementos
#formas_norm : Matriz de formas normalizadas
#phi : Matriz para extraer los modos
#aux : Variable auxiliar para calcular
#res : Variables de resultados
n = len(K)
formas_norm = np.zeros((n,n))
res = []
for i in range(n):
phi = formas[:,i:i+1]
aux = np.sqrt(phi.transpose() @ M @ phi)
res.append(aux[0,0])
aux = phi/res[i]
for j in range(n):
formas_norm[j,i] = aux[j,0]
#Limpieza de variables
del aux
#Valores de sqrt(Si)
#Matrix(np.round(res,3))
[9]: Si
Modo 1 14.603462
Modo 2 4.467210
Modo 3 2.755189
Modo 4 2.395626
Modo 5 2.098587
Modo 6 1.487976
Modo 7 1.417899
Modo 8 3.293558
Modo 9 10.236653
[10]: Modo norm 1 Modo norm 2 Modo norm 3 Modo norm 4 Modo norm 5 \
0.0685 0.2239 0.3630 0.4174 0.4765
0.1781 0.5197 0.6741 0.5154 0.2262
0.3016 0.6814 0.4302 -0.2144 -0.6472
8
0.4154 0.6608 -0.0972 -0.6905 -0.3399
0.5157 0.4633 -0.5606 -0.3493 0.5875
0.5994 0.1418 -0.6544 0.4053 0.4432
0.6637 -0.2177 -0.3169 0.6802 -0.5096
0.7066 -0.5189 0.2294 0.1499 -0.5327
0.7308 -0.7149 0.7067 -0.7047 0.6130
[11]: #Calculo de C
C = np.array([])
n = len(K)
for i in range(n):
if (TT[i] <= TP):
C = np.append(C,[2.5])
elif (TP < TT[i]) and (TT[i]< TL):
C = np.append(C,2.5*(TP/TT[i]))
else:
C = np.append(C,2.5*(TP*TL/(TT[i]**2)))
#Calculo de Sa
Sa = Z * U * C * S / R * g
#Calculo de Sd
Sd = Sa/val**2
#Sd = np.array([])
#for i in range(n):
# Sd = np.append(Sd, Sa[i]/(val[i]**2) )
9
#Pseudoaceleraciones y desplazamientos
print("\033[1;34m" + " ")
print("Tabla pseudoaceleraciones y desplazamientos espectrales")
#Matriz de modos normalizados
column_values = ['Ti', '�i', 'C', 'Sa', 'Sd']
df = pd.DataFrame(aux,index, column_values)
df.style.set_table_attributes('style="font-size: 16px"')
#pd.set_option('display.float_format', '{:,.2f}'.format)
df
[12]: Ti �i C Sa Sd
2.253828 2.787783 0.787442 119.493018 15.375331
0.783130 8.023169 2.500000 379.371094 5.893487
0.499029 12.590810 2.500000 379.371094 2.393078
0.372387 16.872731 2.500000 379.371094 1.332581
0.299959 20.946786 2.500000 379.371094 0.864628
0.257953 24.357911 2.500000 379.371094 0.639417
0.236558 26.560849 2.500000 379.371094 0.537750
0.219450 28.631538 2.500000 379.371094 0.462780
0.206836 30.377621 2.500000 379.371094 0.411109
#Sumna de cuadrados
for i in range(n):
sum_square += �i[i,0]**2
percent = np.array([])
for i in range(n):
percent = np.append(percent, �i[i]**2/sum_square )
head_1 = ['Τ','%']
df = pd.DataFrame(aux,head_modos,head_1)
#df.style.set_table_attributes('style="font-size: 16px"')
10
df
print("\033[1;30m" + " ")
print("Nota: La tabla nos indica la cantidad de masa que participa en cada modo␣
↪y que tan importante es ese modo ")
[14]: Τ %
Modo 1 1.786698 77.071932
Modo 2 0.705175 12.005695
Modo 3 0.464266 5.203872
Modo 4 0.297328 2.134345
Modo 5 0.220223 1.170901
Modo 6 0.229694 1.273774
Modo 7 0.202720 0.992169
Modo 8 0.075105 0.136187
Modo 9 0.021466 0.011125
Nota: La tabla nos indica la cantidad de masa que participa en cada modo y que
tan importante es ese modo
[15]: UD = []
for i in range(n):
phi_norm = formas_norm[:,i:i+1]
UD.append(�i[i]*Sd[i]*phi_norm)
Modo 1
------------------------
11
Nivel 7 18.233192
Nivel 8 19.410753
Nivel 9 20.075374
Modo 2
------------------------
Modo 3
------------------------
Modo 4
------------------------
12
Nivel 7 0.269486
Nivel 8 0.059397
Nivel 9 -0.279217
Modo 5
------------------------
Modo 6
------------------------
Modo 7
------------------------
13
Nivel 7 0.043382
Nivel 8 -0.062677
Nivel 9 0.031257
Modo 8
------------------------
Modo 9
------------------------
[17]: Dr = []
for i in range(n):
indi = 0
dif = 0
aux_matrix = np.zeros((n,1))
aux = UD[i]
for j in range(n):
indi = n-j-1
if indi==0:
dif = aux[indi]
else:
14
dif = aux[indi] - aux[indi-1]
aux_matrix[indi,0] = dif
Dr.append(aux_matrix)
del aux,aux_matrix,indi,dif
Δ = []
for i in range(n):
aux_matrix = np.zeros((n,1))
aux_derivas = Dr[i]
for j in range(n):
aux_matrix[j,0] = aux_derivas[j,0]/H[i]
Δ.append(aux_matrix)
Modo 1
---------------------------
15
Modo 2
---------------------------
Modo 3
---------------------------
Modo 4
---------------------------
16
Modo 5
---------------------------
Modo 6
---------------------------
Modo 7
---------------------------
17
Modo 8
---------------------------
Modo 9
---------------------------
#Mostramos en pantalla
df = pd.DataFrame(ccU,list_niveles,['C²U [cm]'])
#df.style.set_table_attributes('style="font-size: 14px"')
df
18
aux_H = np.concatenate(([0],H))
graf01(aux_ccU,coory,0,'#008080',u'Gráfico de␣
↪Desplazamientos\n','Desplazamientos(cm)','Piso','Desplazamientos')
#Mostramos en pantalla
19
df = pd.DataFrame(ccΔ,list_niveles,[' C²Δ [cm]'])
#df.style.set_table_attributes('style="font-size: 14px"')
df
[21]: #Factores
drift_max = 0.007
factor_der = 0.75
#Calculos
20
Δine = factor_der * R * ccΔ
condition = []
for i in range(n):
if Δine[i] < drift_max:
condition.append('Accepted')
else:
condition.append('Rejected')
df = pd.DataFrame()
df['Δine = 0.75R'] = Δine
df['Limite'] = drift_max
df['Condición'] = condition
#Mostramos en pantalla
#df.style.set_table_attributes('style="font-size: 14px"')
df
21
[22]: InteractiveShell.ast_node_interactivity = "last_expr"
#Funcion para calculo de C
def values_C(T,TP,TL):
C = np.array([])
n = len(T)
for i in range(n):
if (T[i] <= TP):
C = np.append(C,[2.5])
elif (TP < T[i]) and (T[i]< TL):
C = np.append(C,2.5*(TP/T[i]))
else:
C = np.append(C,2.5*(TP*TL/(T[i]**2)))
return C
22
for i in range(nn):
coord[i,0] = aux[i]
coord[i,1] = aux[i]
coord[i,2] = 0
coord[i,3] = acele[i]
tt,aa = transform_xy(coord[0:2,:])
xx,yy = transform_xy(coord[2:nn,:])
%matplotlib inline
plt.rcParams['font.size'] = 16
#Definimos los parametros del plot
plt.figure(u'Espectro de Diseño Sismico', figsize=(15, 7.5), tight_layout =␣
↪True)
plt.show()
23
24