current probes can be a point or line which allows for 1D/2D lumped ports
- this needs the new probe box interface in CSXCAD - most tutorials have been updated Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/1/head
parent
964cb08f4d
commit
3b44620278
|
@ -40,23 +40,51 @@ void ProcessCurrent::DefineStartStopCoord(double* dstart, double* dstop)
|
|||
{
|
||||
ProcessIntegral::DefineStartStopCoord(dstart, dstop);
|
||||
|
||||
m_normDir = -1;
|
||||
for (int n=0; n<3; ++n)
|
||||
if ((m_normDir<0) || (m_normDir>2))
|
||||
{
|
||||
if (stop[n] == start[n])
|
||||
m_normDir = n;
|
||||
if (m_Dimension!=2)
|
||||
{
|
||||
cerr << "ProcessCurrent::DefineStartStopCoord(): Warning Current Integration Box \"" << m_filename << "\" is not a surface (found dimension: " << m_Dimension << ") nor has it set a valid normal direction! --> disabled" << endl;
|
||||
SetEnable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int n=0; n<3; ++n)
|
||||
{
|
||||
if (stop[n] == start[n])
|
||||
m_normDir = n;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//expand dimension to 2 if possible
|
||||
m_Dimension = 0;
|
||||
for (int n=0; n<3; ++n)
|
||||
{
|
||||
if (n==m_normDir)
|
||||
continue;
|
||||
if (dstart[n]==dstop[n])
|
||||
{
|
||||
if ((Op->GetDiscLine( n, start[n], true ) > dstart[n]) && (start[n]>0))
|
||||
--start[n];
|
||||
if ((Op->GetDiscLine( n, start[n], true ) < dstart[n]) && (stop[n]<Op->GetNumberOfLines(n)-1))
|
||||
++stop[n];
|
||||
}
|
||||
if (stop[n] > start[n])
|
||||
++m_Dimension;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_normDir<0)
|
||||
if (start[m_normDir]!=stop[m_normDir])
|
||||
{
|
||||
cerr << "ProcessCurrent::DefineStartStopCoord(): Warning Current Integration Box \"" << m_filename << "\" has an invalid normal direction --> disabled" << endl;
|
||||
cerr << "ProcessCurrent::DefineStartStopCoord(): Warning Current Integration Box \"" << m_filename << "\" has an expansion in normal direction! --> disabled" << endl;
|
||||
SetEnable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Dimension!=2)
|
||||
if ((m_normDir<0) || (m_normDir>2))
|
||||
{
|
||||
cerr << "ProcessCurrent::DefineStartStopCoord(): Warning Current Integration Box \"" << m_filename << "\" is not a surface (found dimension: " << m_Dimension << ") --> disabled" << endl;
|
||||
cerr << "ProcessCurrent::DefineStartStopCoord(): Warning Current Integration Box \"" << m_filename << "\" has an invalid normal direction --> disabled" << endl;
|
||||
SetEnable(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public:
|
|||
virtual double CalcIntegral();
|
||||
|
||||
protected:
|
||||
int m_normDir; //current box has to be 2D plane, this is the normal direction
|
||||
};
|
||||
|
||||
#endif // PROCESSCURRENT_H
|
||||
|
|
|
@ -24,6 +24,7 @@ ProcessIntegral::ProcessIntegral(Engine_Interface_Base* eng_if) : Processing(en
|
|||
{
|
||||
m_Results=NULL;
|
||||
m_FD_Results=NULL;
|
||||
m_normDir = -1;
|
||||
}
|
||||
|
||||
ProcessIntegral::~ProcessIntegral()
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
|
||||
virtual string GetProcessingName() const = 0;
|
||||
|
||||
virtual void GetNormalDir(int nd) {m_normDir=nd;}
|
||||
|
||||
//! Flush FD data to disk
|
||||
virtual void FlushData();
|
||||
|
||||
|
@ -62,6 +64,8 @@ protected:
|
|||
|
||||
vector<double_complex> *m_FD_Results;
|
||||
double *m_Results;
|
||||
|
||||
int m_normDir; // normal direction as required by some integral processings
|
||||
};
|
||||
|
||||
#endif // PROCESSINTEGRAL_H
|
||||
|
|
|
@ -47,8 +47,8 @@ else
|
|||
error 'dir must have exactly one component ~= 0'
|
||||
end
|
||||
|
||||
if (sum(start==stop)>0)
|
||||
error 'start/stop in must not be equal in any direction --> lumped port needs a 3D box'
|
||||
if (stop(n_dir)==start(n_dir))
|
||||
error 'start/stop in excitation direction in must not be equal'
|
||||
end
|
||||
|
||||
if (stop(n_dir)-start(n_dir)) > 0
|
||||
|
@ -93,7 +93,7 @@ u_stop = 0.5*(start + stop);
|
|||
u_start(n_dir) = start(n_dir);
|
||||
u_stop(n_dir) = stop(n_dir);
|
||||
|
||||
CSX = AddProbe(CSX,['port_ut' int2str(portnr)], 0, -direction);
|
||||
CSX = AddProbe(CSX,['port_ut' int2str(portnr)], 0, 'weight', -direction);
|
||||
CSX = AddBox(CSX,['port_ut' int2str(portnr)], prio, u_start, u_stop);
|
||||
|
||||
i_start = start;
|
||||
|
@ -101,6 +101,6 @@ i_stop = stop;
|
|||
i_start(n_dir) = 0.5*(start(n_dir)+stop(n_dir));
|
||||
i_stop(n_dir) = 0.5*(start(n_dir)+stop(n_dir));
|
||||
|
||||
CSX = AddProbe(CSX,['port_it' int2str(portnr)], 1, direction);
|
||||
CSX = AddProbe(CSX,['port_it' int2str(portnr)], 1, 'weight', direction, 'NormDir', n_dir-1);
|
||||
CSX = AddBox(CSX,['port_it' int2str(portnr)], prio, i_start, i_stop);
|
||||
|
||||
|
|
|
@ -192,21 +192,21 @@ i2_stop(idx_prop) = i2_start(idx_prop);
|
|||
name = ['port_ut' num2str(portnr) 'A'];
|
||||
% weight = sign(stop(idx_height)-start(idx_height))
|
||||
weight = upsidedown;
|
||||
CSX = AddProbe( CSX, name, 0, weight );
|
||||
CSX = AddProbe( CSX, name, 0, 'weight', weight );
|
||||
CSX = AddBox( CSX, name, prio, v1_start, v1_stop );
|
||||
name = ['port_ut' num2str(portnr) 'B'];
|
||||
CSX = AddProbe( CSX, name, 0, weight );
|
||||
CSX = AddProbe( CSX, name, 0, 'weight', weight );
|
||||
CSX = AddBox( CSX, name, prio, v2_start, v2_stop );
|
||||
name = ['port_ut' num2str(portnr) 'C'];
|
||||
CSX = AddProbe( CSX, name, 0, weight );
|
||||
CSX = AddProbe( CSX, name, 0, 'weight', weight );
|
||||
CSX = AddBox( CSX, name, prio, v3_start, v3_stop );
|
||||
name = ['port_it' num2str(portnr) 'A'];
|
||||
|
||||
weight = direction;
|
||||
CSX = AddProbe( CSX, name, 1, weight );
|
||||
CSX = AddProbe( CSX, name, 1, 'weight', weight );
|
||||
CSX = AddBox( CSX, name, prio, i1_start, i1_stop );
|
||||
name = ['port_it' num2str(portnr) 'B'];
|
||||
CSX = AddProbe( CSX, name, 1, weight );
|
||||
CSX = AddProbe( CSX, name, 1,'weight', weight );
|
||||
CSX = AddBox( CSX, name, prio, i2_start, i2_stop );
|
||||
|
||||
% create port structure
|
||||
|
|
|
@ -73,7 +73,7 @@ end
|
|||
CSX = AddMetal( CSX, 'PEC' );
|
||||
portstart = [ mesh.x(1) , -CRLH.LW/2, substratelines(end)];
|
||||
portstop = [ -CRLH.LL/2, CRLH.LW/2, 0];
|
||||
[CSX,port{1}] = AddMSLPort( CSX, 999, 1, 'PEC', portstart, portstop, 0, [0 0 -1], 'ExcitePort', 'excite', 'FeedShift', 10*resolution(1), 'MeasPlaneShift', feed_length/2);
|
||||
[CSX,port{1}] = AddMSLPort( CSX, 999, 1, 'PEC', portstart, portstop, 0, [0 0 -1], 'ExcitePort', true, 'FeedShift', 10*resolution(1), 'MeasPlaneShift', feed_length/2);
|
||||
|
||||
portstart = [ mesh.x(end) , -CRLH.LW/2, substratelines(end)];
|
||||
portstop = [ +CRLH.LL/2, CRLH.LW/2, 0];
|
||||
|
|
|
@ -108,12 +108,12 @@ stop = [mesh.x(end) mesh.y(end) mesh.z(end)] - 10*resolution;
|
|||
Sim_Path = 'tmp_CRLH_LeakyWave';
|
||||
Sim_CSX = 'CRLH.xml';
|
||||
|
||||
[status, message, messageid] = rmdir( Sim_Path, 's' ); % clear previous directory
|
||||
[status, message, messageid] = mkdir( Sim_Path ); % create empty simulation folder
|
||||
% [status, message, messageid] = rmdir( Sim_Path, 's' ); % clear previous directory
|
||||
% [status, message, messageid] = mkdir( Sim_Path ); % create empty simulation folder
|
||||
|
||||
WriteOpenEMS( [Sim_Path '/' Sim_CSX], FDTD, CSX );
|
||||
% WriteOpenEMS( [Sim_Path '/' Sim_CSX], FDTD, CSX );
|
||||
CSXGeomPlot( [Sim_Path '/' Sim_CSX] );
|
||||
RunOpenEMS( Sim_Path, Sim_CSX );
|
||||
% RunOpenEMS( Sim_Path, Sim_CSX );
|
||||
|
||||
%% post-processing
|
||||
close all
|
||||
|
@ -140,7 +140,7 @@ phi = 0:2:360;
|
|||
theta = 0:2:180;
|
||||
|
||||
disp( 'calculating 3D far field pattern...' );
|
||||
nf2ff = CalcNF2FF(nf2ff, Sim_Path, f_rad, theta*pi/180, phi*pi/180, 'Outfile','3D_Pattern.h5', 'Mode', 1,'Verbose',1);
|
||||
nf2ff = CalcNF2FF(nf2ff, Sim_Path, f_rad, theta*pi/180, phi*pi/180, 'Outfile','3D_Pattern.h5', 'Mode', 0,'Verbose',1);
|
||||
|
||||
%%
|
||||
P_in = 0.5*port{1}.uf.inc .* conj( port{1}.if.inc ); % accepted antenna feed power
|
||||
|
|
|
@ -83,17 +83,17 @@ CSX = AddBox(CSX,'excite',0 ,start,stop);
|
|||
%port 1
|
||||
start = [mesh.r(1) mesh.a(1) mesh.z(15)];
|
||||
stop = [mesh.r(end) mesh.a(end) mesh.z(15)];
|
||||
CSX = AddProbe(CSX, 'ut1', 10, 1, [], 'ModeFunction',{func_Er,func_Ea,0});
|
||||
CSX = AddProbe(CSX, 'ut1', 10, 'ModeFunction',{func_Er,func_Ea,0});
|
||||
CSX = AddBox(CSX, 'ut1', 0 ,start,stop);
|
||||
CSX = AddProbe(CSX,'it1', 11, 1, [], 'ModeFunction',{func_Hr,func_Ha,0});
|
||||
CSX = AddProbe(CSX,'it1', 11, 'ModeFunction',{func_Hr,func_Ha,0});
|
||||
CSX = AddBox(CSX,'it1', 0 ,start,stop);
|
||||
|
||||
%port 2
|
||||
start(3) = mesh.z(end-14);
|
||||
stop(3) = mesh.z(end-14);
|
||||
CSX = AddProbe(CSX, 'ut2', 10, 1, [], 'ModeFunction',{func_Er,func_Ea,0});
|
||||
CSX = AddProbe(CSX, 'ut2', 10, 'ModeFunction',{func_Er,func_Ea,0});
|
||||
CSX = AddBox(CSX, 'ut2', 0 ,start,stop);
|
||||
CSX = AddProbe(CSX,'it2', 11, 1, [], 'ModeFunction',{func_Hr,func_Ha,0});
|
||||
CSX = AddProbe(CSX,'it2', 11, 'ModeFunction',{func_Hr,func_Ha,0});
|
||||
CSX = AddBox(CSX,'it2', 0 ,start,stop);
|
||||
|
||||
port_dist = mesh.z(end-14) - mesh.z(15);
|
||||
|
|
|
@ -86,17 +86,17 @@ CSX = AddBox(CSX,'excite',0 ,start,stop);
|
|||
%port 1
|
||||
start = [mesh.x(1) mesh.y(1) mesh.z(15)];
|
||||
stop = [mesh.x(end) mesh.y(end) mesh.z(15)];
|
||||
CSX = AddProbe(CSX, 'ut1', 10, 1, [], 'ModeFunction',{func_Ex,func_Ey,0});
|
||||
CSX = AddProbe(CSX, 'ut1', 10, 'ModeFunction',{func_Ex,func_Ey,0});
|
||||
CSX = AddBox(CSX, 'ut1', 0 ,start,stop);
|
||||
CSX = AddProbe(CSX,'it1', 11, 1, [], 'ModeFunction',{func_Hx,func_Hy,0});
|
||||
CSX = AddProbe(CSX,'it1', 11, 'ModeFunction',{func_Hx,func_Hy,0});
|
||||
CSX = AddBox(CSX,'it1', 0 ,start,stop);
|
||||
|
||||
%port 2
|
||||
start = [mesh.x(1) mesh.y(1) mesh.z(end-14)];
|
||||
stop = [mesh.x(end) mesh.y(end) mesh.z(end-14)];
|
||||
CSX = AddProbe(CSX, 'ut2', 10, 1, [], 'ModeFunction',{func_Ex,func_Ey,0});
|
||||
CSX = AddProbe(CSX, 'ut2', 10, 'ModeFunction',{func_Ex,func_Ey,0});
|
||||
CSX = AddBox(CSX, 'ut2', 0 ,start,stop);
|
||||
CSX = AddProbe(CSX,'it2', 11, 1, [], 'ModeFunction',{func_Hx,func_Hy,0});
|
||||
CSX = AddProbe(CSX,'it2', 11, 'ModeFunction',{func_Hx,func_Hy,0});
|
||||
CSX = AddBox(CSX,'it2', 0 ,start,stop);
|
||||
|
||||
port_dist = mesh.z(end-14) - mesh.z(15);
|
||||
|
|
|
@ -33,7 +33,6 @@ substrate.cells = 4;
|
|||
|
||||
%setup feeding
|
||||
feed.pos = -6; %feeding position in x-direction
|
||||
feed.width = 2; %feeding port width
|
||||
feed.R = 50; %feed resistance
|
||||
|
||||
% size of the simulation box
|
||||
|
@ -78,8 +77,8 @@ stop(3) =0;
|
|||
CSX = AddBox(CSX,'gnd',10,start,stop);
|
||||
|
||||
%% apply the excitation & resist as a current source
|
||||
start = [feed.pos-feed.width/2 -feed.width/2 0];
|
||||
stop = [feed.pos+feed.width/2 +feed.width/2 substrate.thickness];
|
||||
start = [feed.pos 0 0];
|
||||
stop = [feed.pos 0 substrate.thickness];
|
||||
[CSX port] = AddLumpedPort(CSX, 5 ,1 ,feed.R, start, stop, [0 0 1], true);
|
||||
|
||||
%% finalize the mesh
|
||||
|
|
|
@ -348,7 +348,7 @@ bool openEMS::SetupProcessing()
|
|||
stop[1] =bnd[3];
|
||||
stop[2] =bnd[5];
|
||||
CSPropProbeBox* pb = Probes.at(i)->ToProbeBox();
|
||||
Processing* proc = NULL;
|
||||
ProcessIntegral* proc = NULL;
|
||||
if (pb)
|
||||
{
|
||||
if (pb->GetProbeType()==0)
|
||||
|
@ -388,6 +388,7 @@ bool openEMS::SetupProcessing()
|
|||
}
|
||||
proc->SetProcessInterval(Nyquist/m_OverSampling);
|
||||
proc->AddFrequency(pb->GetFDSamples());
|
||||
proc->GetNormalDir(pb->GetNormalDir());
|
||||
if (l_MultiBox==false)
|
||||
proc->SetName(pb->GetName());
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue