103 lines
3.4 KiB
Python
Executable File
103 lines
3.4 KiB
Python
Executable File
import numpy as np
|
|
|
|
|
|
def stiffness_tp26(T, f, Emax, Emin, phi, z0, z1, T0=20.0):
|
|
|
|
alphaT = np.exp(phi * ((1 / (T + 273.15)) - (1 / (T0 + 273.15))))
|
|
x = np.log(f * alphaT) / np.log(10)
|
|
E = Emin + (Emax - Emin) / (1 + np.exp(z0 * x + z1))
|
|
|
|
return E
|
|
|
|
|
|
def calc_nu(T):
|
|
#TODO: Prüfen ob Formel stimmt!
|
|
nu = 0.15 + (0.35) / (1 + np.exp(3.1849 - 0.04233 * (9 / 5 * T + 32)))
|
|
return nu
|
|
|
|
def calc_E(data, metadata, columns_analyse):
|
|
|
|
data.index = data.index - data.index[0]
|
|
|
|
res_temp = {}
|
|
|
|
x = data.index.values
|
|
|
|
freq = np.round(float(data['f'].unique()), 2)
|
|
sigma = float(data['sigma'].unique())
|
|
temperature = float(data['T'].unique())
|
|
|
|
for idxcol, col in enumerate(columns_analyse):
|
|
|
|
if not col in data.columns: continue
|
|
|
|
y = data[col].values
|
|
res = fit_cos(x, y, freq=freq)
|
|
|
|
for key, value in res.items():
|
|
res_temp[f'fit_{col}_{key}'] = value
|
|
|
|
|
|
# analyse cycle data
|
|
|
|
cycle_min = []
|
|
cycle_max = []
|
|
cycle_mean = []
|
|
cycle_diff = []
|
|
|
|
for N, data_cycle in data.groupby('N'):
|
|
y = data_cycle[col].values
|
|
|
|
cycle_min.append(y.min())
|
|
cycle_max.append(y.max())
|
|
cycle_mean.append(y.mean())
|
|
cycle_diff.append(cycle_max[-1] - cycle_min[-1])
|
|
|
|
res_temp[f'fit_{col}_cycle_min'] = cycle_min
|
|
res_temp[f'fit_{col}_min'] = np.mean(cycle_min)
|
|
res_temp[f'fit_{col}_min_std'] = np.std(cycle_min)
|
|
res_temp[f'fit_{col}_min_diff_rel'] = (np.max(cycle_min) - np.min(cycle_min))/np.mean(cycle_min)
|
|
res_temp[f'fit_{col}_cycle_max'] = cycle_max
|
|
res_temp[f'fit_{col}_max'] = np.mean(cycle_max)
|
|
res_temp[f'fit_{col}_max_std'] = np.std(cycle_max)
|
|
res_temp[f'fit_{col}_max_diff_rel'] = (np.max(cycle_max) - np.min(cycle_max))/np.mean(cycle_max)
|
|
res_temp[f'fit_{col}_cycle_mean'] = cycle_mean
|
|
res_temp[f'fit_{col}_mean'] = np.mean(cycle_mean)
|
|
res_temp[f'fit_{col}_mean_std'] = np.std(cycle_mean)
|
|
res_temp[f'fit_{col}_mean_diff_rel'] = (np.max(cycle_mean) - np.min(cycle_mean))/np.mean(cycle_mean)
|
|
res_temp[f'fit_{col}_cycle_diff'] = cycle_diff
|
|
res_temp[f'fit_{col}_diff'] = np.mean(cycle_diff)
|
|
res_temp[f'fit_{col}_diff_std'] = np.std(cycle_diff)
|
|
res_temp[f'fit_{col}_diff_diff_rel'] = (np.max(cycle_diff) - np.min(cycle_diff))/np.mean(cycle_diff)
|
|
|
|
# add more metadata
|
|
res_temp['f_set'] = freq
|
|
res_temp['sigma_set'] = sigma
|
|
res_temp['T_set'] = temperature
|
|
|
|
res_temp['N_from'] = data['N'].min()
|
|
res_temp['N_to'] = data['N'].max()
|
|
|
|
res_temp['n_samples_per_cycle'] = int(
|
|
len(data) / (res_temp['N_to'] - res_temp['N_from'] + 1))
|
|
|
|
## Stiffness
|
|
deltaF = res_temp['fit_F_amp']
|
|
deltaU = res_temp['fit_s_hor_sum_amp']
|
|
|
|
h = float(metadata['speciment_height'])
|
|
d = float(metadata['speciment_diameter'])
|
|
|
|
nu = calc_nu(temperature)
|
|
res_temp['nu'] = nu
|
|
|
|
#nach TP Asphalt 26
|
|
res_temp['stiffness'] = deltaF /(h * deltaU) * (4.0/np.pi -1 + nu)
|
|
|
|
## Elastische hori. Dehnung
|
|
res_temp['el_strains'] = 2*2*deltaU/d * (1+3*nu)/(4 + np.pi*nu - np.pi) * 1000.0 # 2*2 daher, da deltaU nur Ampl. nicht Gesamtkraft ist
|
|
|
|
# TODO: Überarbeiten und erweitern (ISSUE #2)
|
|
res_temp['phase'] = res_temp['fit_F_phase'] - res_temp['fit_s_hor_sum_phase']
|
|
|
|
return res_temp |