Skip to content

Commit 466d06f

Browse files
authored
Add files via upload
1 parent f8d8e02 commit 466d06f

File tree

3 files changed

+216
-1
lines changed

3 files changed

+216
-1
lines changed

Prueba/Main_menu.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import streamlit as st
2+
# from streamlit_option_menu import option_menu
3+
4+
# # --- Page Setup ---
5+
6+
# about_Me = st.Page(
7+
# page = 'pages/about_me.py',
8+
# title = "About Me",
9+
# # icon = "😎",
10+
# )
11+
12+
# project_1_page = st.Page(
13+
# page = 'pages/SpecNec_executable_streamlit.py',
14+
# # title = "Spec NEC",
15+
# default= True,
16+
# )
17+
18+
# ## --- Navigation
19+
20+
# pg = st.navigation(
21+
# {
22+
# "info": [about_Me],
23+
# "Basic Apps": [project_1_page],
24+
# }
25+
# )
26+
27+
# pg.run()

Prueba/pages/SpecNec_App.py

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
import streamlit as st
2+
import numpy as np
3+
import pandas as pd
4+
import matplotlib.pyplot as plt
5+
6+
#########
7+
# line of run c:\users\normando\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\scripts\streamlit.exe run SpecNec_executable_streamlit.py
8+
#########
9+
10+
# Load and display the image
11+
image_path = 'https://raw.githubusercontent.com/Normando1945/Simple-Python-Matlab-JavaSript-Functions-Collection/main/fun_SPEC_NEC/logo_TorreFuerte.png'
12+
st.image(image_path, use_column_width=True)
13+
14+
# Título de la aplicación
15+
st.markdown("<h4 style='text-align: center;'>Simple App: Seismic Response Spectrum [Normative Ecuadorian Spectrum]</h4>", unsafe_allow_html=True)
16+
17+
18+
st.markdown(
19+
"""
20+
* Author: [Msc. Ing. Carlos Andrés Celi Sánchez](https://fragrant-knight-4af.notion.site/Main-Page-5c5f007b3f3f4c76a604960d9dbffca7?pvs=4)
21+
* Course: Structural Dynamics
22+
"""
23+
)
24+
25+
26+
st.markdown('You can find me on : [![Web Page](https://img.shields.io/badge/Web%20Page-caceli.net-blue)](https://fragrant-knight-4af.notion.site/Main-Page-5c5f007b3f3f4c76a604960d9dbffca7?pvs=4)[![GitHub Carlos Celi](https://img.shields.io/github/followers/Normando1945?label=follow&style=social)](https://github.com/Normando1945)[![ResearchGate](https://img.shields.io/badge/-ResearchGate-00CCBB?style=social&logo=researchgate)](https://www.researchgate.net/profile/Carlos-Celi)[![Google Scholar](https://img.shields.io/badge/-Google%20Scholar-4285F4?style=social&logo=google)](https://scholar.google.com.ec/citations?hl=es&user=yR4Gz7kAAAAJ)')
27+
28+
st.markdown(
29+
'''
30+
##### :open_book: Description
31+
32+
This simple app performs spectral calculations using the NEC-SE-DS-2015 Ecuadorian Code. It computes the Elastic and Inelastic Acceleration Response Spectra for a range of structural periods and visualizes the results.
33+
34+
'''
35+
)
36+
37+
st.markdown('##### :ledger: **More Information**')
38+
with st.expander("**Click to read more**"):
39+
j1, j2 = st.columns([1, 2])
40+
with j1:
41+
image_path = 'https://raw.githubusercontent.com/Normando1945/Simple-Python-Matlab-JavaSript-Functions-Collection/main/fun_SPEC_NEC/Chapter1_portada.gif'
42+
st.image(image_path, use_column_width=True)
43+
44+
st.markdown(
45+
"""
46+
<div style="text-align: center;">
47+
<a href="https://cceli.neocities.org"> Online Book, Chapter 1</b></a>
48+
</div>
49+
""",
50+
unsafe_allow_html=True
51+
)
52+
53+
with j2:
54+
st.markdown(
55+
'''
56+
**General Overview**
57+
58+
Welcome to this presentation of the draft for the opening chapter of my upcoming book, titled **"Structural Engineering: Dynamics, Seismic Solution, and AI Integration."** This chapter delves into the intricate realm of undergraduate structural dynamics. This endeavor is not meant to mirror the exhaustive details laid out in some of the field's seminal literature. If you're familiar with works from esteemed authors such as **Chopra**, **Mario Paz**, **Cloth & Penzien**, among others, you'll be aware of the profound depth and rigor they bring to the underlying concepts and mathematical foundations of structural dynamics. Rather than merely echoing their profound insights, this book and the initial chapter provided here chart a distinctive course.
59+
60+
The chief aim is to distill intricate theoretical mathematics into more accessible discrete mathematical frameworks, offering clear outlines of pivotal concepts in dynamic structures. This proves indispensable for students traversing the expansive realm of structural dynamics. By intertwining essential theories with illustrative **Python code samples**, readers will unlock understanding of the fundamental mechanics underpinning both single-degree-of-freedom **SDOF** and multi-degree-of-freedom **MDOF** dynamic systems. The focus remains unwaveringly on applications within structural engineering, positioning this as a prized asset for those immersing themselves in the field. It's vital to understand that this draft of the initial chapter isn't designed to serve as an isolated guide. Instead, it acts in tandem with conventional educational tools, reinforcing the bedrock knowledge students garner in academic settings. For a nuanced and comprehensive grasp of the domain, turning to the venerable tomes of dedicated structural dynamics literature is imperative. When combined with in-depth classroom learning, the revelations from such extensive studies will unquestionably refine a scholar's proficiency. I invite you to join me on this illuminating expedition, and I hope it lays the foundation for your scholastic and professional achievements in structural dynamics.
61+
62+
''', unsafe_allow_html=True
63+
)
64+
65+
st.markdown('##### :scroll: **Parameters**')
66+
st.markdown('You can read the documentation at [**Function: fun_Nec(n, z, I, fads, r, R, fip, fie, TR)**](https://github.com/Normando1945/Simple-Python-Matlab-JavaSript-Functions-Collection/tree/main/fun_SPEC_NEC)')
67+
68+
69+
n = st.number_input('**n**: Ratio between spectral ordinates **Sa(T = 0.1 s)** and **PGA**:', value=2.48, step=0.1)
70+
z = st.number_input('**z**: Maximum expected acceleration (fraction of gravitational acceleration):', value=0.4, step=0.1)
71+
72+
# Create a grid layout with a maximum of 5 columns
73+
col1, col2, col3, col4 = st.columns(4)
74+
75+
# User input for parameters with descriptions
76+
with col1:
77+
fa = st.number_input('**fa**: Short period amplification factor:', value=1.2, step=0.1)
78+
fip = st.number_input('**Φp**: Penalty coefficient for plan irregularity:', value=1.0, step=0.1)
79+
80+
with col2:
81+
fd = st.number_input('**fd**: Velocity amplification factor:', value=1.11, step=0.1)
82+
fie = st.number_input('**Φe**: Penalty coefficient for elevation irregularity:', value=1.0, step=0.1)
83+
84+
with col3:
85+
fs = st.number_input('**fs**: Soil non-linearity amplification factor:', value=1.11, step=0.1)
86+
R = st.number_input('**R**: Seismic response reduction factor:', value=6.0, step=0.5)
87+
88+
with col4:
89+
I = st.number_input('**I**: Importance coefficient [for different structures]:', value=1.0, step=0.1)
90+
r = st.number_input('**r**: Geographic zone factor [for Ecuador]:', value=1.0, step=0.1)
91+
92+
93+
fads = [fa, fd, fs]
94+
To = 0.10 * fads[2] * fads[1] / fads[0]
95+
Tc = 0.55 * fads[2] * fads[1] / fads[0]
96+
97+
Sae = []
98+
Sai = []
99+
Tie = []
100+
101+
for T in np.arange(0, 4, 0.005):
102+
if T <= To:
103+
Sae.append([z * fads[0] * (1 + (n - 1) * T / To) * I])
104+
Sai.append([n * z * fads[0] / (R * fip * fie) * I])
105+
Tie.append([T])
106+
else:
107+
if T <= Tc:
108+
Sae.append([n * z * fads[0] * I])
109+
Sai.append([n * z * fads[0] / (R * fip * fie) * I])
110+
Tie.append([T])
111+
else:
112+
Sae.append([I * n * z * fads[0] * (Tc / T) ** r])
113+
Sai.append([I * n * z * fads[0] * (Tc / T) ** r / (R * fip * fie)])
114+
Tie.append([T])
115+
116+
Resul = pd.DataFrame({ 'Period [s]': Tie,'Sae [g]': Sae,'Sai [g]': Sai})
117+
118+
Tie = np.array(Tie)
119+
Sae = np.array(Sae)
120+
Sai = np.array(Sai)
121+
Tie = Tie[:, 0]
122+
Sae = Sae[:, 0]
123+
Sai = Sai[:, 0]
124+
125+
126+
fig1, ax1 = plt.subplots(figsize=(16/1.5, 9/1.5))
127+
128+
ax1.plot(Tie, Sae, color=(0, 0, 1), marker='+', markersize=0, markerfacecolor='w',
129+
markeredgewidth=0, linewidth=1.0, alpha=0.5,linestyle = '-',label= f'Sa_elastic')
130+
ax1.plot(Tie, Sai, color=(0, 0, 0), marker='+', markersize=0, markerfacecolor='w',
131+
markeredgewidth=0, linewidth=1.5, alpha=0.7,linestyle = '--',label= f'Sa_inelastic')
132+
ax1.set_xlim([Tie[0], (max(Tie))])
133+
ax1.set_ylim([0, (max(Sae)*1.05)])
134+
plt.title('UHS [NEC-SE-DS-2015]', fontsize=10, color=(0, 0, 1))
135+
plt.xlabel('Period (T) [s]', rotation=0, fontsize=10, color=(0, 0, 0))
136+
plt.ylabel('Max Response Acceleration (Sa) [g]', rotation=90, fontsize=10, color=(0, 0, 0))
137+
legend = plt.legend(fontsize=10)
138+
legend.get_frame().set_edgecolor('none')
139+
ax1.grid(which='both', axis='x', alpha=0.5)
140+
141+
st.pyplot(fig1)
142+
143+
144+
st.markdown('##### 📊 **Response Spectra [Elastic and Inelastic]**')
145+
146+
st.write(Resul)
147+
148+
def display_footer():
149+
footer = """
150+
<style>
151+
.footer {
152+
position: fixed;
153+
left: 0;
154+
bottom: 0;
155+
width: 100%;
156+
background-color: white;
157+
color: black;
158+
text-align: center;
159+
padding: 10px;
160+
border-top: 1px solid #eaeaea;
161+
display: flex;
162+
align-items: center;
163+
justify-content: center;
164+
}
165+
.footer .logo {
166+
height: 60px; /* Increased size */
167+
margin-right: 5px;
168+
}
169+
.footer .separator {
170+
border-left: 2px solid #eaeaea;
171+
height: 50px;
172+
margin-right: 5px;
173+
}
174+
</style>
175+
<div class="footer">
176+
<img class="logo" src="https://raw.githubusercontent.com/Normando1945/Simple-Python-Matlab-JavaSript-Functions-Collection/main/fun_SPEC_NEC/logo_TorreFuerte.png" alt="TorreFuerte Logo">
177+
<div class="separator"></div>
178+
<div>
179+
<p>Developed by Carlos Celi | <a href="https://www.http://torrefuerte.ec" target="_blank">TORREFUERTE</a> | <a href="https://www.caceli.net" target="_blank">Carlos Celi</a> | <a href="https://github.com/Normando1945" target="_blank">GitHub</a></p>
180+
<p>© Version 1.0.1 - July, 2024</p>
181+
</div>
182+
</div>
183+
"""
184+
st.markdown(footer, unsafe_allow_html=True)
185+
186+
display_footer()

