/* ************************************************************* */ /* * BLHAR.H * * Zachary Wolf * 10/12/98 */ #ifndef __BLHAR_HEADER #define __BLHAR_HEADER /* ************************************************************* */ /* PARAMETERS */ #define BLHAR_MAX_NUM_HAR 50 #define BLHAR_MAX_NUM_MEAS 10 #define BLHAR_MAX_NUM_CHAR 100 /* ************************************************************* */ /* ENUM DEFINITIONS */ enum blhar_binary_enum {BLHAR_TRUE, BLHAR_FALSE}; /* ************************************************************* */ /* STRUCTURE DEFINITIONS */ struct coil_param_struct { char str_coil_type[BLHAR_MAX_NUM_CHAR + 1]; /* type of magnet this coil measures the strength of, ie. dipole, quad, sext, oct */ int str_coil_mux_chan; /* multiplexer channel for the strength coil */ double str_coil_constant; /* coil constant of the strength coil (Tm/Vs, T/Vs, T/m/Vs ... depending on the type */ double main_coil_radius; /* radius of the main winding (m) */ int main_coil_num_turns; /* number of turns on the main winding */ int main_coil_mux_chan; /* multiplexer channel for the main coil */ int bucked_coil_mux_chan; /* multiplexer channel for the bucked coil */ char coil_for_harmonics[BLHAR_MAX_NUM_CHAR + 1]; /* coil to use for the harmonics measurements, ie. main or bucked */ int num_sens_factors; /* number of coil sensitivity factors in arrays */ double main_coil_sens_factors[BLHAR_MAX_NUM_HAR + 1]; /* sensitivity factors for the main winding */ double bucked_coil_sens_factors[BLHAR_MAX_NUM_HAR + 1]; /* sensitivity factors for main + bucking windings */ }; struct blhar_param_struct { int num_har; /* number of harmonics to record in the output files */ int num_main_harmonic; /* number of the main harmonic */ int num_meas_ave; /* number of measurements for averaging */ char integ_chan; /* integrator channel receiving multiplexed signal */ int num_rev_per_meas; /* number of coil revolutions for a measurement */ double reference_radius; /* reference radius (m) */ struct coil_param_struct coil_param; /* measurement coil parameters */ char magnet_view[BLHAR_MAX_NUM_CHAR + 1]; /* magnet view for polarity figure in data file */ enum blhar_binary_enum show_ui; /* if TRUE, show user interface, don't show otherwise */ }; struct blhar_data_struct { double reference_radius; /* Radius all harmonics are measured at (m) */ double main_coil_radius; /* Radius of the main winding on the measurement coil (m) */ int num_main_harmonic; /* Number of the main harmonic */ int num_har; /* Number of harmonics in the arrays */ double BLn_norm_ave[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) at Rref, normal component, average (Tm) */ double BLn_norm_rms[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) at Rref, normal component, rms (Tm) */ double BLn_skew_ave[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) at Rref, skew component, average (Tm) */ double BLn_skew_rms[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) at Rref, skew component, rms (Tm) */ double BLn_mag_ave[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) at Rref, magnitude, average (Tm) */ double BLn_mag_rms[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) at Rref, magnitude, rms (Tm) */ double BLn_spang_ave[BLHAR_MAX_NUM_HAR + 1]; /* South pole angle, average (deg) */ double BLn_spang_rms[BLHAR_MAX_NUM_HAR + 1]; /* South pole angle, rms (deg) */ double BLn_ratio_ave[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) / BL(Nmain), average */ double BLn_ratio_rms[BLHAR_MAX_NUM_HAR + 1]; /* BL(n) / BL(Nmain), rms */ }; /* ************************************************************* */ /* PUBLIC FUNCTION DECLARATIONS */ void blhar_init(char log_file_in[], char str_dat_file_in[], char har_dat_file_in[], char str_plt_file_in[], char har_plt_file_in[], char mag_ctr_file_in[], struct blhar_param_struct blhar_param_in); void blhar_get_blhar_ave(struct blhar_data_struct* blhar_data); void blhar_calc_magnetic_center(struct blhar_data_struct blhar_data, double* x_ave, double* x_rms, double* y_ave, double* y_rms); void blhar_dat_blhar_ave(double magnet_current_ave, double magnet_current_rms, struct blhar_data_struct blhar_data, double x_ave, double x_rms, double y_ave, double y_rms); void blhar_dat_mag_ctr(double magnet_current_ave, double x_ave, double x_rms, double y_ave, double y_rms); void blhar_plt_blhar_ave(char* legend, struct blhar_data_struct blhar_data); void blhar_get_str_ave(int* num_str_har, double* sl_ave, double* sl_rms, double* th_ave, double* th_rms); void blhar_dat_str_ave(int num_str_har, double magnet_current_ave, double magnet_current_rms, double sl_ave, double sl_rms, double th_ave, double th_rms); void blhar_plt_str_ave(int num_str_har, double magnet_current_ave, double magnet_current_rms, double sl_ave, double sl_rms, double th_ave, double th_rms); /* ************************************************************** */ /* DONE */ #endif