Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AshivDhondea authored Jan 30, 2018
1 parent 42a139c commit 2f7c9c8
Show file tree
Hide file tree
Showing 12 changed files with 407 additions and 0 deletions.
61 changes: 61 additions & 0 deletions chapter_01/RadarBasics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
"""
Created on 21 October 2017
Python functions implementing basic radar calculations
Makes extensive use of numpy arrays to ensure that scalar and array inputs
are both handled fine.
Ref:
1. Principles of Modern Radar, vol 1. aka POMR
@author: Ashiv Dhondea
"""
import math
import numpy as np

import RadarConstants as RC
# ------------------------------------------------------------------------- #
# The following functions are compatible with numpy array inputs.
# e.g allow you to convert an array of power values to decibels easily.
def fn_Power_to_dB(p):
"""
Convert power from watts to decibels
"""
return 10*np.log10(p);

def fn_dB_to_Power(dB):
"""
Convert decibels to watts
"""
vec10 = 10.*np.ones_like(dB);
exponents = 0.1*dB;
return np.power(vec10,exponents)
# ------------------------------------------------------------------------- #
# Use numpy arrays for maximum flexibility wrt inputs
def fnCalculate_Wavelength_or_Frequency(speed_light,freq):
"""
# wavelength in metres if speed_light in m/s and freq in hertz
# frequency in hertz if speed_light in m/s and wavelenght in metres
"""
return np.divide(speed_light,freq )
# ------------------------------------------------------------------------- #
def fnCalculate_Monostatic_RangeResolution(speed_light,bandwidth):
"""
Calculate the monostatic range resolution
speed_light in [m/s]
bandwidth in [Hz]
"""
return np.divide(speed_light,2*bandwidth)

def fnCalculate_Monostatic_VelocityResolution(wavelength,pulse_width):
"""
Calculate the monostatic velocity resolution
wavelength in [m]
pulse_width in [s]
"""
return np.divide(wavelength,2*pulse_width)
# ------------------------------------------------------------------------- #
def fnCalculate_TimeBandwidthProduct(pulse_width,bandwidth):
return np.multiply(pulse_width,bandwidth)
13 changes: 13 additions & 0 deletions chapter_01/RadarConstants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
"""
Created on 21 October 2017
Commonly used radar constants
@author: Ashiv Dhondea
"""
# ---------------------------------------------------------------------------- #
c = 299792458.; # [m/s]
# --------------------------------------------------------------------------- #
boltzmann_constant = 1.38064852e-23; # [watt sec/K]

48 changes: 48 additions & 0 deletions chapter_01/RadarEquations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
"""
Created on 21 October 2017
@author: Ashiv Dhondea
"""
import math
import numpy as np

import RadarBasics as RB
import RadarConstants as RC

# ------------------------------------------------------------------------- #
def fnCalculate_ReceivedPower(P_Tx,G_Tx,G_Rx,rho_Rx,rho_Tx,wavelength,RCS):
"""
Calculate the received power at the bistatic radar receiver.
equation 5 in " PERFORMANCE ASSESSMENT OF THE MULTIBEAM RADAR
SENSOR BIRALES FOR SPACE SURVEILLANCE AND TRACKING"
Note: ensure that the distances rho_Rx,rho_Tx,wavelength are converted to
metres before passing into this function.
Created on: 26 May 2017
"""
denominator = (4*math.pi)**3 * (rho_Rx**2)*(rho_Tx**2);
numerator = P_Tx*G_Tx*G_Rx*RCS*(wavelength**2);
P_Rx = numerator/denominator;
return P_Rx

def fnCalculate_ReceivedSNR(P_Rx,T0,bandwidth,radar_loss):
"""
Calculate the SNR at the bistatic radar receiver.
equation 7 in " PERFORMANCE ASSESSMENT OF THE MULTIBEAM RADAR
SENSOR BIRALES FOR SPACE SURVEILLANCE AND TRACKING"
Note: output is not in decibels.
Created on: 26 May 2017
Edited:
21.10.17: included the term radar_loss, symbol L in eqn 1.56 in Mahafza radar book
"""
k_B = RC.boltzmann_constant;
snr = P_Rx/(k_B*bandwidth*T0*radar_loss);
return snr


