Files | |
file | add_mode_response.c |
file | bpm_simulation.h |
libbpm waveform simulation routines | |
file | digitise.c |
file | generate_bpmsignal.c |
file | generate_diodesignal.c |
file | get_mode_amplitude.c |
file | get_mode_response.c |
file | set_temp.c |
file | set_time.c |
Defines | |
#define | K_SAMPLE |
#define | MODE_DECAY |
#define | MODE_MAX_SAMPLES |
Functions | |
EXTERN int | set_temp (double TK) |
EXTERN int | set_time (double ts) |
EXTERN int | generate_bpmsignal (bpmconf_t *bpm, bpmmode_t *mode, beamconf_t *beam, doublewf_t *rf) |
EXTERN int | add_mode_response (bpmconf_t *bpm, bpmmode_t *mode, bunchconf_t *bunch, doublewf_t *rf) |
EXTERN complex_t | get_mode_amplitude (bpmconf_t *bpm, bpmmode_t *mode, bunchconf_t *bunch) |
EXTERN doublewf_t * | generate_diodesignal (doublewf_t *rf, double sens, filter_t *filt, triggertype_t diode) |
EXTERN int | get_mode_response (bpmmode_t *mode) |
EXTERN int | digitise (doublewf_t *IF, int nbits, double range_min, double range_max, double clock_jitter, double digi_noise, unsigned int ipmode, intwf_t *wf) |
Variables | |
EXTERN double | ambient_temp |
EXTERN double | system_time |
#define K_SAMPLE |
Definition at line 48 of file bpm_simulation.h.
EXTERN int set_temp | ( | double | TK | ) |
Set ambient temperature
Sets up the ambient temperature
TK | ambient temperature in Kelvin |
Definition at line 17 of file set_temp.c.
References ambient_temp.
EXTERN int set_time | ( | double | ts | ) |
Set system time
Sets up the system clock
ts | current time in seconds |
Definition at line 17 of file set_time.c.
References system_time.
EXTERN int generate_bpmsignal | ( | bpmconf_t * | bpm, | |
bpmmode_t * | mode, | |||
beamconf_t * | beam, | |||
doublewf_t * | rf | |||
) |
Calculates the multi-mode response of a cavity BPM defined using bpminterface structures for a beam containing both one or multiple bunches.
bpm | a pointer to the structure defining the bpm | |
beam | a pointer to the structure defining the beam | |
rf | a pointer to were to store the generated waveform |
Definition at line 9 of file generate_bpmsignal.c.
References add_mode_response(), bunchconf::arrival_time, bpm_error(), bpmmode::buffer, beamconf::bunch, doublewf(), doublewf_getvalue(), doublewf_reset(), doublewf_t::fs, complexwf_t::fs, bpmmode::name, beamconf::nbunches, doublewf_t::ns, complexwf_t::ns, bpmmode::response, doublewf_t::wf, and WF_QUADRATIC.
EXTERN int add_mode_response | ( | bpmconf_t * | bpm, | |
bpmmode_t * | mode, | |||
bunchconf_t * | bunch, | |||
doublewf_t * | rf | |||
) |
Adds the response of a single mode generated by one bunch to the waveform rf, starting at the first sample
bpm | a pointer to the structure defining the bpm | |
mode | a pointer to the structure defining a cavity mode | |
bunch | a pointer to the structure defining the current bunch | |
rf | a pointer the waveform the response will be added to |
Definition at line 10 of file add_mode_response.c.
References bpm_error(), get_mode_amplitude(), complex_t::im, complexwf_t::ns, doublewf_t::ns, bpmmode::order, complex_t::re, bpmmode::response, complexwf_t::wf, and doublewf_t::wf.
Referenced by generate_bpmsignal().
EXTERN complex_t get_mode_amplitude | ( | bpmconf_t * | bpm, | |
bpmmode_t * | mode, | |||
bunchconf_t * | bunch | |||
) |
Returns the complex amplitude of the mode response. The imaginary part is only used when the incline or tilt signal is calculated which has a 90 deg phase offset.
bpm | a pointer to the structure defining the bpm | |
mode | a pointer to the structure defining a cavity mode | |
bunch | a pointer to the structure defining the current bunch |
Definition at line 9 of file get_mode_amplitude.c.
References bpm_warning(), bunchconf::bpmposition, bunchconf::bpmslope, bpmconf::cav_length, bunchconf::charge, bpmmode::frequency, horiz, complex_t::im, bunchconf::length, bpmmode::order, bpmmode::polarisation, complex_t::re, and bpmmode::sensitivity.
Referenced by add_mode_response().
EXTERN doublewf_t* generate_diodesignal | ( | doublewf_t * | rf, | |
double | sens, | |||
filter_t * | filt, | |||
triggertype_t | diode | |||
) |
Rectifies the rf waveform ( from the reference cavity ) to get a trigger pulse.
rf | input waveform | |
sens | diode sensitivity in mV/uW | |
filt | pointer to a filter to apply on the signal | |
diode | type of the diode (pos/neg/bipolar) | |
dc_out | rectified signal |
Definition at line 11 of file generate_diodesignal.c.
References apply_filter(), bipolar, bpm_error(), doublewf(), m33::e, doublewf_t::fs, negative, doublewf_t::ns, positive, and doublewf_t::wf.
EXTERN int get_mode_response | ( | bpmmode_t * | mode | ) |
Calculates the normalized complex mode response, the imaginary part is only used to store incline/tilt signals
mode | structure containing describing the mode and response buffer |
Definition at line 11 of file get_mode_response.c.
References apply_filter(), BANDPASS, bpm_error(), complexwf_reset(), complexwf_setimag(), complexwf_setreal(), create_filter(), delete_filter(), doublewf(), doublewf_delete(), doublewf_integrate(), doublewf_scale(), bpmmode::frequency, complexwf_t::fs, complexwf_t::ns, bpmmode::order, bpmmode::Q, RESONATOR, bpmmode::response, and doublewf_t::wf.
EXTERN int digitise | ( | doublewf_t * | IF, | |
int | nbits, | |||
double | range_min, | |||
double | range_max, | |||
double | clock_jitter, | |||
double | digi_noise, | |||
unsigned int | ipmode, | |||
intwf_t * | wf | |||
) |
Digitises the waveform using the sampling frequency and the number of samples set in the resulting waveform
IF | input waveform to digitse | |
nbits | bit resolution of the ADC | |
range_min | the minimum voltage and | |
range_max | the maximum voltage the ADC can process | |
clock_jitter | ADC clock jitter | |
digi_noise | rms digitiser noise in ADC channels | |
ipmode | interpolation mode for doublewf_getvalue() | |
wf | sampled waveform |
Definition at line 11 of file digitise.c.
References bpm_error(), doublewf_getvalue(), doublewf_t::fs, intwf_t::fs, intwf_add_ampnoise(), nr_rangauss(), doublewf_t::ns, intwf_t::ns, and intwf_t::wf.
EXTERN double ambient_temp |
EXTERN double system_time |