Fatigue hinzugefügt, DSV angefangen
This commit is contained in:
91
src/paveit/labtest/citt_fatigue.py
Normal file
91
src/paveit/labtest/citt_fatigue.py
Normal file
@@ -0,0 +1,91 @@
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from paveit.labtest.citt import calc_E
|
||||
|
||||
|
||||
class CittAnalyseFatigue():
|
||||
|
||||
def _fit_split_data(self):
|
||||
|
||||
data_exp = []
|
||||
|
||||
N = self.data['N'].unique()
|
||||
N = np.array(N)
|
||||
gaps = N[1:][np.diff(N)>1]
|
||||
|
||||
for i,gap in enumerate(gaps):
|
||||
print(i, gap)
|
||||
if i == 0:
|
||||
f = self.data['N']<gap
|
||||
elif i == len(gaps):
|
||||
f = self.data['N']>=gap
|
||||
else:
|
||||
f = (self.data['N']>=gaps[i-1]) & (self.data['N']<gap)
|
||||
|
||||
# filter data by geps
|
||||
d = self.data[f]
|
||||
|
||||
# get 5 cycles
|
||||
if i == 0:
|
||||
f = (d['N']>=98) & (d['N']<=102)
|
||||
else:
|
||||
Nsel = d['N'].unique()
|
||||
f = (d['N']>=Nsel[-5]) & (d['N']<=Nsel[-1])
|
||||
|
||||
d = d[f]
|
||||
|
||||
|
||||
|
||||
data_exp.append(d)
|
||||
|
||||
|
||||
self.data = data_exp
|
||||
|
||||
|
||||
def _fit_select_data(self):
|
||||
|
||||
''' analyse data
|
||||
|
||||
'''
|
||||
pass
|
||||
|
||||
def _calc(self):
|
||||
print('calc fatigue')
|
||||
|
||||
print(self.metadata)
|
||||
|
||||
fit = []
|
||||
|
||||
# Je Aufzeichnungsintervall
|
||||
|
||||
|
||||
for i, d in enumerate(self.data):
|
||||
|
||||
try:
|
||||
res = calc_E(d, metadata=self.metadata, columns_analyse=['F', 's_hor_sum'])
|
||||
|
||||
res['idx'] = i
|
||||
|
||||
res['energy_ratio'] = res['stiffness']*np.round(res['N_from'] + (res['N_to'] - res['N_from'])/2, 0)
|
||||
|
||||
fit.append(res)
|
||||
except:
|
||||
raise
|
||||
|
||||
self.fit_single_results = pd.DataFrame.from_records(fit)
|
||||
|
||||
EN_max = self.fit_single_results['energy_ratio'].max()
|
||||
|
||||
sel_f = self.fit_single_results[(self.fit_single_results['energy_ratio']>=0.8*EN_max) & (self.fit_single_results['energy_ratio']<=1.2*EN_max)]
|
||||
par = np.polyfit(sel_f['N_from'], sel_f['energy_ratio'], 4)
|
||||
|
||||
x = np.arange(sel_f['N_from'].min(),sel_f['N_from'].max(), 1)
|
||||
y = np.polyval(par, x)
|
||||
|
||||
Nmakro = x[y.argmax()]
|
||||
|
||||
self.fit = {'Nmakro': Nmakro,
|
||||
'energy_ratio_max': y.max(),
|
||||
'par_fit': par,
|
||||
'epislon_elast_98': self.fit_single_results.iloc[0]['el_strains']}
|
||||
Reference in New Issue
Block a user