BPM signal simulation routines


Detailed Description


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_tgenerate_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 Documentation

#define K_SAMPLE

Definition at line 48 of file bpm_simulation.h.


Function Documentation

EXTERN int set_temp ( double  TK  ) 

Set ambient temperature

Sets up the ambient temperature

Parameters:
TK ambient temperature in Kelvin
Returns:
BPM_SUCCESS

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

Parameters:
ts current time in seconds
Returns:
BPM_SUCCESS

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.

Parameters:
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
Returns:
BPM_SUCCES upon succes, BPM_FAILURE upon failure

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

Parameters:
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
Returns:
BPM_SUCCES upon succes, BPM_FAILURE upon failure

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.

Parameters:
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
Returns:
BPM_SUCCES upon succes, BPM_FAILURE upon failure

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.

Parameters:
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
Returns:
a pointer to the generated rectified waveform

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

Parameters:
mode structure containing describing the mode and response buffer
Returns:
BPM_SUCCESS upon success or BPM_FAILURE upon failure

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

Parameters:
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
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

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.


Variable Documentation

EXTERN double ambient_temp

Ambient temperature in K

Definition at line 67 of file bpm_simulation.h.

Referenced by set_temp().

EXTERN double system_time

Current system time in s

Definition at line 77 of file bpm_simulation.h.

Referenced by set_time().


Generated on Wed Jun 25 17:32:49 2008 for libbpm by  doxygen 1.5.6