RF simulation routines


Files

file  bpm_rf.h
 libbpm rf simulation routines
file  rf_addLO.c
file  rf_amplify.c
file  rf_butterworthbandpass.c
file  rf_butterworthhighpass.c
file  rf_butterworthlowpass.c
file  rf_complexFFT.c
file  rf_filter.c
file  rf_mixer.c
file  rf_rectify.c
file  rf_setup.c

Functions

EXTERN int rf_setup (int nsamples, double sfreq)
EXTERN int rf_rectify (double **IF)
EXTERN int rf_filter (double **RF, enum rffiltertype_t filttype, int nfiltpar, double *pars)
EXTERN int rf_butterworthlowpass (double **RF, int order, double fc)
EXTERN int rf_butterworthbandpass (double **RF, int order, double f0, double BW)
EXTERN int rf_butterworthhighpass (double **RF, int order, double fc)
EXTERN int rf_complexFFT (double **in, double **out, int dir)
EXTERN int rf_addLO (double amp, double lofreq, enum bpmphase_t type, double phi0, double d_phi, double **LO)
EXTERN int rf_mixer (double *RF_Re, double *RF_Im, double **LO, double *IF)
EXTERN int rf_amplify (double *RF, double dB)

Variables

EXTERN int rf_nsamples
EXTERN double rf_samplefreq


Function Documentation

EXTERN int rf_setup ( int  nsamples,
double  sfreq 
)

Sets up the sampling of internal RF waveform representation

Parameters:
nsamples the number of samples
sfreq the internal sampling frequency
Returns:
BPM_SUCCESS

Definition at line 19 of file rf_setup.c.

References rf_nsamples, and rf_samplefreq.

EXTERN int rf_rectify ( double **  IF  ) 

Rectifies the given waveform

Parameters:
IF the complex waveform to rectify
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 16 of file rf_rectify.c.

References bpm_error(), and rf_nsamples.

Referenced by generate_diode().

EXTERN int rf_filter ( double **  RF,
enum rffiltertype_t  filttype,
int  nfiltpar,
double *  pars 
)

Applies the filter to the RF waveform

Parameters:
RF the waveform
filttype the filter type
nfiltpar the number of filter parameters
pars the array of filter parameters
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 18 of file rf_filter.c.

References bpm_error(), butterworth_band_pass, butterworth_high_pass, butterworth_low_pass, nofilter, rf_butterworthbandpass(), rf_butterworthhighpass(), and rf_butterworthlowpass().

Referenced by generate_diode().

EXTERN int rf_butterworthlowpass ( double **  RF,
int  order,
double  fc 
)

Apply a low pass Butterworth filter in frequency domain by taking the complex input waveform, and applying the frequency response

\[ \frac{1}{1 + \left( \frac{\nu}{\nu_c} \right)^{2n} } \]

Where $$ is the cut-off frequency and $n$ the filter order.

Parameters:
RF the waveform
order The order of the filter
fc Filter cutoff frequency in MHz
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 24 of file rf_butterworthlowpass.c.

References alloc_complex_wave_double(), bpm_error(), free_complex_wave_double(), NR_FFTBACKWARD, NR_FFTFORWARD, rf_complexFFT(), rf_nsamples, and rf_samplefreq.

Referenced by rf_butterworthbandpass(), and rf_filter().

EXTERN int rf_butterworthbandpass ( double **  RF,
int  order,
double  f0,
double  BW 
)

Apply a band pass Butterworth filter which is effectively a combination of a low and a high pass filters.

Parameters:
RF the waveform
order The order of the filter
f0 Central filter frequency in MHz
BW Bandwidth in MHz
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 21 of file rf_butterworthbandpass.c.

References bpm_error(), rf_butterworthhighpass(), and rf_butterworthlowpass().

Referenced by rf_filter().

EXTERN int rf_butterworthhighpass ( double **  RF,
int  order,
double  fc 
)

Apply a high pass Butterworth filter in frequency domain by taking the complex input waveform, and applying the frequency response

\[ \frac{1}{1 + \left( \frac{\nu_c}{\nu} \right)^{2n} } \]

Where $$ is the cut-off frequency and $n$ the filter order.

Parameters:
RF the waveform
order The order of the filter
fc Filter cutoff frequency in MHz
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 24 of file rf_butterworthhighpass.c.

References alloc_complex_wave_double(), bpm_error(), free_complex_wave_double(), NR_FFTBACKWARD, NR_FFTFORWARD, rf_complexFFT(), rf_nsamples, and rf_samplefreq.

Referenced by rf_butterworthbandpass(), and rf_filter().

EXTERN int rf_complexFFT ( double **  in,
double **  out,
int  dir 
)

Perform a complex FFT on the input waveform

Parameters:
in the input waveform
out the output FFT
dir forward or inverse?
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 19 of file rf_complexFFT.c.

References bpm_error(), nr_four1(), and rf_nsamples.

Referenced by rf_butterworthhighpass(), and rf_butterworthlowpass().

EXTERN int rf_addLO ( double  amp,
double  lofreq,
enum bpmphase_t  type,
double  phi0,
double  d_phi,
double **  LO 
)

Adds an LO signal to the waveform

Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 15 of file rf_addLO.c.

References bpm_error(), locked, nr_rangauss(), nr_ranuniform(), rf_nsamples, and rf_samplefreq.

EXTERN int rf_mixer ( double *  RF_Re,
double *  RF_Im,
double **  LO,
double *  IF 
)

Mixes the RF and the LO to produce the IF

Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 13 of file rf_mixer.c.

References bpm_error(), and rf_nsamples.

EXTERN int rf_amplify ( double *  RF,
double  dB 
)

Amplifies the signal by the level dB. The voltage gain is calculated:

gain = sqrt( 10^(db/20) )

Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 15 of file rf_amplify.c.

References bpm_error(), and rf_nsamples.


Variable Documentation

EXTERN int rf_nsamples

Numer of samples in the rf waveform representations, default value is 2^16 = 65536

Definition at line 43 of file bpm_rf.h.

Referenced by add_amplnoise(), add_wave(), add_waveforms(), digitise(), generate_diode(), generate_dipole(), generate_monopole(), get_amplitude(), get_complex_from_AmpPhi(), get_complex_from_ReIm(), get_imaginary_part(), get_phase(), get_real_part(), reset_complex_wave(), rf_addLO(), rf_amplify(), rf_butterworthhighpass(), rf_butterworthlowpass(), rf_complexFFT(), rf_mixer(), rf_rectify(), and rf_setup().

EXTERN double rf_samplefreq

Effective sampling frequency for the rf waveform representations, default value is 20 GHz

Definition at line 49 of file bpm_rf.h.

Referenced by add_excitation(), add_wave(), digitise(), rf_addLO(), rf_butterworthhighpass(), rf_butterworthlowpass(), and rf_setup().


Generated on Fri Nov 9 21:17:23 2007 for libbpm by  doxygen 1.5.1