jup¶
In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
import ipywidgets as widgets
from ipywidgets import interact, interactive, fixed, interact_manual
from streng.tools.bilin import Bilin
In [2]:
bl = Bilin(xtarget=0.5)
bl.load_space_delimited(r'D:/Programming/PyMyPackages/pystreng/tests/bilin/Example4', ' ')
# bl.load_space_delimited(r'D:/MyBooks/TEI/RepairsExample/sapfiles/fema/PushoverCurve_modal.txt', ' ')
bl.calc()
plt.plot(bl.x_ini, bl.y_ini)
plt.plot(bl.bilinear_curve.d_array, bl.bilinear_curve.a_array)
plt.show()

In [3]:
print(bl.bilinear_curve.all_quantities)
| quantity | value |
|:-----------|----------:|
| x_0 | 2.140E-02 |
| x_y | 7.582E-02 |
| x_u | 4.703E-01 |
| y_0 | 0.000E+00 |
| y_y | 1.330E+03 |
| y_u | 1.330E+03 |
| kel | 2.444E+04 |
| kinel | 0.000E+00 |
| μ | 8.248E+00 |
| α | 0.000E+00 |
In [4]:
bl.bilinear_curve.all_quantities.retrieve('quantity', 'x_u', 'value')
Out[4]:
0.4703
In [5]:
def f(x):
bl = Bilin(xtarget=x/1000., dropstrength=0.9)
bl.load_space_delimited(r'D:/Programming/PyMyPackages/pystreng/tests/bilin/Example4', ' ')
bl.calc()
plt.plot(bl.x_ini, bl.y_ini)
plt.plot(bl.bilinear_curve.d_array, bl.bilinear_curve.a_array)
plt.show()
return x
interact(f, x=widgets.IntSlider(min=50,max=600,step=1,value=200));
In [6]:
def f_str(x):
if len(x)>0:
bl = Bilin()
bl.load_space_delimited_string(x)
bl.calc()
plt.plot(bl.x_ini, bl.y_ini)
plt.plot(bl.bilinear_curve.d_array, bl.bilinear_curve.a_array)
plt.show()
interact(f_str, x=widgets.Textarea(
placeholder='Paste space delimited x-y values:',
description='Initial curve',
disabled=False));
In [7]:
print(bl)
Bilin main output
Αρχική μετατόπιση: 0.0214
Έλεγχος στο 20% του ymax
x(02)=0.009792445820433439, y(02)=303.416. Οπότε k(02)=30984.70040721349
Εμβαδό καμπύλης: 560.8879995
In [8]:
print(bl.output.OutputStrings['main'])
Bilin main output
Αρχική μετατόπιση: 0.0214
Έλεγχος στο 20% του ymax
x(02)=0.009792445820433439, y(02)=303.416. Οπότε k(02)=30984.70040721349
Εμβαδό καμπύλης: 560.8879995
In [9]:
bl.output.OutputTables['InitialCurve'].to_panda_dataframe.head(20)
Out[9]:
x | y | |
---|---|---|
0 | 0.0214 | 0.00 |
1 | 0.0237 | 71.07 |
2 | 0.0260 | 142.14 |
3 | 0.0283 | 213.21 |
4 | 0.0306 | 284.28 |
5 | 0.0328 | 355.34 |
6 | 0.0351 | 426.41 |
7 | 0.0356 | 440.66 |
8 | 0.0379 | 501.46 |
9 | 0.0409 | 566.15 |
10 | 0.0446 | 633.82 |
11 | 0.0482 | 699.08 |
12 | 0.0517 | 758.74 |
13 | 0.0540 | 797.21 |
14 | 0.0563 | 833.29 |
15 | 0.0586 | 869.36 |
16 | 0.0609 | 905.44 |
17 | 0.0648 | 966.95 |
18 | 0.0679 | 1015.03 |
19 | 0.0711 | 1062.08 |
In [10]:
print(bl.output.OutputStrings['main'])
Bilin main output
Αρχική μετατόπιση: 0.0214
Έλεγχος στο 20% του ymax
x(02)=0.009792445820433439, y(02)=303.416. Οπότε k(02)=30984.70040721349
Εμβαδό καμπύλης: 560.8879995
In [11]:
print(bl.output.OutputTables['Iterations'].to_markdown)
| __iteration | x_y | y_y | x_u | y_u | kinel | kel | k_06 | error |
|------------:|----------:|----------:|----------:|----------:|-----------:|----------:|----------:|----------:|
| 1 | 4.232E-02 | 1.311E+03 | 4.489E-01 | 1.311E+03 | 5.096E-01 | 3.098E+04 | 2.461E+04 | 2.592E-01 |
| 2 | 5.403E-02 | 1.329E+03 | 4.489E-01 | 1.329E+03 | -9.174E+01 | 2.461E+04 | 2.445E+04 | 6.544E-03 |
| 3 | 5.441E-02 | 1.330E+03 | 4.489E-01 | 1.330E+03 | -9.485E+01 | 2.445E+04 | 2.444E+04 | 2.501E-04 |
| 4 | 5.442E-02 | 1.330E+03 | 4.489E-01 | 1.330E+03 | -9.497E+01 | 2.444E+04 | 2.444E+04 | 9.624E-06 |
| 5 | 5.442E-02 | 1.330E+03 | 4.489E-01 | 1.330E+03 | -9.498E+01 | 2.444E+04 | 2.444E+04 | 3.704E-07 |
In [12]:
print(bl.output.OutputTables['BilinearCurve'].to_markdown)
| x | y |
|----------:|----------:|
| 2.140E-02 | 0.000E+00 |
| 7.582E-02 | 1.330E+03 |
| 4.703E-01 | 1.330E+03 |