In [9]:
"""
Created on Wed May 28 15:23:24 2014
@author: chiaracasotto
"""
import numpy as np
import matplotlib.pyplot as plt
from idealisation import bilinear
from idealisation import quadrilinear
import os
import csv
cd = os.getcwd()
input1 = cd+'/inputs/displacements_pushover.csv' # storeys height and displacements at story levels starting from level 0
input2 = cd+'/inputs/reactions_pushover.csv' # Base Reactions [kN]
input3 = cd+'/inputs/building_parameters.csv' # First period of vibration and partecipation factor normalised with respect to top floor
input4 = cd+'/inputs/limits.csv' # Limit States expressed as drifts
In [10]:
with open(input3, 'rb') as f:
reader = csv.reader(f)
newlist = [row for row in reader]
T = [float(ele[1]) for ele in newlist[1:]] # First period
Gamma = [float(ele[2]) for ele in newlist[1:]] # first modal participation factor normalised with respect to the top displ., Dispersions
w = [float(ele[3]) for ele in newlist[1:]] # weight assigned to each building if multiple buildings are input
noStorey = [int(ele[4]) for ele in newlist[1:]]
noBlg = len(T)
H = []
for i in range(1,len(newlist)):
H.append([float(ele) for ele in newlist[i][5:5+int(noStorey[i-1])]])
#H.append(np.array(newlist[i][5:5+int(noStorey[i-1])],float)) # storeys height [m]
with open(input1, 'rb') as f:
reader = csv.reader(f)
newlist = [row for row in reader]
tmp, disp = [],[]
tmp.append([[] for i in range(0,len(newlist))]); tmp = tmp[0]
disp.append([[] for i in range(0,noBlg)]); disp = disp[0]
for i in range(1,len(newlist)):
for ele in newlist[i][2:]:
if ele is not '':
tmp[i-1].append(ele)
j = int((i-1)/noStorey[0])
disp[j].append(abs(np.array(tmp[i-1][:],float)))
with open(input2, 'rb') as f:
reader = csv.reader(f)
newlist = [row for row in reader]
react = newlist[1:]
R, tmp = [],[]
tmp.append([[] for i in range(0,len(react))]); tmp = tmp[0]
for i in range(0,len(react)):
for ele in react[i]:
if ele is not '':
tmp[i].append(ele)
R.append(abs(np.array(tmp[i][1:],float)))
with open(input4, 'rb') as f:
reader = csv.reader(f)
newlist = [row for row in reader]
newlist = [ele[1:] for ele in newlist]
limits = np.array(newlist[1::2],float) #limit states [drifts]
bUthd = np.array(newlist[2::2],float)
if len(limits) < noBlg:
limits = np.repeat(limits,noBlg,axis=0)
bUthd = np.repeat(bUthd,noBlg,axis=0)
bUthd = bUthd.tolist()
limits = limits.tolist()
# Assign damage to each analysis and return displacement profile at each Limit state attainment
droof = []
for blg in range(0,len(disp)):
droof.append(disp[blg][noStorey[blg]-1]) # roof displacements
In [11]:
flag = 1
linew = 2
fontsize = 10
units = ['[m]', '[kN]', '[g]']
In [12]:
blg = 0
droof,Vb = droof[blg],R[blg]
droof = np.array(droof)
Fmax = np.max(Vb)
for index, item in enumerate(Vb):
if item >= Fmax:
break
fmax = index
dmax = droof[fmax]
In [13]:
# Yielding point:
# Vulnerability guidelines method
# Find yielding displacement with equal energy principle n the interval from 0 to Dmax
Areas = np.array([(Vb[i+1]+Vb[i])/2 for i in range(0,fmax)])
dd = np.array([droof[i+1]-droof[i] for i in range(0,fmax)])
Edmax = np.sum(dd*Areas) #Area under the pushover curve in the interval from 0 to Dmax
dy = 2*(dmax-Edmax/Fmax)
Fy = Fmax
In [17]:
# Onset of plateu
# Find were slope of pushover curve before decreasing in the plateu
Vb_norm = Vb/Fy
d_norm = droof/dy
slp = [(Vb_norm[i]-Vb_norm[i-1])/(d_norm[i]-d_norm[i-1]) for i in xrange(1,len(Vb))]
indy_soft = np.nonzero(abs(np.array(slp))>0.3)
fmin = indy_soft[0][-1]
print fmin
Fmin = Vb[fmin]
dmin = droof[fmin]
print Fmin
In [7]:
# Onset of softening
# Find yielding displacement with equal energy principle n the interval from Dmax to Dmin (onset of plateu)
Areas = np.array([(Vb[i+1]+Vb[i])/2 for i in range(fmax,fmin)])
dd = np.array([droof[i+1]-droof[i] for i in range(fmax,fmin)])
Edmin = np.sum(dd*Areas)
ds = 2/(Fmax-Fmin)*(Edmin - (dmin-dmax)*Fmax + 0.5*dmin*(Fmax-Fmin))
du = np.max(droof)
In [18]:
# Residual Plateu
Areas= np.array([(Vb[i+1]+Vb[i])/2 for i in range(fmin,len(Vb)-1)])
dd = np.array([droof[i+1]-droof[i] for i in range(fmin,len(Vb)-1)])
Edplat = np.sum(dd*Areas)
Fres = Edplat/(droof[-1]-dmin)
slp_soft = abs((Fmax-Fmin)/(ds-dmin))
dmin = dmin+(Fmin-Fres)/slp_soft
Fmin = Fres
if flag:
# Plot pushover curve and bilinear curve
plt.plot(droof,Vb,color='b',linewidth=linew,label='pushover input')
x = np.array([0, dy, ds, dmin, du])
y = np.array([0, Fy, Fy, Fmin, Fmin])
plt.plot(x,y,color='r',marker = 'o', linewidth=linew, label='quadrilinear idealisation')
plt.xlabel('roof displacement, droof '+units[0],fontsize = fontsize)
plt.ylabel('base shear, Vb '+units[1],fontsize = fontsize)
plt.suptitle('Pushover curve',fontsize = fontsize)
plt.legend(loc='lower right',frameon = False)
plt.show()
print dy,ds,dmin,du,Fy,Fmax,Fmin
In [ ]: