Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammedsural committed Mar 5, 2024
2 parents be6fe11 + b83c2c7 commit 7664fb3
Show file tree
Hide file tree
Showing 12 changed files with 312 additions and 375 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thanks for opening your first issue in *steeldesign* :raised_hands: Pull requests are always welcome :wink:'
pr-message: 'Thank you for your contribution to *steeldesign* :pray: We will be reviewing your PR shortly :monocle_face:'
issue-message: 'Thanks for opening your first issue in *TSC2018_DESIGN* :raised_hands: Pull requests are always welcome :wink:'
pr-message: 'Thank you for your contribution to *TSC2018_DESIGN* :pray: We will be reviewing your PR shortly :monocle_face:'
8 changes: 5 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Test with pytest
# run: |
# pytest
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest tests.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
2 changes: 1 addition & 1 deletion .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8','3.8','3.10','3.11','3.12']
python-version: ['3.9','3.10','3.11','3.12']

name: Runs tests with python ${{ matrix.python-version }} using ${{ matrix.os }}
steps:
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Muhammed Sural

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers = [
"Operating System :: OS Independent",
]


[project.urls]
"Homepage" = "https://github.com/muhammedsural/TSC2018_Design"
"Bug Tracker" = "https://github.com/muhammedsural/TSC2018_Design/issues"
Binary file added requirements.txt
Binary file not shown.
246 changes: 150 additions & 96 deletions src/SeismicLoad.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<<<<<<< HEAD
import pandas as pd
from dataclasses import dataclass,field,asdict
from TSCResponseSpectra import SeismicResistanceBuildingInputs,SeismicTSC
=======
# import pandas as pd
# from dataclasses import dataclass,field,asdict
>>>>>>> b83c2c7561eead55db774fae1ac9ba4b81b60f1b

#TODO bu bölümdeki geliştirmeler devam etmektedir.
# #TODO bu bölümdeki geliştirmeler devam etmektedir.

<<<<<<< HEAD
@dataclass
class EquivalentLateralLoad:
"""Eşdeğer deprem yükünün hesabi
Expand All @@ -21,13 +27,48 @@ class EquivalentLateralLoad:
VarStruc : SeismicResistanceBuildingInputs = field(default_factory=SeismicResistanceBuildingInputs)
Vte_x : float = field(default=0.0)
Vte_y : float = field(default=0.0)

def __post_init__(self) -> None:
self.calc_Total_Force()

def __repr__(self) -> str:
return super().__repr__()
=======
# @dataclass
# class SeismicInput:
# """
# TL : Spektrum hesabindaki en uç periyot
# R : Yapi davranis katsayisi
# I : Bina onem katsayisi
# D : Dayanim fazlalagi katsayisi
# SDs : Kisa periyot tasarim spektral ivme katsayisi [boyutsuz]
# Sd1 : 1.0 saniye periyot için tasarim spektral ivme katsayisi [boyutsuz]
# """
# SDs : float= field(default_factory=float)
# SD1 : float= field(default_factory=float)
# TL : float= field(default_factory=float)
# R : float= field(default_factory=float)
# I : float= field(default_factory=float)
# D : float= field(default_factory=float)

# @dataclass
# class EquivalentLateralLoad:
# """Eşdeğer deprem yükünün hesabi
# Args
# Floors : Katlarla alakalı bilgilerin tutuldugu DataFrame [Kat,Kat kütlesi,Kat yüksekliği] kütlelerinin tutuldugu DataFrame
# Tpx : X yönündeki doğal titresim periyodu
# Tpy : Y yönündeki doğal titresim periyodu
# SeismicVariables : Sismik verilerin bulunduğu sinif
# """
# Floors : pd.DataFrame
# Tpx : float
# Tpy : float
# Var_Seismic : SeismicInput = field(default_factory=SeismicInput)
# Vte_x : float = 0.0
# Vte_y : float = 0.0
>>>>>>> b83c2c7561eead55db774fae1ac9ba4b81b60f1b

# def __post_init__(self) -> None:
# self.calc_Total_Force()

# def __repr__(self) -> str:
# return super().__repr__()

<<<<<<< HEAD
# Fonksiyon hazır
def get_Total_Mass(self) -> float:
"""Kat kütlelerinden toplam kütlenin hesabi"""
Expand All @@ -39,108 +80,121 @@ def calc_Total_Force(self):
SaR_Tpx = self.TSCSeismic.Get_SaR(T = self.Tpx)
SaR_Tpy = self.TSCSeismic.Get_SaR(T = self.Tpy)
print(f"SaR(Tpx) = {SaR_Tpx}; SaR(Tpy) = {SaR_Tpy} ")

self.Vte_x = round((self.Floors["Masses"].sum() * SaR_Tpx * 9.81),2)
self.Vte_y = round((self.Floors["Masses"].sum() * SaR_Tpy * 9.81),2)

