Commit 5662a69a authored by Fabian Kovac's avatar Fabian Kovac
Browse files

Mean and std attenuation based on dry periods

parent 7231efa1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,8 +2,8 @@
# Title: Data Preparation for LINK Configs and Transmissions
# Author: Fabian Kovac <fabian.kovac@fhstp.ac.at>
# Team: University of Applied Sciences St. Pölten
# Version: 3.3
# Last changed: 2021-12-15
# Version: 4.0
# Last changed: 2022-01-14
#
import sys
......@@ -579,18 +579,14 @@ def prep() -> None:
_log('\n******************************** CALC POWER LEVELS *************************')
# build df with differences of sending and receiving levels
df_diff = df_link[['LINKID', 'TXLEVEL', 'REMOTERXLEVEL']].copy()
df_diff['ATTENUATIONMEAN'] = df_diff['REMOTERXLEVEL'] - df_diff['TXLEVEL']
_log('Built dataframe with mean link attenuations')
# load dry LINK attenuation statistics
df_stats = pd.read_csv('00_Link_dry_attnstats.csv', sep = ';')
# get mean of differences per link
df_diff = df_diff.groupby(['LINKID']).agg({'ATTENUATIONMEAN' : 'mean'}).reset_index()
# merge differences to transmission dataframe
df_link = pd.merge(df_link, df_diff, how = 'left', left_on = 'LINKID', right_on = 'LINKID')
del df_diff
_log('Merged mean link attenuations back to link dataframe')
# merge mean and std attenuation to transmission dataframe
df_link = pd.merge(df_link, df_stats, how = 'left', left_on = 'LINKID', right_on = 'LINKID')
df_link = df_link.dropna(axis = 0, subset = ['ATTENUATIONMEANDRY', 'ATTENUATIONSTDDRY'])
del df_stats
_log('Merged mean and std of link attenuations to link dataframe')
......@@ -599,8 +595,15 @@ def prep() -> None:
_log('Calculated attenuation per transmission')
# calculate differences from attenuations and mean attenuations
df_link['ATTENUATIONDIFF'] = df_link['ATTENUATION'] - df_link['ATTENUATIONMEAN']
_log('Calculated attenuation differences of daily means')
df_link['ATTENUATIONDIFF'] = df_link['ATTENUATION'] - df_link['ATTENUATIONMEANDRY']
df_std = df_link.groupby(['LINKID']).agg({'ATTENUATION' : 'std'}).reset_index()
df_std = df_std.rename(columns = {'LINKID' : 'LINKID', 'ATTENUATION' : 'ATTENUATIONSTD'})
df_link = pd.merge(df_link, df_std, how = 'left', left_on = 'LINKID', right_on = 'LINKID')
df_link['ATTENUATIONSTDDIFF'] = df_link['ATTENUATIONSTD'] - df_link['ATTENUATIONSTDDRY']
del(df_std)
_log('Calculated attenuation differences of dry means')
# calculate extinction coefficients for links based on attenuation and lengths of the links based on beer-lambert law
# Coeff = -ln(10) * (Attenuation/PathLength)
......@@ -617,8 +620,10 @@ def prep() -> None:
'PMAX' : 'RxLevelMax',
'TXLEVEL' : 'TxLevel',
'ATTENUATION' : 'Attn',
'ATTENUATIONMEAN' : 'AttnMean',
'ATTENUATIONMEANDRY' : 'AttnMeanDry',
'ATTENUATIONSTDDRY' : 'AttnStdDry',
'ATTENUATIONDIFF' : 'AttnDiff',
'ATTENUATIONSTDDIFF' : 'AttnStdDiff',
'EXTINCTIONCOEFF' : 'ExtinctionCoeff',
'SPEED' : 'Speed',
'CURRRXBITRATE' : 'RxBitrate',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment