/* ************************************************************* */ /* INCLUDE FILES */ #include #include #include #include #include #include "iaux.h" #include "iauxparam.h" #include "btwire.h" #include "btwireui.h" #include "btwireparam.h" /* ************************************************************* */ /* PRIVATE FUNCTIONS */ void btwireop_init(void); void btwireop_meas(void); void btwireop_exit(void); /* ************************************************************* */ int main(int argc, char *argv[]) { /* Declare variables */ long int num_samp = BTWIRE_MAX_NUM_SAMP; double t[BTWIRE_MAX_NUM_SAMP]; double v[BTWIRE_MAX_NUM_SAMP]; double v_smooth[BTWIRE_MAX_NUM_SAMP]; double dvdt[BTWIRE_MAX_NUM_SAMP]; long int i; /* Perform all initialization for the program */ btwireop_init(); /* Do a measurement */ //btwireop_meas(); /* Test the smoothing */ /* for (i = 0; i < num_samp; i++) { t[i] = (.0025 / num_samp) * i; v[i] = 0.; if (t[i] > .00025 && t[i] < .00035) v[i] += 1.; v[i] += .1 * rand() / RAND_MAX; } btwire_smooth_samp(num_samp, t, v, v_smooth); btwire_calc_dvdt_vs_t(num_samp, t, v_smooth, dvdt); */ /* Run the user interface */ RunUserInterface (); /* Exit all systems */ btwireop_exit(); /* Message */ printf("\nDone\n"); /* Done */ return 0; } /* ************************************************************** */ void btwireop_init(void) { /* Declare variables */ FILE* file_ptr; char log_file[80]; char dat_file[80]; char plt_file[80]; struct iaux_param_struct iaux_param; struct btwire_param_struct btwire_param; /* Initialize the log file */ strcpy(log_file, "logfile.ru1"); file_ptr = fopen (log_file, "w"); if (file_ptr == NULL) return; fclose(file_ptr); /* Initialize the dat file */ strcpy(dat_file, "datfile.ru1"); file_ptr = fopen (dat_file, "w"); if (file_ptr == NULL) return; fclose(file_ptr); /* Initialize the plt file */ strcpy(plt_file, "pltfile.ru1"); file_ptr = fopen (plt_file, "w"); if (file_ptr == NULL) return; fclose(file_ptr); /* Initialize the GPIB system */ /* But do it only if the hardware is present */ #ifndef DUMMY_DEVICES //board = ibfind("GPIB0"); //ibsic(board); #endif /* Get all system parameters */ iauxparam_fill_param_struct(&iaux_param); btwireparam_fill_param_struct(&btwire_param); /* Initialize the user interface */ btwireui_init(25, 25, btwire_param); btwireopui_init(25, 705); SetStdioWindowPosition(430, 25); SetStdioWindowSize(300, 830); /* Initialize all systems */ iaux_init(log_file, iaux_param); btwire_init(log_file, dat_file, plt_file, btwire_param); /* Done */ return; } /* ************************************************************* */ void btwireop_meas(void) { /* Declare all variables */ long int num_samp; double z[BTWIRE_MAX_NUM_SAMP]; double b_x[BTWIRE_MAX_NUM_SAMP]; double b_y[BTWIRE_MAX_NUM_SAMP]; /* Perform a measurement */ btwire_get_bt_vs_z('y', &num_samp, z, b_x, b_y); /* Done */ return; } /* ************************************************************** */ void btwireop_exit(void) { /* Exit all systems */ iaux_exit(); btwire_exit(); /* Done */ return; }