-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpatch antenna
More file actions
174 lines (149 loc) · 5.05 KB
/
patch antenna
File metadata and controls
174 lines (149 loc) · 5.05 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import numpy as np
import matplotlib.pyplot as plt
import context
import cst_python_api as cpa
projectName = "Patch_Antenna_Example"
# Create the CST project
myCST = cpa.CST_MicrowaveStudio(context.dataFolder, projectName + ".cst")
# Set the default units for the project
myCST.Project.setUnits()
######################
#
# CREATE THE 3D MODEL
#
######################
#%%
# Definition of the geometry parameters for the antenna
patchWidth = 28.45
patchLength = 28.45
feedPoint = 9
feedLineWidth = 1.137
feedingGap = 1
substrateWidth = 2 * patchWidth
substrateLength = 2 * patchLength
condThickness = 0.035
substrateThickness = 1.6
# Add FR4 material to the project
myCST.Build.Material.addNormalMaterial(
"FR4 (Lossy)", 4.3, 1.0, colour=[0.94, 0.82, 0.76], tanD = 0.025)
# Create ground plane
myCST.Build.Shape.addBrick(
xMin = -0.5*substrateWidth, xMax = 0.5*substrateWidth,
yMin = -0.5*substrateLength, yMax = 0.5*substrateLength,
zMin = 0.0, zMax = condThickness,
name = "Groundplane", component = "component1", material="PEC"
)
# Create substrate
myCST.Build.Shape.addBrick(
xMin = -0.5*substrateWidth, xMax = 0.5*substrateWidth,
yMin = -0.5*substrateLength, yMax = 0.5*substrateLength,
zMin = condThickness, zMax = condThickness+substrateThickness,
name = "Substrate", component = "component1", material="FR4 (Lossy)"
)
# Create patch
myCST.Build.Shape.addBrick(
xMin = -0.5*patchWidth, xMax = 0.5*patchWidth,
yMin = -0.5*patchLength, yMax = 0.5*patchLength,
zMin = condThickness+substrateThickness,
zMax = 2*condThickness+substrateThickness,
name = "Patch", component = "component1", material="PEC"
)
# Create feeding gap
myCST.Build.Shape.addBrick(
xMin = -(0.5*feedLineWidth + feedingGap),
xMax = (0.5*feedLineWidth + feedingGap),
yMin = -0.5*patchLength, yMax = -0.5*patchLength + feedPoint,
zMin = condThickness+substrateThickness,
zMax = 2*condThickness+substrateThickness,
name = "Feeding_gap", component = "component1", material="Vacuum"
)
# Subtract the feeding gap from the patch
myCST.Build.Boolean.subtract("component1:Patch", "component1:Feeding_gap")
# Create feed line
myCST.Build.Shape.addBrick(
xMin = -0.5*feedLineWidth, xMax = 0.5*feedLineWidth,
yMin = -0.5*substrateLength, yMax = -0.5*patchLength + feedPoint,
zMin = condThickness+substrateThickness,
zMax = 2*condThickness+substrateThickness,
name = "Feed_line", component = "component1", material="PEC"
)
# Join the feed line and the patch
myCST.Build.Boolean.add("component1:Patch", "component1:Feed_line")
###########################
#
# CONFIGURE THE SIMULATION
#
###########################
myCST.Solver.setFrequencyRange(1.5, 3.5)
# Set the bounding box limits
myCST.Solver.setBackgroundLimits(
xMin = 0.0, xMax = 0.0,
yMin = 0.0, yMax = 0.0,
zMin = 0.0, zMax = 0.0,
)
# Set the boundary conditions
myCST.Solver.setBoundaryCondition(
xMin = "expanded open", xMax = "expanded open",
yMin = "expanded open", yMax = "expanded open",
zMin = "expanded open", zMax = "expanded open",
)
# Define excitation port
myCST.Solver.Port.addWaveguidePort(
xMin =-substrateWidth/2, xMax = substrateWidth/2,
yMin = -substrateLength/2, yMax = -substrateLength/2,
zMin = -1.6, zMax = 8.035,
orientation = "ymin", nModes = 1
)
# Set the field monitors
myCST.Solver.addFieldMonitor("Efield", 2.48)
myCST.Solver.addFieldMonitor("Hfield", 2.48)
myCST.Solver.addFieldMonitor("Farfield", 2.48)
# Set the solver type
myCST.Solver.changeSolverType("HF Time Domain")
##############################################
#
# RUN THE SIMULATION AND RETRIEVE THE RESULTS
#
##############################################
#%%
# Launch the simulation
myCST.Solver.runSimulation()
#%%
# Retrieve S-Parameters results
freq, S11 = myCST.Results.getSParameters(1, 1)
# Retrieve farfield results
vTheta = np.arange(-180, 181, 1)
vPhi = np.array([0, 45, 90])
farField = myCST.Results.getFarField(
2.48, vTheta, vPhi, port = 1, coordSys="ludwig3",
component=["vertical", "horizontal"])
#%%
# PLOT THE S-PARAMETERS RESULTSc
# Create a new figure
plt.figure(0)
# Plot the retrieved results
plt.plot(freq, 20*np.log10(np.abs(S11)), color="C0")
# Decorate the figure
plt.xlabel("Frequency (GHz)")
plt.ylabel("$|S_{11}|$ (dB)")
plt.legend()
plt.grid()
plt.show()
# PLOT THE FARFIELD RESULTS
# Create a new figure
plt.figure(1)
# Plot the retrieved results
plt.plot(vTheta, farField[0][:,0], color="green", label="$\phi=0^\circ$ (Cop)")
plt.plot(vTheta, farField[1][:,0], color="green", label="$\phi=0^\circ$ (Cxp)", linestyle="dashed")
plt.plot(vTheta, farField[0][:,2], color="blue", label="$\phi=90^\circ$ (Cop)")
plt.plot(vTheta, farField[1][:,2], color="blue", label="$\phi=90^\circ$ (Cxp)", linestyle="dashed")
plt.plot(vTheta, farField[0][:,1], color="red", label="$\phi=45^\circ$ (Cop)")
plt.plot(vTheta, farField[1][:,1], color="red", label="$\phi=45^\circ$ (Cxp)", linestyle="dashed")
# Decorate the figure
plt.xlabel("$\\theta (^\circ)$")
plt.ylabel("Directivity (dBi)")
plt.title("farfield (f=2.48) [1]")
plt.ylim((-51,11))
plt.legend()
plt.grid()
plt.show()