49 changes: 49 additions & 0 deletions chapter_01/chapter_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
"""
Created on 26 January 2018
@author: Ashiv Dhondea
"""
import numpy as np
import math
import RadarBasics as RB
import RadarConstants as RC

# ------------------------------------------------------------------------- #
speed_light = RC.c; # [m/s]
# ------------------------------------------------------------------------- #
def fn_Calc_PulseWidth_RadarEq(P_Tx, G_Tx, G_Rx, rho_Rx, rho_Tx, wavelength, RCS, snr, T0, radar_loss):
"""
Implements eqn 1.57 in Mahafza book.
"""
k_B = RC.boltzmann_constant;
numerator = (4*math.pi)**3 * (rho_Rx**2)*(rho_Tx**2)*snr* k_B*T0*radar_loss;
denominator = P_Tx*G_Tx*G_Rx*RCS*(wavelength**2);
pulse_width = numerator/denominator;
return pulse_width

def fn_Calc_SearchVolume(az,el):
"""
az,el in deg
eqn 1.61 in Mahafza book
"""
return az*el/(57.296**2) # steradians

def fn_power_aperture(snr,tsc,rcs,rho,te,nf,loss,az_angle,el_angle):
"""
implements Listing 1.5. MATLAB Function “power_aperture.m”
% This program implements Eq. (1.67)
"""
Tsc = RB.fn_Power_to_dB(tsc); # convert Tsc into dB
Sigma = RB.fn_Power_to_dB(rcs);# convert sigma to dB
four_pi = RB.fn_Power_to_dB(4.0 * math.pi); # (4pi) in dB
k_B = RC.boltzmann_constant;
k_db = RB.fn_Power_to_dB(k_B); # Boltzman’s constant in dB
Te = RB.fn_Power_to_dB(te) #noise temp. in dB
range_pwr4_db = RB.fn_Power_to_dB(rho**4); # target range^4 in dB
omega = fn_Calc_SearchVolume(az_angle,el_angle) # compute search volume in steradians
Omega = RB.fn_Power_to_dB(omega)# search volume in dB
# implement Eq. (1.67)
PAP = snr + four_pi + k_db + Te + nf + loss + range_pwr4_db + Omega - Sigma - Tsc;
return PAP
Binary file added chapter_01/main_chapter01_00_12a.pdf
Binary file not shown.
Binary file added chapter_01/main_chapter01_00_12b.pdf
Binary file not shown.
83 changes: 83 additions & 0 deletions chapter_01/main_chapter01_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
"""
Created on 26 January 2018
implements Listing 1.3. MATLAB Program “fig1_13.m”
in Mahafza radar book
@author: Ashiv Dhondea
"""
import numpy as np
import math

import RadarBasics as RB
import RadarConstants as RC

# Importing what's needed for nice plots.
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font', **{'family': 'serif', 'serif': ['Helvetica']})
rc('text', usetex=True)
params = {'text.latex.preamble' : [r'\usepackage{amsmath}', r'\usepackage{amssymb}']}
plt.rcParams.update(params)

# ------------------------------------------------------------------------- #
speed_light = RC.c; # [m/s]
# ------------------------------------------------------------------------- #
# Radar parameters
P_Tx = 1.e6; # [W]
centre_freq = 5.6e9; #[Hz]
G_Tx_dB = 40.; # [dB]
G_Tx = RB.fn_dB_to_Power(G_Tx_dB)
G_Rx = G_Tx;
RCS = 0.1 #[m^2]
te = 300.; # [K]
nf = 5.; #[dB]

T0 = RB.fn_dB_to_Power(nf)*te
radar_loss = RB.fn_dB_to_Power(6.0);
# ------------------------------------------------------------------------- #
rho_Tx = np.array([75e3,100e3,150e3],dtype=np.float64) # [m]
snr_db = np.linspace(5.,20.,200); # SNR values from 5 dB to 20 dB 200 points

