| 1 | # -*- mode: python; indent-tabs-mode: nil -*- |
| 2 | |
| 3 | # Part of mlat-server: a Mode S multilateration server |
| 4 | # Copyright (C) 2015 Oliver Jowett <[email protected]> |
| 5 | |
| 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as |
| 8 | # published by the Free Software Foundation, either version 3 of the |
| 9 | # License, or (at your option) any later version. |
| 10 | |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU Affero General Public License for more details. |
| 15 | |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | """ |
| 20 | Useful constants for unit conversion. |
| 21 | """ |
| 22 | |
| 23 | import math |
| 24 | |
| 25 | # signal propagation speed in metres per second |
| 26 | Cair = 299792458 / 1.0003 |
| 27 | |
| 28 | # degrees to radians |
| 29 | DTOR = math.pi / 180.0 |
| 30 | # radians to degrees |
| 31 | RTOD = 180.0 / math.pi |
| 32 | |
| 33 | # feet to metres |
| 34 | FTOM = 0.3048 |
| 35 | # metres to feet |
| 36 | MTOF = 1.0/FTOM |
| 37 | |
| 38 | # m/s to knots |
| 39 | MS_TO_KTS = 1.9438 |
| 40 | |
| 41 | # m/s to fpm |
| 42 | MS_TO_FPM = MTOF * 60 |