Skip to content

Commit 8ba750a

Browse files
authored
Update SpecNec_executable_streamlit.py
1 parent 91cb477 commit 8ba750a

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

fun_SPEC_NEC/SpecNec_executable_streamlit.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,21 @@
141141
I = st.number_input('**I**: Importance coefficient [for different structures]:', value=1.0, step=0.1)
142142
r = st.number_input('**r**: Geographic zone factor [for Ecuador]:', value=1.0, step=0.1)
143143

144+
dt = 0.005
145+
Tf = 6
144146

145147
######################################################## Code ########################################################
146-
147148
fads = [fa, fd, fs]
149+
148150
To = 0.10 * fads[2] * fads[1] / fads[0]
149151
Tc = 0.55 * fads[2] * fads[1] / fads[0]
152+
Tl = 2.4 * fads[1]
150153

151154
Sae = []
152155
Sai = []
153156
Tie = []
154157

155-
for T in np.arange(0, 4, 0.005):
158+
for T in np.arange(0, Tf, dt):
156159
if T <= To:
157160
Sae.append([z * fads[0] * (1 + (n - 1) * T / To) * I])
158161
Sai.append([n * z * fads[0] / (R * fip * fie) * I])
@@ -163,9 +166,15 @@
163166
Sai.append([n * z * fads[0] / (R * fip * fie) * I])
164167
Tie.append([T])
165168
else:
166-
Sae.append([I * n * z * fads[0] * (Tc / T) ** r])
167-
Sai.append([I * n * z * fads[0] * (Tc / T) ** r / (R * fip * fie)])
168-
Tie.append([T])
169+
if T <= Tl:
170+
Sae.append([I * n * z * fads[0] * (Tc / T) ** r])
171+
Sai.append([I * n * z * fads[0] * (Tc / T) ** r / (R * fip * fie)])
172+
Tie.append([T])
173+
else:
174+
Sae.append([I * n * z * fads[0] * (Tc / T) ** r * (Tl / T) ** 2])
175+
Sai.append([I * n * z * fads[0] * (Tc / T) ** r * (Tl / T) ** 2 / (R * fip * fie)])
176+
Tie.append([T])
177+
169178

170179
Resul = pd.DataFrame({ 'Period [s]': Tie,'Sae [g]': Sae,'Sai [g]': Sai})
171180

@@ -190,7 +199,9 @@
190199
plt.ylabel('Max Response Acceleration (Sa) [g]', rotation=90, fontsize=10, color=(0, 0, 0))
191200
legend = plt.legend(fontsize=10)
192201
legend.get_frame().set_edgecolor('none')
193-
ax1.grid(which='both', axis='x', alpha=0.5)
202+
ax1.grid(which='both', axis='x', alpha=0.5)
203+
204+
# plt.show()
194205

195206
st.pyplot(fig1)
196207

0 commit comments

Comments
 (0)