move function calc_E to functions/citt
This commit is contained in:
@@ -47,7 +47,7 @@ class TaskManagerBase(Document):
|
|||||||
"db_alias": 'dblabtests',
|
"db_alias": 'dblabtests',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TaskCITTStiffness(TaskManagerBase):
|
class TaskCITTStiffness(TaskManagerBase):
|
||||||
|
|
||||||
material = LazyReferenceField(Material, required=True)
|
material = LazyReferenceField(Material, required=True)
|
||||||
|
|||||||
@@ -14,3 +14,90 @@ def calc_nu(T):
|
|||||||
#TODO: Prüfen ob Formel stimmt!
|
#TODO: Prüfen ob Formel stimmt!
|
||||||
nu = 0.15 + (0.35) / (1 + np.exp(3.1849 - 0.04233 * (9 / 5 * T + 32)))
|
nu = 0.15 + (0.35) / (1 + np.exp(3.1849 - 0.04233 * (9 / 5 * T + 32)))
|
||||||
return nu
|
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
|
||||||
@@ -13,93 +13,6 @@ from paveit.labtest import DataSineLoad
|
|||||||
from paveit.labtest.citt_fatigue import CittAnalyseFatigue
|
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):
|
class CITTBase(DataSineLoad):
|
||||||
|
|
||||||
def _set_parameter(self):
|
def _set_parameter(self):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from paveit.labtest.citt import calc_E
|
from paveit.functions.citt import calc_E
|
||||||
|
|
||||||
|
|
||||||
class CittAnalyseFatigue():
|
class CittAnalyseFatigue():
|
||||||
|
|||||||
Reference in New Issue
Block a user