Prueba/pages/about_me.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
col1, col2 = st.columns([1, 1])
88
with col1:
9+
# st.image("pages/assets/foto.jpg", width= 350)
910
st.image("https://raw.githubusercontent.com/Normando1945/Simple-Python-Matlab-JavaSript-Functions-Collection/main/Prueba/pages/assets/foto.jpg", width= 350)
1011
with col2:
1112
st.markdown(
@@ -29,6 +30,7 @@
2930
with st.expander("**Click to read more**"):
3031
j1, j2 = st.columns([1, 1])
3132
with j1:
33+
# st.image("pages/assets/Structural Engineering2.png", width= 300)
3234
st.image("https://raw.githubusercontent.com/Normando1945/Simple-Python-Matlab-JavaSript-Functions-Collection/main/Prueba/pages/assets/Structural Engineering2.png", width= 300)
3335
st.markdown(
3436
"""
@@ -49,4 +51,4 @@
4951
5052
Harnessing the power of discrete mathematics, the book reveals how automation is revolutionizing the field, not just simplifying but also optimizing the design process. In ensuring structural safety and cost-effectiveness, it aims to pave a path toward a future where structures are not only robust against threats but are also emblematic of efficiency and innovation. Dive in to discover a confluence of tradition and technology, all designed to enhance and enrich the existing knowledge landscape of structural engineering.
5153
"""
52-
)
54+
)

0 commit comments

Comments
 (0)