# HG changeset patch # User Mychaela Falconia # Date 1729872592 0 # Node ID 0cfea66a15f311487e18a629545014b26cbb7385 # Parent d8ccdccd8b2b7e6ec783680e06392db85423338a pathloss: implement Egli model diff -r d8ccdccd8b2b -r 0cfea66a15f3 pathloss/Makefile --- a/pathloss/Makefile Fri Oct 25 08:13:18 2024 +0000 +++ b/pathloss/Makefile Fri Oct 25 16:09:52 2024 +0000 @@ -1,12 +1,15 @@ CC= gcc CFLAGS= -O2 PROG= pathloss -OBJS= fsl.o main.o +OBJS= egli.o fsl.o main.o +HDRS= range_func.h all: ${PROG} ${PROG}: ${OBJS} ${CC} -o $@ ${OBJS} -lm +${OBJS}: ${HDRS} + clean: rm -f *.o ${PROG} diff -r d8ccdccd8b2b -r 0cfea66a15f3 pathloss/egli.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pathloss/egli.c Fri Oct 25 16:09:52 2024 +0000 @@ -0,0 +1,18 @@ +/* + * RF range calculation per Egli model + */ + +#define _GNU_SOURCE +#include +#include "range_func.h" + +float rf_range_egli(float freq_mhz, float path_loss, float bts_ant_m, + float ms_ant_m) +{ + float l, r, x; + + l = 20.0f * log10f(freq_mhz / 40.0f); + r = path_loss - l; + x = bts_ant_m * ms_ant_m; + return sqrtf(x / pow10f(r / -20.0f)); +} diff -r d8ccdccd8b2b -r 0cfea66a15f3 pathloss/main.c --- a/pathloss/main.c Fri Oct 25 08:13:18 2024 +0000 +++ b/pathloss/main.c Fri Oct 25 16:09:52 2024 +0000 @@ -274,6 +274,9 @@ printf("FSL: %.2f m DL, %.2f m UL\n", rf_range_freespace(freq_dl, path_loss_dl), rf_range_freespace(freq_ul, path_loss_ul)); - /* Egli and Hata coming next */ + printf("Egli: %.2f m DL, %.2f m UL\n", + rf_range_egli(freq_dl, path_loss_dl, bts_height, ms_height), + rf_range_egli(freq_ul, path_loss_ul, bts_height, ms_height)); + /* Hata model coming next */ exit(0); } diff -r d8ccdccd8b2b -r 0cfea66a15f3 pathloss/range_func.h --- a/pathloss/range_func.h Fri Oct 25 08:13:18 2024 +0000 +++ b/pathloss/range_func.h Fri Oct 25 16:09:52 2024 +0000 @@ -3,3 +3,5 @@ */ float rf_range_freespace(float freq_mhz, float path_loss); +float rf_range_egli(float freq_mhz, float path_loss, float bts_ant_m, + float ms_ant_m);