annotate pathloss/egli.c @ 68:0cfea66a15f3

pathloss: implement Egli model
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Oct 2024 16:09:52 +0000
parents pathloss/fsl.c@599fac1b882d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
68
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
2 * RF range calculation per Egli model
66
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #define _GNU_SOURCE
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <math.h>
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "range_func.h"
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
68
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
9 float rf_range_egli(float freq_mhz, float path_loss, float bts_ant_m,
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
10 float ms_ant_m)
66
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 {
68
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
12 float l, r, x;
66
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
68
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
14 l = 20.0f * log10f(freq_mhz / 40.0f);
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
15 r = path_loss - l;
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
16 x = bts_ant_m * ms_ant_m;
0cfea66a15f3 pathloss: implement Egli model
Mychaela Falconia <falcon@freecalypso.org>
parents: 66
diff changeset
17 return sqrtf(x / pow10f(r / -20.0f));
66
599fac1b882d pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 }