annotate autocal/txvout.c @ 117:4c3f4231a021

autocal: vout_t definition factored out of txband.h into txvout.h
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Feb 2018 07:02:17 +0000
parents 394daa4ad6e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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>
117
4c3f4231a021 autocal: vout_t definition factored out of txband.h into txvout.h
Mychaela Falconia <falcon@freecalypso.org>
parents: 79
diff changeset
8 #include "txvout.h"
79
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 }