Files | |
file | add_amplnoise.c |
file | add_excitation.c |
file | add_wave.c |
file | bpm_simulation.h |
libbpm waveform simulation routines | |
file | digitise.c |
file | generate_diode.c |
file | generate_dipole.c |
file | generate_monopole.c |
file | generate_noise.c |
file | get_amplitude.c |
file | get_complex_from_AmpPhi.c |
file | get_complex_from_ReIm.c |
file | get_dipole_amp.c |
file | get_dipole_response.c |
file | get_imaginary_part.c |
file | get_monopole_amp.c |
file | get_monopole_response.c |
file | get_phase.c |
file | get_real_part.c |
file | reset_complex_wave.c |
file | reset_simple_wave.c |
file | simple_tone.c |
file | simple_wave.c |
Functions | |
EXTERN int | generate_monopole (bpmconf_t *, beamconf_t *, bpmsignal_t *) |
EXTERN int | generate_dipole (bpmconf_t *, beamconf_t *, bpmsignal_t *) |
EXTERN int | generate_diode (bpmconf_t *, beamconf_t *, bpmsignal_t *) |
EXTERN int | get_monopole_response (double bunchcharge, double chargesens, double arrivaltime, double cavityfreq, double *amp, double *phase) |
EXTERN int | get_dipole_response (double bunchcharge, double chargesens, double pos, double possens, double tilt, double tiltsens, double arrivaltime, double cavityfreq, double *amp, double *phase) |
EXTERN int | get_dipole_amp (double bunchcharge, double bunchlength, double pos, double possens, double slope, double slopesens, double tilt, double tiltsens, double *amp, double *phase) |
EXTERN int | get_monopole_amp (double bunchcharge, double bunchlength, double chargesens, double *amp, double *phase) |
EXTERN int | add_excitation (double ttrig, double *RF) |
EXTERN int | simple_wave (double amp, double phase, double ttrig, double freq, double tdecay, double ped, double ampnoise, double phasenoise, double fs, int nbits, int *wf, int ns) |
EXTERN int | simple_tone (double amp, double phase, double freq, double ped, double ampnoise, double phasenoise, double fs, int nbits, int *wf, int ns) |
EXTERN int | add_wave (double amp, double phase, double freq, double ttrig, double tdecay, double **RF) |
EXTERN int | add_waveforms (double *RF, double *RFadd, double factor) |
EXTERN int | reset_complex_wave (double **RF) |
EXTERN int | reset_simple_wave (int ns, double *wf) |
EXTERN int | get_real_part (double **RF, double *wf) |
EXTERN int | get_imaginary_part (double **RF, double *wf) |
EXTERN int | get_amplitude (double **RF, double *wf) |
EXTERN int | get_phase (double **RF, double *wf) |
EXTERN int | get_complex_from_ReIm (double *RF_Re, double *RF_Im, double **RF) |
EXTERN int | get_complex_from_AmpPhi (double *Amp, double *Phi, double **RF) |
EXTERN int | add_amplnoise (double amplnoise, double *IF_Re, double *IF_Im) |
EXTERN int | digitise (double *IF, int nbits, double fs, double range_min, double range_max, int ns, int *wf) |
EXTERN int generate_monopole | ( | bpmconf_t * | bpm, | |
beamconf_t * | beam, | |||
bpmsignal_t * | sig | |||
) |
Generate monopole waveform
Definition at line 13 of file generate_monopole.c.
References add_wave(), alloc_complex_wave_double(), alloc_simple_wave_double(), alloc_simple_wave_int(), beamconf::arrival_time, bpm_error(), bpmconf::cav_chargesens, bpmconf::cav_decaytime, bpmconf::cav_freq, beamconf::charge, bpmconf::digi_ampnoise, bpmconf::digi_nbits, bpmconf::digi_nsamples, bpmconf::digi_trigtimeoffset, free_complex_wave_double(), free_simple_wave_double(), get_monopole_response(), bpmsignal::ns, rf_nsamples, and bpmsignal::wf.
EXTERN int generate_dipole | ( | bpmconf_t * | bpm, | |
beamconf_t * | beam, | |||
bpmsignal_t * | sig | |||
) |
Generate dipole waveform
Definition at line 14 of file generate_dipole.c.
References add_wave(), alloc_complex_wave_double(), alloc_simple_wave_double(), alloc_simple_wave_int(), beamconf::arrival_time, bpm_error(), beamconf::bpmhit, beamconf::bpmtilt, bpmconf::cav_chargesens, bpmconf::cav_decaytime, bpmconf::cav_freq, bpmconf::cav_polarisation, bpmconf::cav_possens, bpmconf::cav_tiltsens, beamconf::charge, bpmconf::digi_ampnoise, bpmconf::digi_nbits, bpmconf::digi_nsamples, bpmconf::digi_trigtimeoffset, free_complex_wave_double(), free_simple_wave_double(), get_dipole_response(), horiz, bpmsignal::ns, rf_nsamples, and bpmsignal::wf.
EXTERN int generate_diode | ( | bpmconf_t * | bpm, | |
beamconf_t * | beam, | |||
bpmsignal_t * | sig | |||
) |
Generate a diode waveform using the given bpm parameters. Essentially, a reference waveform is generated and then rectified to produce the trigger pulse.
bpm | Structure containing the BPM info | |
beam | Structure containing the beam hit info | |
sig | Structure for where to place the digitised waveform |
Definition at line 21 of file generate_diode.c.
References add_wave(), alloc_complex_wave_double(), alloc_simple_wave_int(), beamconf::arrival_time, bpm_error(), bpmconf::cav_chargesens, bpmconf::cav_decaytime, bpmconf::cav_freq, beamconf::charge, bpmconf::digi_ampnoise, bpmconf::digi_nbits, bpmconf::digi_nsamples, bpmconf::digi_trigtimeoffset, free_complex_wave_double(), get_monopole_response(), bpmsignal::ns, rf_filter(), bpmconf::rf_filterpars, bpmconf::rf_filtertype, bpmconf::rf_nfiltpars, rf_nsamples, rf_rectify(), and bpmsignal::wf.
EXTERN int get_monopole_response | ( | double | bunchcharge, | |
double | chargesens, | |||
double | arrivaltime, | |||
double | cavityfreq, | |||
double * | amp, | |||
double * | phase | |||
) |
Calculate the response of a monopole signal given an incoming bunch
NOTE: Still have phase questions!
bunchcharge | The charge of the bunch (in nC) | |
chargesens | The charge sensitivty of the BPM | |
arrivaltime | The beam arrival time | |
cavityfreq | The frequency of the cavity | |
amp | the amplitude of the waveform at the arrival time | |
phase | the phase of the waveform at the arrival time |
Definition at line 20 of file get_monopole_response.c.
Referenced by generate_diode(), and generate_monopole().
EXTERN int get_dipole_response | ( | double | bunchcharge, | |
double | chargesens, | |||
double | pos, | |||
double | possens, | |||
double | tilt, | |||
double | tiltsens, | |||
double | arrivaltime, | |||
double | cavityfreq, | |||
double * | amp, | |||
double * | phase | |||
) |
Calculate the response of a dipole signal given an incoming bunch
NOTE: Still have phase questions! Alex**May need to include the bunch length**
bunchcharge | The charge of the bunch (in nC) | |
chargesens | The charge sensitivty of the BPM **Alex**remove this** | |
pos | The position of the beam (in um) | |
possens | The position sensitivty of the BPM **Alex**mV/nC/mm** | |
tilt | The tilt of the beam (in urad) | |
tiltsens | The tilt sensitivty of the BPM **Alex**mV/nC/mrad** | |
arrivaltime | The beam arrival time | |
cavityfreq | The frequency of the cavity | |
amp | the amplitude of the waveform at the arrival time | |
phase | the phase of the waveform at the arrival time |
Definition at line 25 of file get_dipole_response.c.
Referenced by generate_dipole().
EXTERN int get_dipole_amp | ( | double | bunchcharge, | |
double | bunchlength, | |||
double | pos, | |||
double | possens, | |||
double | slope, | |||
double | slopesens, | |||
double | tilt, | |||
double | tiltsens, | |||
double * | amp, | |||
double * | phase | |||
) |
Calculate the response of a dipole signal given an incoming bunch
bunchcharge | The charge of the bunch (in nC) | |
bunchlength | The length of the bunch (in mm) | |
pos | The position of the beam (in mm) | |
possens | The position sensitivty of the BPM (in V/nC/mm) | |
slope | The slope of the beam (in rad) | |
slopesens | The slope sensitivity of the BPM (in V/nC/urad) | |
tilt | The tilt of the bunch (in urad) | |
tiltsens | The tilt sensitivty of the BPM (V/nC/urad) | |
amp | the amplitude of the waveform at the arrival time | |
phase | the phase of the waveform at the arrival time |
Definition at line 23 of file get_dipole_amp.c.
EXTERN int get_monopole_amp | ( | double | bunchcharge, | |
double | bunchlength, | |||
double | chargesens, | |||
double * | amp, | |||
double * | phase | |||
) |
Calculate the response of a dipole signal given an incoming bunch
bunchcharge | The charge of the bunch (in nC) | |
bunchlength | The length of the bunch (in mm) | |
chargesens | The charge sensitivty of the BPM (V/nC) | |
amp | the amplitude of the waveform at the arrival time | |
phase | the phase of the waveform at the arrival time |
Definition at line 18 of file get_monopole_amp.c.
EXTERN int add_excitation | ( | double | ttrig, | |
double * | RF | |||
) |
Generates a step to excite the resonator
ttrig | the trigger time | |
RF | waveform |
Definition at line 19 of file add_excitation.c.
References bpm_error(), and rf_samplefreq.
EXTERN int simple_wave | ( | double | amp, | |
double | phase, | |||
double | ttrig, | |||
double | freq, | |||
double | tdecay, | |||
double | ped, | |||
double | ampnoise, | |||
double | phasenoise, | |||
double | fs, | |||
int | nbits, | |||
int * | wf, | |||
int | ns | |||
) |
Just fills an array of integers straight from the parameters given, this routine is a little tool to quickly generate digitised decaying waveforms without much RF hassle. The routine overwrites the wf array, so doesn't add the values...
The waveform shape is
with added phasenoise to the phase and amplitude noise to the offset. The user needs to give the nbits in the ADC as well to enable the routine to cut off the sample and have saturation...
amp | amplitude in ADC channels | |
phase | phase of waveform | |
ttrig | trigger time of waveform (t0) | |
freq | frequency of waveform | |
tdecay | decay time of waveform | |
ped | offset of waveform in ADC channels | |
ampnoise | amplitude noise in ADC channels | |
phasenoise | phase noise | |
fs | sampling frequency | |
nbits | number of bits in the ADC | |
*wf | the returned waveform | |
ns | the number of samples to fill |
Definition at line 39 of file simple_wave.c.
References bpm_error(), nr_rangauss(), and usec.
EXTERN int simple_tone | ( | double | amp, | |
double | phase, | |||
double | freq, | |||
double | ped, | |||
double | ampnoise, | |||
double | phasenoise, | |||
double | fs, | |||
int | nbits, | |||
int * | wf, | |||
int | ns | |||
) |
Just fills an array of integers straight from the parameters given, this routine is a little tool to quickly generate digitised tone signals without much RF hassle. The routine overwrites the wf array, so doesn't add the values...
The waveform shape is
with added phasenoise to the phase and amplitude noise to the offset. The user needs to give the nbits in the ADC as well to enable the routine to cut off the sample and have saturation...
amp | amplitude in ADC channels | |
phase | phase of the tone | |
freq | frequency of tone | |
ped | offset of tone in ADC channels | |
ampnoise | amplitude noise in ADC channels | |
phasenoise | phase noise | |
fs | sampling frequency | |
nbits | number of bits in the ADC | |
*wf | the returned waveform | |
ns | the number of samples to fill |
Definition at line 37 of file simple_tone.c.
References bpm_error(), nr_rangauss(), and usec.
EXTERN int add_wave | ( | double | amp, | |
double | phase, | |||
double | freq, | |||
double | ttrig, | |||
double | tdecay, | |||
double ** | RF | |||
) |
Builds up an RF waveform from the given amp, phase frequency and tdecay... uses the rf_ parameters which dictate the internal representation of the RF wave
Definition at line 15 of file add_wave.c.
References bpm_error(), rf_nsamples, and rf_samplefreq.
Referenced by generate_diode(), generate_dipole(), and generate_monopole().
EXTERN int add_waveforms | ( | double * | RF, | |
double * | RFadd, | |||
double | factor | |||
) |
EXTERN int reset_complex_wave | ( | double ** | RF | ) |
Resets the array elements of RF to 0+i0
Definition at line 12 of file reset_complex_wave.c.
References bpm_error(), and rf_nsamples.
EXTERN int reset_simple_wave | ( | int | ns, | |
double * | wf | |||
) |
Resets the array elements of RF to 0
Definition at line 12 of file reset_simple_wave.c.
References bpm_error().
EXTERN int get_real_part | ( | double ** | RF, | |
double * | wf | |||
) |
Returns the real part of the array elements
Definition at line 12 of file get_real_part.c.
References bpm_error(), and rf_nsamples.
EXTERN int get_imaginary_part | ( | double ** | RF, | |
double * | wf | |||
) |
Returns the real part of the array elements
Definition at line 12 of file get_imaginary_part.c.
References bpm_error(), and rf_nsamples.
EXTERN int get_amplitude | ( | double ** | RF, | |
double * | wf | |||
) |
Returns the amplitudes of the complex array
Definition at line 12 of file get_amplitude.c.
References bpm_error(), and rf_nsamples.
EXTERN int get_phase | ( | double ** | RF, | |
double * | wf | |||
) |
Returns the phases of the complex array
Definition at line 12 of file get_phase.c.
References bpm_error(), and rf_nsamples.
EXTERN int get_complex_from_ReIm | ( | double * | RF_Re, | |
double * | RF_Im, | |||
double ** | RF | |||
) |
Commbines real and imaginary parts into a complex array
Definition at line 12 of file get_complex_from_ReIm.c.
References bpm_error(), and rf_nsamples.
EXTERN int get_complex_from_AmpPhi | ( | double * | Amp, | |
double * | Phi, | |||
double ** | RF | |||
) |
Commbines amplitude and phase into a complex array
Definition at line 12 of file get_complex_from_AmpPhi.c.
References bpm_error(), and rf_nsamples.
EXTERN int add_amplnoise | ( | double | amplnoise, | |
double * | IF_Re, | |||
double * | IF_Im | |||
) |
Add the given amount of amplitude noise to the array
amplnoise | The amplitude noise to add to the waveform (in Volts) | |
IF_Re | The real part of the waveform | |
IF_Im | The imaginary part of the waveform |
Definition at line 20 of file add_amplnoise.c.
References bpm_error(), nr_rangauss(), nr_ranuniform(), and rf_nsamples.
EXTERN int digitise | ( | double * | IF, | |
int | nbits, | |||
double | fs, | |||
double | range_min, | |||
double | range_max, | |||
int | ns, | |||
int * | wf | |||
) |
Digitises the waveform
IF | The input waveofrm to digitse | |
nbits | The number of bits of the ADC | |
fs | the sampling frequency | |
range_min | the minimum voltage and | |
range_max | the maximum voltage the ADC can process | |
ns | number of samples in the sampled waveform | |
wf | sampled waveform |
Definition at line 23 of file digitise.c.
References bpm_error(), nr_rangauss(), rf_nsamples, and rf_samplefreq.