diff --git a/src/paveit/datamodels/taskmanager.py b/src/paveit/datamodels/taskmanager.py index 1da1d26..e76940e 100755 --- a/src/paveit/datamodels/taskmanager.py +++ b/src/paveit/datamodels/taskmanager.py @@ -47,7 +47,7 @@ class TaskManagerBase(Document): "db_alias": 'dblabtests', } - + class TaskCITTStiffness(TaskManagerBase): material = LazyReferenceField(Material, required=True) diff --git a/src/paveit/functions/citt.py b/src/paveit/functions/citt.py index 84fe0be..0f5df77 100755 --- a/src/paveit/functions/citt.py +++ b/src/paveit/functions/citt.py @@ -14,3 +14,90 @@ 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 \ No newline at end of file diff --git a/src/paveit/labtest/citt.py b/src/paveit/labtest/citt.py index c8c5dc7..07ca76b 100755 --- a/src/paveit/labtest/citt.py +++ b/src/paveit/labtest/citt.py @@ -13,93 +13,6 @@ from paveit.labtest import DataSineLoad from paveit.labtest.citt_fatigue import CittAnalyseFatigue -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 - class CITTBase(DataSineLoad): def _set_parameter(self): diff --git a/src/paveit/labtest/citt_fatigue.py b/src/paveit/labtest/citt_fatigue.py index c902c76..51bef66 100644 --- a/src/paveit/labtest/citt_fatigue.py +++ b/src/paveit/labtest/citt_fatigue.py @@ -1,7 +1,7 @@ import numpy as np import pandas as pd -from paveit.labtest.citt import calc_E +from paveit.functions.citt import calc_E class CittAnalyseFatigue():