radarlib  1.4.6
formula.hpp
Go to the documentation of this file.
1 /*
2  * Radar Library
3  *
4  * Copyright (C) 2009-2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
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 published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Author: Guido Billi <guidobilli@gmail.com>
21  */
22 
27 #ifndef __RADAR_FORMULA_HPP__
28 #define __RADAR_FORMULA_HPP__
29 
30 #include <limits>
31 #include <climits>
32 #include <cmath>
33 
34 namespace Radar {
35 
36 /*===========================================================================*/
37 
44 {
45 public:
52  static inline double calculate(long prf, double waveLength_meters)
53  {
54  //V = lunghezza d'onda (m) * PRF / 4
55  return waveLength_meters * (double)prf / 4;
56  }
65  static inline double calculate(long lowPRF, long highPRF, double waveLength_meters)
66  {
67  if (lowPRF == highPRF)
68  {
69  return calculate(highPRF, waveLength_meters);
70  }
71  else
72  {
73  // lunghezza d'onda (m)
74  // V = --------------------------
75  // 4 * (1/LOWPRF - 1/HIGHPRF)
76  return waveLength_meters / 4 / ( 1 / (double)lowPRF - 1 / (double)highPRF);
77  }
78  }
79 };
80 
81 /*===========================================================================*/
82 
89 {
90 public:
97  static inline double freqMHzToMeters(double freqMHz)
98  {
99  // Vluce (m/s) 299792458 299.792458
100  //lung. cm = ----------- = ------------- = ------------
101  // Hz (num/s) MHz * 1000000 MHz
102  return 299.792458 / freqMHz;
103  }
110  static inline double freqMHzToCM(double freqMHz)
111  {
112  // Vluce (m/s) * 100 29979245800 29979.2458
113  //lung. cm = ----------------- = ------------- = ------------
114  // Hz (num/s) MHz * 1000000 MHz
115  return 29979.2458 / freqMHz;
116  }
117 };
118 
119 /*===========================================================================*/
120 
127 {
128 public:
138  static inline double calculateWatts(double peakPwr, int prf, double pulseWidth)
139  {
140  // PeakPower (Watts) x PRF (n/s) x PulseWidth (microsec)
141  //P avg = -----------------------------------------------------
142  // 1.000.000
143  return peakPwr * (double)prf * pulseWidth / 1000000.;
144  }
154  static inline double calculateKWatts(double peakPwr, int prf, double pulseWidth)
155  {
156  return calculateWatts(peakPwr, prf, pulseWidth) / 1000.;
157  }
158 
159 };
160 
161 
162 /*===========================================================================*/
163 
164 }
165 
166 #endif
static double calculateWatts(double peakPwr, int prf, double pulseWidth)
Calculate Weather Radar Average Power.
Definition: formula.hpp:138
Wavelength velocity class.
Definition: formula.hpp:88
static double freqMHzToMeters(double freqMHz)
Calculate wave length expressed in meters using frequency.
Definition: formula.hpp:97
static double freqMHzToCM(double freqMHz)
Calculate wave length expressed in centimeters using frequency.
Definition: formula.hpp:110
Weather Radar Average Power.
Definition: formula.hpp:126
static double calculateKWatts(double peakPwr, int prf, double pulseWidth)
Calculate Weather Radar Average Power.
Definition: formula.hpp:154
Niquist velocity class.
Definition: formula.hpp:43
static double calculate(long prf, double waveLength_meters)
Calculate nyquist velocity (meters/seconds) using PRF and wavelength.
Definition: formula.hpp:52
static double calculate(long lowPRF, long highPRF, double waveLength_meters)
Calculate nyquist velocity (meters/seconds) using dual PRF values and wavelength. ...
Definition: formula.hpp:65