excitation: save & get some important frequencies

pull/1/head
Thorsten Liebig 2012-07-23 12:09:16 +02:00
parent cb912378dc
commit df083a63cc
3 changed files with 29 additions and 6 deletions

View File

@ -32,6 +32,8 @@ Excitation::Excitation()
dT = 0;
m_nyquistTS = 0;
m_f_max = 0;
m_foi = 0;
}
Excitation::~Excitation()
@ -51,6 +53,8 @@ void Excitation::Reset( double timestep )
dT = timestep;
m_nyquistTS = 0;
m_f_max = 0;
m_foi = 0;
}
bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS )
@ -146,6 +150,9 @@ void Excitation::CalcGaussianPulsExcitation(double f0, double fc, int nTS)
Signal_curr[n] = cos(2.0*PI*f0*(t-9.0/(2.0*PI*fc)))*exp(-1*pow(2.0*PI*fc*t/3.0-3,2));
}
m_foi = f0;
m_f_max = f0+fc;
SetNyquistNum( CalcNyquistNum(f0+fc,dT) );
}
@ -164,6 +171,9 @@ void Excitation::CalcDiracPulsExcitation()
Signal_curr[0]=0.0;
Signal_curr[1]=1.0;
m_foi = 0;
m_f_max = 0;
SetNyquistNum( 1 );
}
@ -181,6 +191,9 @@ void Excitation::CalcStepExcitation()
Signal_curr[0]=1.0;
Signal_curr[1]=1.0;
m_foi = 0;
m_f_max = 0;
SetNyquistNum( 1 );
}
@ -215,6 +228,8 @@ void Excitation::CalcCustomExcitation(double f0, int nTS, string signal)
Signal_curr[n] = fParse.Eval(vars);
}
m_f_max = f0;
m_foi = f0;
SetNyquistNum( CalcNyquistNum(f0,dT) );
}
@ -238,7 +253,8 @@ void Excitation::CalcSinusExcitation(double f0, int nTS)
t += 0.5*dT;
Signal_curr[n] = sin(2.0*PI*f0*t);
}
m_f_max = f0;
m_foi = f0;
SetNyquistNum( CalcNyquistNum(f0,dT) );
}

View File

@ -55,6 +55,12 @@ public:
//! Get the length of the excitation signal
unsigned int GetLength() const {return Length;}
//! Get the max frequeny excited by this signal
double GetMaxFrequency() const {return m_f_max;}
//! Get the frequency of interest
double GetFrequencyOfInterest() const {return m_foi;}
FDTD_FLOAT* GetVoltageSignal() const {return Signal_volt;}
FDTD_FLOAT* GetCurrentSignal() const {return Signal_curr;}
@ -68,6 +74,11 @@ protected:
FDTD_FLOAT* Signal_volt;
FDTD_FLOAT* Signal_curr;
// max frequency
double m_f_max;
// frequency of interest
double m_foi;
//! Calculate a custom signal
virtual void CalcCustomExcitation(double f0, int nTS, string signal);
//! Calculate an excitation with center of \a f0 and the half bandwidth \a fc

View File

@ -646,11 +646,7 @@ int openEMS::SetupFDTD(const char* file)
if (m_CSX->GetQtyPropertyType(CSProperties::LORENTZMATERIAL)>0)
FDTD_Op->AddExtension(new Operator_Ext_LorentzMaterial(FDTD_Op));
if (m_CSX->GetQtyPropertyType(CSProperties::CONDUCTINGSHEET)>0)
{
double f_max=0;
FDTD_Opts->QueryDoubleAttribute("f_max",&f_max);
FDTD_Op->AddExtension(new Operator_Ext_ConductingSheet(FDTD_Op,f_max));
}
FDTD_Op->AddExtension(new Operator_Ext_ConductingSheet(FDTD_Op,m_Exc->GetMaxFrequency()));
//check all properties to request material storage during operator creation...
SetupMaterialStorages();