bpmsimulation/bpm_simulation.h

Go to the documentation of this file.
00001 
00013 #ifndef BPMSIM_H__
00014 #define BPMSIM_H__
00015 
00016 /* -----------------------------------------------------------------------------
00017 // includes
00018 // -------------------------------------------------------------------------- */
00019 #include <math.h>
00020 #include <bpm/bpm_defs.h>
00021 #include <bpm/bpm_interface.h>
00022 
00023 /* -----------------------------------------------------------------------------
00024 // macro definitions
00025 // -------------------------------------------------------------------------- */
00026 
00027 /* -----------------------------------------------------------------------------
00028 // typedefs, enums and other declarations
00029 // -------------------------------------------------------------------------- */
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 /* -----------------------------------------------------------------------------
00035 // function prototypes and declarations
00036 // -------------------------------------------------------------------------- */
00037 
00038   EXTERN int generate_monopole( bpmconf_t*, beamconf_t*, bpmsignal_t* );
00039 
00040   EXTERN int generate_dipole( bpmconf_t*, beamconf_t*, bpmsignal_t* );
00041 
00042   EXTERN int generate_diode( bpmconf_t*, beamconf_t*, bpmsignal_t* );
00043   
00044 
00045   EXTERN int get_monopole_response( double bunchcharge, double chargesens,
00046                                     double arrivaltime, double cavityfreq,
00047                                     double *amp, double *phase );
00048 
00049   EXTERN int get_dipole_response( double bunchcharge, double chargesens, 
00050                                   double pos, double possens, 
00051                                   double tilt, double tiltsens,
00052                                   double arrivaltime, double cavityfreq,
00053                                   double *amp, double *phase );
00054   /*
00055     so rougly same, but... pos/tilt rotation.. extra phase pickup ????,.... 
00056   */
00057 
00058   EXTERN int get_dipole_amp( double bunchcharge, double bunchlength,
00059                              double pos, double possens,
00060                              double slope, double slopesens,
00061                              double tilt, double tiltsens,
00062                              double *amp, double *phase );
00063   /*
00064     generates the complex amplitude of the dipole mode
00065   */
00066 
00067   EXTERN int get_monopole_amp( double bunchcharge, double bunchlength,
00068                              double chargesens,
00069                              double *amp, double *phase );
00070   /*
00071     generates the complex amplitude of the monopole mode
00072   */
00073 
00074   EXTERN int add_excitation( double ttrig, double *RF );
00075 
00082   EXTERN int simple_wave( double amp, double phase, double ttrig, double freq, double tdecay,
00083                           double ped, double ampnoise, double phasenoise,
00084                           double fs, int nbits, int *wf, int ns );
00085   EXTERN int simple_tone( double amp, double phase, double freq,
00086                           double ped, double ampnoise, double phasenoise,
00087                           double fs, int nbits, int *wf, int ns );
00088   /*
00089     makes a simple digitised waveform and tone without much RF hassle, just quick and dirty
00090   */
00091 
00092   EXTERN int add_wave( double amp, double phase, double freq, double ttrig, double tdecay,
00093                        double **RF );
00094   /*
00095     adds a wave to the complex wf array having the requred parameters, the wf representation
00096     will have rf_nsamples and rf_samplefreq as sampling freq internal to the software,
00097   */
00098 
00099   EXTERN int add_waveforms( double *RF, double *RFadd, double factor );
00100   /*
00101     adds complex waveform RFadd to complex waveform RF
00102   */
00103 
00104  
00105   EXTERN int reset_complex_wave( double **RF );
00106   /*
00107     resets a complex array
00108   */
00109 
00110   EXTERN int reset_simple_wave( int ns, double *wf );
00111   /*
00112     resets a double array
00113   */
00114 
00115   EXTERN int get_real_part( double **RF, double *wf );
00116   /*
00117     returns an array in wf containing the real part of RF
00118   */
00119 
00120   EXTERN int get_imaginary_part( double **RF, double *wf );
00121   /*
00122     returns an array in wf containing the imaginary part of RF
00123   */
00124  
00125   EXTERN int get_amplitude( double **RF, double *wf );
00126   /*
00127     returns an array in wf containing the amplitudes of RF
00128   */
00129 
00130   EXTERN int get_phase( double **RF, double *wf );
00131   /*
00132     returns an array in wf containing the phase of RF
00133   */
00134 
00135   EXTERN int get_complex_from_ReIm( double *RF_Re, double *RF_Im, double **RF );
00136   /*
00137     returns a complex array combined from the real and imaginary parts
00138   */
00139   EXTERN int get_complex_from_AmpPhi( double *Amp, double *Phi, double **RF );
00140   /*
00141     returns a complex array restored from the amplitude and phase
00142   */
00143 
00144 
00145   EXTERN int add_amplnoise( double amplnoise, double *IF_Re, double *IF_Im );
00146   /*
00147     add ampl noise to the IF waveform - noise given in volts
00148   */
00149 
00150 
00151   EXTERN int digitise( double *IF, int nbits, double fs, double range_min,
00152                        double range_max, int ns, int *wf );
00153   /*
00154     digitises the IF with the given nbits, sampling freq and number of samples, 
00155     returns *wf, takes care of saturation (as we have the nbits...)
00156   */
00157 
00158 
00159   /*
00160     generate diode just calls rf_rectify or so to generate a pulse
00161   */
00162   
00163 
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167 
00168 #endif /* #ifndef BPMINTERFACE_H__ */
00169 
00170 /* ================================ end of file ============================= */

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