ATC40 - Capacity Spectrum Method

In [2]:
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")

from streng.tools.bilin import Bilin
import streng.codes.eurocodes.ec8.cls.seismic_action.spectra as spec_ec8
from streng.codes.usa.atc40.nl_static_analysis.csm import CapacitySpectrumMethod
from streng.codes.usa.atc40.nl_static_analysis.csm import StructureProperties
from streng.codes.usa.atc40.nl_static_analysis.csm import Demand
In [4]:
bl = Bilin()
# bl.load_space_delimited(r'D:/MyBooks/TEI/RepairsExample/sapfiles/fema/PushoverCurve_modal.pushcurve', ' ')
bl.load_space_delimited(r'http://seivas.net/mkd/PushoverCurve_modal.pushcurve', ' ')

mystructure = StructureProperties(m = np.array([39.08, 39.08, 39.08]),
                                  φ = np.array([0.0483, 0.0920, 0.1217]),
                                  T0 = 0.753,
                                  pushover_curve_F = bl.y_ini,
                                  pushover_curve_δ = bl.x_ini,
                                  behavior ='A')
In [5]:
T_range = np.linspace(1e-10, 4, 401)

mydemand = Demand(T_range=T_range,
                  Sa=None,
                  Sd=None,
                  TC=None)

mydemand.ec8_elastic(αgR=0.24*9.81,
                          γI=1.0,
                          ground_type = 'C',
                          spectrum_type = 1,
                          η =1.0,
                          q=1.0,
                          β=0.2)
In [6]:
mycsm = CapacitySpectrumMethod(structure = mystructure,
                               demand = mydemand,
                               first_try_case = 'intersection')
In [7]:
print(f'PF1 = {mycsm.structure.PF1:.4f}')
print(f'α1 = {mycsm.structure.α1:.4f}')
print(f'φroof1 = {mycsm.structure.φroof1:.4f}')
PF1 = 10.2313
α1 = 0.8935
φroof1 = 0.1217
In [8]:
plt.plot(mycsm.structure.Sd, mycsm.structure.Sa)
plt.ylabel('$F$ (kN)')
plt.xlabel('$δ$ (m)') #'μθpl'
plt.title('Καμπύλη αντίστασης')
plt.show()
../../_images/jupyters_tools_capacity_spectrum_method_class-Copy1_6_0.png
In [9]:
plt.plot(mycsm.demand.Sd, mycsm.demand.Sa, lw=2, label='Sa-Sd')
plt.ylabel('$S_{a}$ (g)')
plt.xlabel('$S_{d}$ (m)')
plt.title('EC8 elastic spectrum: Sa-Sd')
plt.legend()
plt.show()
../../_images/jupyters_tools_capacity_spectrum_method_class-Copy1_7_0.png
In [10]:
print(mycsm.Sd_first_try)
0.13938832648876784
In [11]:
mycsm.calc_performance_point()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-2c4e9769a92e> in <module>()
----> 1 mycsm.calc_performance_point()

d:\mypythons\streng\streng\codes\usa\atc40\nl_static_analysis\csm.py in calc_performance_point(self)
     98         self.output.log_table.dict_list.append({'__iteration': iter_num, 'Sd': x_i, 'error': None})
     99         while error > 0.0001:
--> 100             x_new = self.__iterate_SR(x_i)
    101             error = abs((x_new - x_i) / x_i)
    102             x_i = x_new

d:\mypythons\streng\streng\codes\usa\atc40\nl_static_analysis\csm.py in __iterate_SR(self, x0)
     75         βeff = csm_atc40.βeff(0.05, β0, self.structure.behavior)
     76
---> 77         Teff = bl.bilinear_curve.Teq
     78
     79         SRA = csm_atc40.SRA(βeff, self.structure.behavior)

AttributeError: 'BilinearCurve' object has no attribute 'Teq'
In [10]:
mycsm.output.log_table.to_panda_dataframe()
Out[10]:
__iteration Sd error
0 0 0.139388 NaN
1 1 0.043617 0.687084
2 2 0.085547 0.961326
3 3 0.049350 0.423121
4 4 0.072952 0.478248
5 5 0.053535 0.266160
6 6 0.066271 0.237905
7 7 0.056746 0.143728
8 8 0.062699 0.104911
9 9 0.058640 0.064749
10 10 0.061207 0.043774
11 11 0.059498 0.027915
12 12 0.060598 0.018491
13 13 0.059874 0.011954
14 14 0.060343 0.007845
15 15 0.060036 0.005097
16 16 0.060236 0.003327
17 17 0.060105 0.002163
18 18 0.060190 0.001409
19 19 0.060135 0.000916
20 20 0.060171 0.000596
21 21 0.060147 0.000388
22 22 0.060163 0.000252
23 23 0.060153 0.000164
24 24 0.060159 0.000107
25 25 0.060155 0.000070
In [11]:
mycsm.first_try_case = 'equal displacements'
In [12]:
mycsm.calc_performance_point()
solution: Sd = 0.0602m
In [13]:
mycsm.output.log_table.to_panda_dataframe()
Out[13]:
__iteration Sd error
0 0 0.077466 NaN
1 1 0.051766 0.331765
2 2 0.068702 0.327165
3 3 0.055599 0.190713
4 4 0.063828 0.148007
5 5 0.058016 0.091057
6 6 0.061673 0.063023
7 7 0.059221 0.039762
8 8 0.060791 0.026514
9 9 0.059753 0.017068
10 10 0.060424 0.011236
11 11 0.059984 0.007290
12 12 0.060270 0.004768
13 13 0.060083 0.003100
14 14 0.060205 0.002021
15 15 0.060125 0.001313
16 16 0.060177 0.000855
17 17 0.060143 0.000556
18 18 0.060165 0.000362
19 19 0.060151 0.000236
20 20 0.060160 0.000153
21 21 0.060154 0.000100