min_Force = round((0.04 * self.Floors["Masses"].sum() * self.Var_Seismic.SeismicVariables.I * self.Var_Seismic.SeismicVariables.SDs * 9.81),2)

if self.Vte_x < min_Force :
print(f"Minimum deprem kuvvetinden az ciktigi icin toplam deprem kuveti revize edildi => {self.Vte_x} < {min_Force} ")
self.Vte_x = min_Force

if self.Vte_y < min_Force :
print(f"Minimum deprem kuvvetinden az ciktigi icin toplam deprem kuveti revize edildi => {self.Vte_y} < {min_Force} ")
self.Vte_y = min_Force
=======
# # Fonksiyon hazır
# def get_Total_Mass(self) -> float:
# """Kat kütlelerinden toplam kütlenin hesabi"""
# return self.Floors["Masses"].sum()

# # Fonksiyon hazır
# def calc_Total_Force(self):
# """Eşdeğer deprem yükü yöntemine göre taban kesme kuvveti hesabi"""
# SaR_Tpx = self.Var_Seismic.Get_SaR(T = self.Tpx)
# SaR_Tpy = self.Var_Seismic.Get_SaR(T = self.Tpy)
# print(f"SaR(Tpx) = {SaR_Tpx}; SaR(Tpy) = {SaR_Tpy} ")
>>>>>>> b83c2c7561eead55db774fae1ac9ba4b81b60f1b

# self.Vte_x = round((self.Floors["Masses"].sum() * SaR_Tpx * 9.81),2)
# self.Vte_y = round((self.Floors["Masses"].sum() * SaR_Tpy * 9.81),2)

# min_Force = round((0.04 * self.Floors["Masses"].sum() * self.Var_Seismic.SeismicVariables.I * self.Var_Seismic.SeismicVariables.SDs * 9.81),2)

# if self.Vte_x < min_Force :
# print(f"Minimum deprem kuvvetinden az ciktigi icin toplam deprem kuveti revize edildi => {self.Vte_x} < {min_Force} ")
# self.Vte_x = min_Force

# if self.Vte_y < min_Force :
# print(f"Minimum deprem kuvvetinden az ciktigi icin toplam deprem kuveti revize edildi => {self.Vte_y} < {min_Force} ")
# self.Vte_y = min_Force

# Fonksiyon hazır değil
def calc_Story_Load(self):
"""Toplam tabana kesme kuvvetinin katlara dagitilmasi"""
# # Fonksiyon hazır değil
# def calc_Story_Load(self):
# """Toplam tabana kesme kuvvetinin katlara dagitilmasi"""

#Kamçı yükü
F_NE_X = 0.0075 * self.Floors["Floors"].count() * self.Vte_x
F_NE_Y = 0.0075 * self.Floors["Floors"].count() * self.Vte_y
# #Kamçı yükü
# F_NE_X = 0.0075 * self.Floors["Floors"].count() * self.Vte_x
# F_NE_Y = 0.0075 * self.Floors["Floors"].count() * self.Vte_y


#Kat yükleri
Force_x = self.Vte_x - F_NE_X
Force_y = self.Vte_y - F_NE_Y
# #Kat yükleri
# Force_x = self.Vte_x - F_NE_X
# Force_y = self.Vte_y - F_NE_Y

Story_Forces = self.Floors.copy()
#df.assign(e=pd.Series(np.random.randn(sLength)).values)
Hi_list =[]
Hi = 0
for i in self.Floors["Height"]:
Hi += i
Hi_list.append(Hi)
Story_Forces["Hi"] = Hi_list
Story_Forces["miHi"] = Story_Forces["Masses"] * Story_Forces["Hi"]
# Story_Forces = self.Floors.copy()
# #df.assign(e=pd.Series(np.random.randn(sLength)).values)
# Hi_list =[]
# Hi = 0
# for i in self.Floors["Height"]:
# Hi += i
# Hi_list.append(Hi)
# Story_Forces["Hi"] = Hi_list
# Story_Forces["miHi"] = Story_Forces["Masses"] * Story_Forces["Hi"]

Total = Story_Forces["miHi"].sum()
# Total = Story_Forces["miHi"].sum()

Vtx = [round((Force_x *(miHi/Total)),2) for miHi in Story_Forces["miHi"]]
Vty = [round((Force_y *(miHi/Total)),2) for miHi in Story_Forces["miHi"]]
# Vtx = [round((Force_x *(miHi/Total)),2) for miHi in Story_Forces["miHi"]]
# Vty = [round((Force_y *(miHi/Total)),2) for miHi in Story_Forces["miHi"]]

Story_Forces["Fx"] = Vtx
Story_Forces["Fy"] = Vty
# Story_Forces["Fx"] = Vtx
# Story_Forces["Fy"] = Vty

return Story_Forces
# return Story_Forces

