-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLNRadarDesign.py
53 lines (42 loc) · 1.44 KB
/
LNRadarDesign.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/bin/env python
"""
@author Lee Begg
"""
class CWFMRadarDesign(object):
"""
This class calculates the key parameters for Continuous Wave
Frequency Modulated Radar.
"""
c = 3e8
def __init__(self):
self.sweep = 0.0
self.modfreq = 0.0
self.maxrange = 0.0
self.centrefreq = 0.0
self.fftpoints = 0
self.precision = 0.0
self.minrange = 0.0
self.maxbeatfreq = 0.0
def maxBeatFrequency(self):
"""Calculates the beat frequency at maximum range"""
td = self.maxrange * 2.0 / self.c
freqchange = self.sweep * (self.modfreq * 2.0)
freqdiff = freqchange * td
self.maxbeatfreq = freqdiff
return self.maxbeatfreq
def calcFFTTimeWindow(self):
"""Calculate the time window for a FFT"""
sampleperiod = 1.0/(self.maxbeatfreq * 2)
return sampleperiod * self.fftpoints
def range(self, freq):
"""Calculate the range from the beat frequency
@param freq The beat frequency
@return The range in metres
"""
return (freq * (1./(self.modfreq * 2.)) * self.c) / (2 * self.sweep)
def beatFreq(self, range):
"""Calculate the beat frequency for a given range.
@param range The range in metres
@return The beat frequency
"""
return (range * 2. * self.sweep) / (1./(self.modfreq * 2.) * self.c)