00001 /* 00002 libbpm - BPM signal processing/simulation library 00003 Copyright (C) 2006-07 Bino Maiheu (bino@hep.ucl.ac.uk) 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00032 #ifndef BPMSIM_H__ 00033 #define BPMSIM_H__ 00034 00035 /* ----------------------------------------------------------------------------- 00036 // includes 00037 // -------------------------------------------------------------------------- */ 00038 #include <math.h> 00039 #include <bpm/bpm_defs.h> 00040 #include <bpm/bpm_interface.h> 00041 #include <bpm/bpm_wf.h> 00042 #include <bpm/bpm_nr.h> 00043 #include <bpm/bpm_dsp.h> 00044 00045 /* ----------------------------------------------------------------------------- 00046 // macro definitions 00047 // -------------------------------------------------------------------------- */ 00048 #define K_SAMPLE 3.31 00049 #define MODE_DECAY 1e-2 00050 #define MODE_MAX_SAMPLES 131072 00051 //#define NMAX_MODES 5 00052 00053 /* ----------------------------------------------------------------------------- 00054 // typedefs, enums and other declarations 00055 // -------------------------------------------------------------------------- */ 00056 #ifdef __cplusplus 00057 extern "C" { 00058 #endif 00059 /* ----------------------------------------------------------------------------- 00060 // function prototypes and declarations 00061 // -------------------------------------------------------------------------- */ 00062 00063 00067 EXTERN double ambient_temp; 00068 00072 EXTERN int set_temp( double TK ); 00073 00077 EXTERN double system_time; 00078 00082 EXTERN int set_time( double ts ); 00083 00093 EXTERN int generate_bpmsignal( bpmconf_t *bpm, bpmmode_t *mode, beamconf_t *beam, doublewf_t *rf ); 00094 00104 EXTERN int add_mode_response( bpmconf_t *bpm, bpmmode_t *mode, bunchconf_t *bunch, doublewf_t *rf ); 00105 00115 EXTERN complex_t get_mode_amplitude( bpmconf_t *bpm, bpmmode_t *mode, 00116 bunchconf_t *bunch ); 00117 00128 EXTERN doublewf_t* generate_diodesignal( doublewf_t *rf, double sens, 00129 filter_t *filt, triggertype_t diode ); 00130 00137 EXTERN int get_mode_response( bpmmode_t *mode); 00138 00152 EXTERN int digitise( doublewf_t *IF, int nbits, 00153 double range_min, double range_max, 00154 double clock_jitter, double digi_noise, 00155 unsigned int ipmode, intwf_t *wf ); 00156 00157 #ifdef __cplusplus 00158 } 00159 #endif 00160 00161 #endif /* #ifndef BPMINTERFACE_H__ */ 00162 00163 /* ================================ end of file ============================= */