Skip to content

Commit

Permalink
Added ross 3d functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Baxter committed Mar 16, 2020
1 parent f23849e commit c6fe218
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 4 additions & 3 deletions antennas.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ def init_3DPlot(self, Plots):
self.rad3D = self.antPat3D
elif(Plots.simType == "Antenna Array"):
if(Plots.arrType == "NoDip"):
#TODO: Normalized array factor alone.
self.arrFact3D = np.ones(Plots.THETA.shape) #TODO: A placeholder function for array factor equation for testing.
self.rad3D = self.arrFact3D
sigma = np.add (2 * pi * Plots.d * cos(Plots.gamma3D), Plots.d_phi)
N = Plots.numEle
self.arrFact3D = (1 / N) * np.abs(np.divide(sin(N * sigma /2), sin(sigma / 2)))
self.rad3D = np.divide(self.arrFact3D,np.max(self.arrFact3D))
elif(Plots.arrType == "ColArray"):
self.antPat3D = ((cos(Plots.len*pi*cos(Plots.THETA)) - cos(Plots.len*pi))/sin(Plots.THETA))
self.antPat3D = np.divide(self.antPat3D, np.amax(self.antPat3D))
Expand Down
14 changes: 10 additions & 4 deletions plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, figsize=None, dpi=None):
self.bx.set_title("Normalized Radiation Pattern (Linear)", pad=10)


self.d_ticks = np.linspace(0, 10, 21)
self.d_ticks = np.linspace(0, 30, 31)
self.cx.set_rmin(0)
self.cx.set_rlabel_position(180)
self.cx.set_rticks(self.d_ticks)
Expand All @@ -46,9 +46,6 @@ def __init__(self, figsize=None, dpi=None):

### SET INITIAL ANTENNA PARAMETERS ###
self.theta2D = np.linspace(-pi, pi, 10000)
self.theta3D = np.linspace(0.0000000000001, pi, 40)
self.phi3D = np.linspace(-pi, pi, 40)
self.THETA, self.PHI = np.meshgrid(self.theta3D, self.phi3D)
self.numEle = 2
self.simType = "Single Dipole"
self.arrType = "NoDip"
Expand All @@ -74,12 +71,21 @@ def init_2Dplots(self):
self.bx.legend(loc='upper right')

def init_3Dplot(self):

self.theta3D = np.linspace(0.0000000000001, pi, 40 + self.numEle * 10)
self.phi3D = np.linspace(-pi, pi, 40 + self.numEle * 10)
self.THETA, self.PHI = np.meshgrid(self.theta3D, self.phi3D)
self.gamma3D = np.arccos(np.sin(self.PHI)*np.sin(self.THETA))

self.antProf.init_3DPlot(self)
self.X = self.antProf.rad3D * np.sin(self.THETA) * np.cos(self.PHI)
self.Y = self.antProf.rad3D * np.sin(self.THETA) * np.sin(self.PHI)
self.Z = self.antProf.rad3D * np.cos(self.THETA)
self.ex.plot_surface(self.X, self.Y, self.Z, rstride=1, cstride=1, cmap=plt.get_cmap('jet'),
linewidth=0, antialiased=False, alpha=0.5)
self.ex.set_xlim(-1,1)
self.ex.set_ylim(-1,1)
self.ex.set_zlim(-1,1)

def update_plots(self):
if(self.plot3D):
Expand Down

0 comments on commit c6fe218

Please sign in to comment.