Análisis RTT¶
Este notebook contiene los análisis ejecutados en el artículo de conferencia "Posicionamiento basado en Wi-Fi con medidas basadas en tiempo en dispositivos Android" presentado en el Seminario Anual de Automática, Electrónica Industrial e Instrumentación (SAAEI'25).
Los análisis incluidos son:
- Variabildiad temporal de las medidas RTT.
- Impacto del ángulo de incidencia.
- Impacto del intervalo de muestreo.
Librerías y variables globales¶
import os
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
INPUT_DATA_DIR = '01_DATA'
POCO_MEASUREMENTS = os.path.join(INPUT_DATA_DIR, '01_rtt-poco.csv')
M2007_MEASUREMENTS = os.path.join(INPUT_DATA_DIR, '01_rtt-xiaomi-m2007.csv')
ORIENTATIONS_MEASURMENTS = os.path.join(INPUT_DATA_DIR, '02_rtt-orientations.csv')
THROTTLE_MEASURMENTS = os.path.join(INPUT_DATA_DIR, '03_rtt-throttle.csv')
RESULTS_DATA_DIR = '02_RESULTS'
TEMPORAL_VARIABILITY_POCO = os.path.join(RESULTS_DATA_DIR, '01_rtt-variability-poco.pdf')
TEMPORAL_VARIABILITY_M2007 = os.path.join(RESULTS_DATA_DIR, '01_rtt-variability-m2007.pdf')
ORIENTATIONS_RESULTS = os.path.join(RESULTS_DATA_DIR, '02_rtt-orientations.pdf')
THROTTLE_RESULTS = os.path.join(RESULTS_DATA_DIR, '03_rtt-throttle.pdf')
HEIGHT = 500
WIDTH = 700
FONT_SIZE = 18
TRANSLATIONS = {
'Time (ms)': 'Tiempo (ms)',
'Distance (mm)': 'Distancia (mm)',
'Real Distance (mm)': 'Distancia Real (mm)',
'Orientation': 'Orientación'
}
Análisis¶
Variabildiad temporal de las medidas RTT¶
Análisis de la evolución temporal y precisión de las medidas RTT recogidas a 1, 2, 3, 4 y 5 metros del punto de acceso (AP). Los datos fueron recogidos con dos dispositivos móvil Android y localizaciones: Xiaomi Poco F2 Pro (M2004J11G) en un laboratorio de investigación y un Xiaomi Mi 10T (M2007J3SG) en una vivienda urbana.
Carga de datos¶
poco = pd.read_csv(POCO_MEASUREMENTS)
m2007 = pd.read_csv(M2007_MEASUREMENTS)
poco = poco[poco['Real Distance (mm)'].isin([1000, 2000, 3000, 4000, 5000])]
poco['Real Distance (mm)'] = poco['Real Distance (mm)'].astype(str)
m2007['Real Distance (mm)'] = m2007['Real Distance (mm)'].astype(str)
Resultados¶
poco_fig = px.scatter(poco, x='Time (ms)', y='Distance (mm)', color='Real Distance (mm)', labels=TRANSLATIONS)
poco_fig.update_layout(width=WIDTH, height=HEIGHT,
legend=dict(
yanchor="top",
y=0.99,
xanchor="left",
x=0.01,
orientation='h'
), yaxis_range=[1000, 9000], xaxis_title_font_size=FONT_SIZE, yaxis_title_font_size=FONT_SIZE)
m2007_fig = px.scatter(m2007, x='Time (ms)', y='Distance (mm)', color='Real Distance (mm)', labels=TRANSLATIONS)
m2007_fig.update_layout(width=WIDTH, height=HEIGHT,
legend=dict(
yanchor="top",
y=0.99,
xanchor="left",
x=0.01,
orientation='h'
), yaxis_range=[1000, 9000], xaxis_title_font_size=FONT_SIZE, yaxis_title_font_size=FONT_SIZE)
Impacto del ángulo de incidencia.¶
Análisis de la orientación del dispositivo móvil con respecto al AP. Las medidas RTT se recogieron a 0.5 metros del AP con un Xiaomi Poco F2 Pro (M2004J11G) en un laboratorio de investigación.
Carga de datos¶
orientations = pd.read_csv(ORIENTATIONS_MEASURMENTS)
orientations['Orientation'] = orientations['Orientation'].map({1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'})
Resultados¶
orientation_fig = px.box(orientations, x='Orientation', y='Distance (mm)', points="all", color='Orientation', labels=TRANSLATIONS)
orientation_fig.update_layout(
height=HEIGHT,
width=WIDTH,
showlegend=False,
xaxis_title_font_size=FONT_SIZE,
yaxis_title_font_size=FONT_SIZE
)
Impacto del intervalo de muestreo.¶
Análisis de la cantidad de medidas RTT obtenidas a diversos intervalos de muestreo.
Carga de datos¶
throttle = pd.read_csv(THROTTLE_MEASURMENTS)
throttle['Interval (ms)'] = throttle['Interval (ms)'] * -1
throttle['Expected Measurements'] = (1/throttle['Interval (ms)'] * 1000 * 30).apply(np.floor)
Resultados¶
throttle_fig = make_subplots(specs=[[{"secondary_y": True}]])
throttle_fig.add_trace(
go.Scatter(x=throttle['Interval (ms)'], y=throttle['Successful Measurements'], name="Nº Operaciones exitosas"),
secondary_y=False,
)
throttle_fig.add_trace(
go.Scatter(x=throttle['Interval (ms)'], y=throttle['Expected Measurements'], name="Nº Operaciones esperadas"),
secondary_y=False,
)
throttle_fig.add_trace(
go.Scatter(x=throttle['Interval (ms)'], y=throttle['% Successful Operations'], line_dash='dashdot', name="% Operaciones exitosas"),
secondary_y=True,
)
throttle_fig.update_layout(height=HEIGHT, width=WIDTH + 100,
legend=dict(
orientation="h",
yanchor="bottom",
y=1.02,
xanchor="right",
x=0.94,
bordercolor="Black",
borderwidth=2
))
throttle_fig.update_xaxes(title_text="Intervalo de muestreo (ms)", title_font_size=FONT_SIZE, autorange='reversed', dtick=50)
throttle_fig.update_yaxes(title_text="Operaciones RTT", title_font_size=FONT_SIZE, secondary_y=False, dtick=50, range=(10, 500))
throttle_fig.update_yaxes(title_text="Porcentaje de éxito (%)", title_font_size=FONT_SIZE, secondary_y=True, griddash='dashdot', gridcolor='black')
Almacenamiento de resultados¶
poco_fig.write_image(TEMPORAL_VARIABILITY_POCO)
m2007_fig.write_image(TEMPORAL_VARIABILITY_M2007)
orientation_fig.write_image(ORIENTATIONS_RESULTS)
throttle_fig.write_image(THROTTLE_RESULTS)