snr = RB.fn_dB_to_Power(snr_db); #10.^(0.1.*snr_db); % convert snr into base 10


wavelength = RB.fnCalculate_Wavelength_or_Frequency(speed_light,centre_freq); # [m]

def fn_Calc_PulseWidth_RadarEq(P_Tx, G_Tx, G_Rx, rho_Rx, rho_Tx, wavelength, RCS, snr, T0, radar_loss):
"""
Implements eqn 1.57 in Mahafza book.
"""
k_B = RC.boltzmann_constant;
numerator = (4*math.pi)**3 * (rho_Rx**2)*(rho_Tx**2)*snr* k_B*T0*radar_loss;
denominator = P_Tx*G_Tx*G_Rx*RCS*(wavelength**2);
pulse_width = numerator/denominator;
return pulse_width

pulse_width_array = np.zeros([np.shape(rho_Tx)[0],np.shape(snr)[0]],dtype=np.float64);
for i in range(0,np.shape(rho_Tx)[0]):
for j in range(0,np.shape(snr)[0]):
pulse_width_array[i,j] = fn_Calc_PulseWidth_RadarEq(P_Tx,G_Tx,G_Tx,rho_Tx[i],rho_Tx[i],wavelength,RCS,snr[j],T0,radar_loss)

# ------------------------------------------------------------------------- #

fig = plt.figure(1);
ax = fig.gca()
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
fig.suptitle(r"\textbf{Pulse width versus required SNR for three different detection range values}" ,fontsize=12);
i = 0;
plt.semilogy(snr_db,1e6*pulse_width_array[i,:],label=r"$\rho = %0.1f~\mathrm{km}$" %(rho_Tx[i]/1e3));
i = 1;
plt.semilogy(snr_db,1e6*pulse_width_array[i,:],linestyle='-.',label=r"$\rho = %0.1f~\mathrm{km}$" %(rho_Tx[i]/1e3));
i = 2;
plt.semilogy(snr_db,1e6*pulse_width_array[i,:],linestyle='--',label=r"$\rho = %0.1f~\mathrm{km}$" %(rho_Tx[i]/1e3));
plt.xlim(5,20)

ax.set_ylabel(r"Pulse width $\tau~[\mathrm{\mu s}]$")
ax.set_xlabel(r'Minimum required SNR $[\mathrm{dB}]$');
plt.legend(loc='best')
plt.grid(True,which='both',linestyle=(0,[0.7,0.7]),lw=0.4,color='black')
fig.savefig('main_chapter01_01_13.pdf',bbox_inches='tight',pad_inches=0.11,dpi=10)
Binary file added chapter_01/main_chapter01_01_13.pdf
Binary file not shown.
30 changes: 30 additions & 0 deletions chapter_01/main_chapter01_02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
"""
Created on 26 January 2018
Listing 1.4. MATLAB Program “ref_snr.m”
in Mahafza radar book
@author: Ashiv Dhondea
"""

import RadarBasics as RB

# ------------------------------------------------------------------------- #
Rref = 86e3; # reference range
tau_ref = 0.1e-6; # reference pulse width
SNRref = 20.; # Ref SNR in dB
snrref = RB.fn_dB_to_Power(SNRref)

Sigmaref = 0.1; # ref RCS in m^2
Lossp_dB = 2; # processing loss in dB
lossp = RB.fn_dB_to_Power(Lossp_dB);
# Enter desired value
tau = tau_ref;
R = 120e3;
rangeratio = (Rref / R)**4;
Sigma = 0.2;
# Implement Eq. (1.60)
snr = snrref * (tau / tau_ref) * (1. / lossp) * (Sigma / Sigmaref) * rangeratio;
snr = RB.fn_Power_to_dB(snr)
print('SNR at 120 km = %.1f dB' %snr)
Loading

0 comments on commit 2f7c9c8

Please sign in to comment.