In [8]:
"""
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 [9]:
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 [10]:
flag = 1
linew = 2
fontsize = 10
units = ['[m]', '[kN]', '[g]']
In [5]:
blg = 0
droof,Vb = droof[blg],R[blg]
In [6]:
# FEMA method
droof = np.array(droof)
Fy = np.max(Vb)
du = np.max(droof)
for index, item in enumerate(Vb):
if item >= Fy:
break
Ay = 0.6*Fy
Ax = np.interp(Ay, Vb[0:index],droof[0:index])
slp = Ay/Ax
dy = Fy/slp
In [7]:
if flag:
# Plot pushover curve and bilinear curve
plt.plot(droof,Vb,color='b',label='pushover input',linewidth=linew)
x = np.array([0, dy,du])
y = np.array([0, Fy, Fy])
plt.plot(x,y,color='r',marker = 'o',linewidth=linew,label='bilinear 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,du,Fy]
In [ ]: