-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatchAntenna.py
More file actions
49 lines (40 loc) · 1.82 KB
/
Copy pathpatchAntenna.py
File metadata and controls
49 lines (40 loc) · 1.82 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
from antenna import Antenna
import os
from CSXCAD import ContinuousStructure
from openEMS import openEMS
from openEMS.physical_constants import *
class PatchAntenna(Antenna):
def __init__(self,id_,L_,W_,x_,y_,hs_,epsr_):
super().__init__(id_,'Patch')
self.L = L_
self.W = W_
self.x = x_
self.y = y_
self.hs = hs_
self.epsr=epsr_
def makeSim(self,FDTD,CSX,mesh,excite,max_res):
patch = CSX.AddMetal(f'patch{self.id}')
start = [self.x-self.W/2, self.y-self.L/2, self.hs]
stop = [self.x+self.W/2, self.y+self.L/2, self.hs]
patch.AddBox(priority=10, start=start, stop=stop)
mesh.AddLine('x',[start[0],stop[0]])
mesh.AddLine('y',[start[1],stop[1]])
substrate=CSX.AddMaterial(f'substrate{self.id}')
substrate.SetMaterialProperty(epsilon=self.epsr)
start = [self.x-0.6*self.W, self.y-0.6*self.L, 0]
stop = [self.x+0.6*self.W, self.y+0.6*self.L, self.hs]
substrate.AddBox(start=start, stop=stop, priority=0)
mesh.AddLine('x',[start[0],stop[0]])
mesh.AddLine('y',[start[1],stop[1]])
ground =CSX.AddMetal(f'ground{self.id}')
start = [self.x-0.6*self.W, self.y-0.6*self.L, 0]
stop = [self.x+0.6*self.W, self.y+0.6*self.L, 0]
ground.AddBox(start=start,stop=stop,priority=10)
mesh.AddLine('z', np.linspace(0,self.hs,5))
# apply the excitation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start=[self.x-0.2,self.y-0.22*self.L,0]
stop =[self.x+0.2,self.y-0.18*self.L,self.hs]
port= FDTD.AddLumpedPort(priority=5,port_nr=self.id,R=50,start=start,stop=stop,p_dir='z',excite=self.excite)
mesh.AddLine('x',[start[0],stop[0]])
mesh.AddLine('y',[start[1],stop[1]])
return [CSX, FDTD, mesh, port]