FreeCalypso > hg > fc-rfcal-tools
annotate autocal/txvout.c @ 102:80281b67511f
fc-rfcal-txband: fixed bug in the corner case when
the target power level is above the highest basis point
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 12 Aug 2017 08:47:09 +0000 |
parents | 394daa4ad6e8 |
children | 4c3f4231a021 |
rev | line source |
---|---|
79
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the function that converts Tx power values in dBm |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * (either measured or set targets) to Vout for the purpose of piecewise |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * linear modeling of APC. |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <math.h> |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include "txband.h" |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 vout_t |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 dbm_to_vout(dbm) |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 double dbm; |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 { |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 double milliwatts, vout; |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 milliwatts = pow(10.0, dbm / 10.0); |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 vout = sqrt(milliwatts * 0.050); |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 return vout; |
394daa4ad6e8
fc-rfcal-txband: dBm to Vout function implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 } |