FreeCalypso > hg > gsm-net-reveng
annotate pathloss/fsl.c @ 68:0cfea66a15f3
pathloss: implement Egli model
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 25 Oct 2024 16:09:52 +0000 |
parents | 599fac1b882d |
children |
rev | line source |
---|---|
66
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Free Space Loss calculation |
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 |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #define PI_f ((float) M_PI) |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 float rf_range_freespace(float freq_mhz, float path_loss) |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 { |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 float wavelen = 300.0f / freq_mhz; |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 return (wavelen / pow10f(path_loss / -20.0f)) / (PI_f * 4.0f); |
599fac1b882d
pathloss: implement FSL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 } |