/* ************************************************************* */ /* * BTWIRE.H * * Zachary Wolf * 4/9/02 */ #ifndef __BTWIRE_HEADER #define __BTWIRE_HEADER /* ************************************************************* */ /* PARAMETERS */ #define BTWIRE_MAX_NUM_CHAR 100 #define BTWIRE_MAX_NUM_SAMP 5000 #define BTWIRE_RECORD_LENGTH 5000 #define BTWIRE_NUM_AVE 10 #define BTWIRE_NUM_SAMP_IN_FIT_SMOOTH 50 #define BTWIRE_NUM_SAMP_IN_FIT_DERIV 25 #define BTWIRE_LENGTH_OF_CALIB_MAGNET_FOR_DVDT .025 #define BTWIRE_Z_RANGE_TO_FIND_CALIB_MAGNET .08 #define BTWIRE_TIME_CUTOFF_TO_REMOVE_CURRENT_PULSE 100.e-6 /* ************************************************************* */ /* ENUM DEFINITIONS */ enum btwire_config_enum {BTWIRE_TDS754D}; enum btwire_binary_enum {BTWIRE_TRUE, BTWIRE_FALSE}; /* ************************************************************* */ /* STRUCTURE DEFINITIONS */ struct btwire_calib_struct { double imag_calib_magnet; /* current in the calibration magnets (A) */ double bt_calib_magnet_bx1; /* transverse field in the calibration magnet calculated from imag (T) */ double bt_calib_magnet_bx2; /* transverse field in the calibration magnet calculated from imag (T) */ double bt_calib_magnet_by1; /* transverse field in the calibration magnet calculated from imag (T) */ double bt_calib_magnet_by2; /* transverse field in the calibration magnet calculated from imag (T) */ long int index_calib_magnet_bx1; /* location in the data arrays of the center of the magnet */ long int index_calib_magnet_bx2; /* location in the data arrays of the center of the magnet */ long int index_calib_magnet_by1; /* location in the data arrays of the center of the magnet */ long int index_calib_magnet_by2; /* location in the data arrays of the center of the magnet */ double dvdty_calib_magnet_bx1; /* dv/dt from the wire position sensor due to the calibration magnet (V/s) */ double dvdty_calib_magnet_bx2; /* dv/dt from the wire position sensor due to the calibration magnet (V/s) */ double dvdtx_calib_magnet_by1; /* dv/dt from the wire position sensor due to the calibration magnet (V/s) */ double dvdtx_calib_magnet_by2; /* dv/dt from the wire position sensor due to the calibration magnet (V/s) */ double bt_calib_factor_bx1_dvdty; /* Bt calibration factor for magnet bx1 B_x / dVdt_y (T/V/s) */ double bt_calib_factor_bx2_dvdty; /* Bt calibration factor for magnet bx2 B_x / dVdt_y (T/V/s) */ double bt_calib_factor_by1_dvdtx; /* Bt calibration factor for magnet by1 B_y / dVdt_x (T/V/s) */ double bt_calib_factor_by2_dvdtx; /* Bt calibration factor for magnet by2 B_y / dVdt_x (T/V/s) */ double zpos_calib_magnet_bx1; /* z position of the calibration magnet (m) */ double zpos_calib_magnet_bx2; /* z position of the calibration magnet (m) */ double zpos_calib_magnet_by1; /* z position of the calibration magnet (m) */ double zpos_calib_magnet_by2; /* z position of the calibration magnet (m) */ double t_calib_magnet_bx1; /* signal arrival time from the calibration magnet (s) */ double t_calib_magnet_bx2; /* signal arrival time from the calibration magnet (s) */ double t_calib_magnet_by1; /* signal arrival time from the calibration magnet (s) */ double t_calib_magnet_by2; /* signal arrival time from the calibration magnet (s) */ double z_calib_factor_bx1_bx2; /* calibration factor giving z from t from the Bx magnets (m/s) */ double z_calib_factor_by1_by2; /* calibration factor giving z from t from the By magnets (m/s) */ }; struct btwire_param_struct { int board_addr; /* GPIB board address */ int tds754d_addr; /* TDS754D GPIB address */ enum btwire_config_enum config; /* hardware being used, choices in enum */ int chan_x_wire_pos_sensor; /* channel number for the sensor giving the x position of the wire */ int chan_y_wire_pos_sensor; /* channel number for the sensor giving the y position of the wire */ int chan_wire_current_sensor; /* channel number for the sensor giving the current in the wire */ double scale_x_wire_pos_sensor; /* vertical scale factor for the sensor giving the x position of the wire (V/div) */ double scale_y_wire_pos_sensor; /* vertical scale factor for the sensor giving the y position of the wire (V/div) */ double scale_wire_current_sensor; /* vertical scale factor for the sensor giving the current in the wire (V/div) */ double scale_horizontal; /* horizontal scale factor (sec/div) */ double wire_current_sensor_v_per_a; /* wire current sensor response (V/A) */ double bx_per_a_calib_magnet_bx1; /* Bx #1 calibration magnet response (T/A) */ double bx_per_a_calib_magnet_bx2; /* Bx #2 calibration magnet response (T/A) */ double by_per_a_calib_magnet_by1; /* By #1 calibration magnet response (T/A) */ double by_per_a_calib_magnet_by2; /* By #2 calibration magnet response (T/A) */ double zpos_calib_magnet_bx1; /* z position of the first Bx calibration magnet (m) */ double zpos_calib_magnet_bx2; /* z position of the second Bx calibration magnet (m) */ double zpos_calib_magnet_by1; /* z position of the first By calibration magnet (m) */ double zpos_calib_magnet_by2; /* z position of the second By calibration magnet (m) */ double nominal_wave_speed; /* nominal speed of waves on the wire (m/s) */ enum btwire_binary_enum show_ui; /* show user interface if TRUE, don't show if FALSE */ }; /* ************************************************************* */ /* PUBLIC FUNCTION DECLARATIONS */ void btwire_init(char log_file_in[], char dat_file_in[], char plt_file_in[], struct btwire_param_struct btwire_param_in); void btwire_get_bt_vs_z(char record_results, long int* num_samp, double z[], double b_x[], double b_y[]); void btwire_get_v_vs_t(long int* num_samp, double t[], double v_w_x[], double v_w_y[]); void btwire_smooth_samp(long int num_samp, double t[], double y[], double y_smooth[]); void btwire_calc_dvdt_vs_t(long int num_samp, double t[], double v[], double dvdt[]); void btwire_remove_current_pulse(long int num_samp, double t[], double y[], double y_no_pulse[]); void btwire_get_calib(long int num_samp, double t[], double dvdt_w_x[], double dvdt_w_y[], struct btwire_calib_struct* btwire_calib); void btwire_calc_bt_vs_z(long int num_samp, double t[], double dvdt_w_x[], double dvdt_w_y[], struct btwire_calib_struct btwire_calib, double z[], double b_x[], double b_y[]); void btwire_dat_bt_vs_z(long int num_samp, double z[], double b_x[], double b_y[]); void btwire_dat_calib(struct btwire_calib_struct btwire_calib); void btwire_plt_bt_vs_z(long int num_samp, double z[], double b_x[], double b_y[]); void btwire_plt_all(long int num_samp, double t[], double v_w_x[], double v_w_y[], double v_fit_x[], double v_fit_y[], double dvdt_w_x[], double dvdt_w_y[], double z[], double b_x[], double b_y[]); void btwire_exit(void); /* ************************************************************** */ /* DONE */ #endif