# Fonksiyon hazır değil
def calc_Approximate_Fundimental_Period(self):
"""Yaklasik periyot hesabi"""
pass
# # Fonksiyon hazır değil
# def calc_Approximate_Fundimental_Period(self):
# """Yaklasik periyot hesabi"""
# pass

# Fonksiyon hazır değil
def Get_Ct(self,BuildingType : int) -> float:
"""
BuildingType : Bina tasiyici sisteminin tipi
0 -> betonarme çerçevelerden oluşan binalar
1 -> çelik çerçevelerden veya çaprazli çelik çerçevelerden oluşan binalar
2 -> Deprem etkilerinin tamaminin betonarme perdeler tarafindan karsilandigi binalar
3 -> Diğer binalar
"""
if BuildingType == 0:
Ct = 0.1
if BuildingType == 1:
Ct = 0.08
if BuildingType == 3:
Ct = 0.07
if BuildingType == 2:
pass
pass

# Fonksiyon hazır değil
def Approximate_Period(self,BuildingType : int) -> float:
"""
BuildingType : Bina tasiyici sisteminin tipi
0 -> betonarme çerçevelerden oluşan binalar
1 -> çelik çerçevelerden veya çaprazli çelik çerçevelerden oluşan binalar
2 -> Deprem etkilerinin tamaminin betonarme perdeler tarafindan karsilandigi binalar
3 -> Diğer binalar
TSC2018-4.7.3.3: DTS = 1, 1a, 2, 2a ve BYS ≥ 6 olan binalarda ve DTS = 3, 3a, 4, 4a olan tüm binalarda hakim doğal titreşim periyodu, 4.7.3.1’den hesaplanmaksizin, doğrudan 4.7.3.4’te verilen ampirik TpA periyodu olarak alinabilir
TpA = Ct HN**(3/4)
HN : Rijit bodrum üstündeki üst yapinin toplam yüksekliği (m)
"""
Ct = self.Get_Ct(BuildingType)
HN = self.Floors["StoryHeight"].sum()
TpA = Ct * HN**(3/4)
return TpA

# Fonksiyon hazır
def calc_Torsional_Coefficient(self,n_bi,isA1 = True) -> float:
"""Eşdeğer deprem yükü hesabi icin ek eksantrisite katsayisinin hesabi"""

if isA1 is True and n_bi> 1.2 and n_bi <= 2.0:
D_bi = (n_bi/1.2)**2
# # Fonksiyon hazır değil
# def Get_Ct(self,BuildingType : int) -> float:
# """
# BuildingType : Bina tasiyici sisteminin tipi
# 0 -> betonarme çerçevelerden oluşan binalar
# 1 -> çelik çerçevelerden veya çaprazli çelik çerçevelerden oluşan binalar
# 2 -> Deprem etkilerinin tamaminin betonarme perdeler tarafindan karsilandigi binalar
# 3 -> Diğer binalar
# """
# if BuildingType == 0:
# Ct = 0.1
# if BuildingType == 1:
# Ct = 0.08
# if BuildingType == 3:
# Ct = 0.07
# if BuildingType == 2:
# pass
# pass

# # Fonksiyon hazır değil
# def Approximate_Period(self,BuildingType : int) -> float:
# """
# BuildingType : Bina tasiyici sisteminin tipi
# 0 -> betonarme çerçevelerden oluşan binalar
# 1 -> çelik çerçevelerden veya çaprazli çelik çerçevelerden oluşan binalar
# 2 -> Deprem etkilerinin tamaminin betonarme perdeler tarafindan karsilandigi binalar
# 3 -> Diğer binalar

# TSC2018-4.7.3.3: DTS = 1, 1a, 2, 2a ve BYS ≥ 6 olan binalarda ve DTS = 3, 3a, 4, 4a olan tüm binalarda hakim doğal titreşim periyodu, 4.7.3.1’den hesaplanmaksizin, doğrudan 4.7.3.4’te verilen ampirik TpA periyodu olarak alinabilir
# TpA = Ct HN**(3/4)
# HN : Rijit bodrum üstündeki üst yapinin toplam yüksekliği (m)
# """
# Ct = self.Get_Ct(BuildingType)
# HN = self.Floors["StoryHeight"].sum()
# TpA = Ct * HN**(3/4)
# return TpA

# # Fonksiyon hazır
# def calc_Torsional_Coefficient(self,n_bi,isA1 = True) -> float:
# """Eşdeğer deprem yükü hesabi icin ek eksantrisite katsayisinin hesabi"""

# if isA1 is True and n_bi> 1.2 and n_bi <= 2.0:
# D_bi = (n_bi/1.2)**2

if isA1 is not True:
D_bi = 1.0
# if isA1 is not True:
# D_bi = 1.0

if n_bi > 2.0 :
return ValueError("nbi degeri 2 den fazla")
# if n_bi > 2.0 :
# return ValueError("nbi degeri 2 den fazla")

return D_bi
# return D_bi


Loading

0 comments on commit 7664fb3

Please sign in to comment.