//============================================================================== // // Title: Utilities.h // Purpose: A short description of the interface. // // Created on: 5/7/2014 at 10:29:17 AM by Arnaud Madur. // Copyright: LBNL. All Rights Reserved. // //============================================================================== #ifndef __Utilities_H__ #define __Utilities_H__ #ifdef __cplusplus extern "C" { #endif //============================================================================== // Include files #include #include #include "cvidef.h" //============================================================================== // Constants #define LINE 100 #define FILENAME 260 #define LINECYCLE 60 #define NAME 30 #define NTEMPS 6 //============================================================================== // Types //============================================================================== // External variables // Paramters char und_ID[LINE]; char und_type[LINE]; char HP_ID[LINE]; char und_dir[FILENAME]; char und_file[FILENAME]; char operator[NAME]; unsigned short int data_set; unsigned short int run_num; int operator_set; int tune_stage; int GPIBDVM[2]; // DVM GPIBs int hp3458_ID[2]; double DCV[2]; // DCV Scales double int_tm; // integration time in number of line cycles double trig_axis; double Sc_V; // scan velocity double x_scan, y_scan; // x and y probe locations for a scan - will use the same values for zero Gauss chamber reading double Sc_strt; // scan z starting point double Sc_stp; // scan z stopping point double HP_z[2]; // probe z locations for zero Gauss chambers double trig_spc; // trigger spacing double trig_axis; // trigger axis int num_pnts; // number of data points int num_pnts1; double Vx[7000]; double Vy[7000]; double Vx_o1; // Vx measured for zero-Gauss reading #1 double Vy_o1; // Vy measured for zero-Gauss reading #1 double Vx_o2; // Vx measured for zero-Gauss reading #2 double Vy_o2; // Vy measured for zero-Gauss reading #2 double Vx_offset; // Vx_o1 double Vy_offset; // Vy_o2; double Vx_increment; // Vx_o2 - Vx_o1; double Vy_increment; // Vy_02 - Vy_o1; double Vx_corr[7000]; double Vy_corr[7000]; double Bx[7000]; double By[7000]; double z[7000]; double Vx_ref[2]; // V for Bx reference double Vy_ref[2]; // V for By reference double Bx_ref[2]; // Bx reference measurements double By_ref[2]; // By reference measurements //char HP_name[100]; // name of Hall probe char HP_cal_file[FILENAME]; // name and path of Hall probe calibration file int ncalx, ncaly; // number of calibration data for Bx and By double Vx_cal0, Vy_cal0; // Zero offsets for Bx and By calibrations unsigned int *HP_cal_nx, *HP_cal_ny; // Polynomial powers double *HP_cal_px, *HP_cal_py; // Polynomial coefficients double RmTemp; double Temp[NTEMPS]; // Files for input and output FILE *fplg; FILE *fpda; FILE *fpm; // Panel Handles //============================================================================== // Global functions int RefMeas (int index); int LogRecord (char *IDname, FILE *fpl); int RdParamFile (char *fname); double GetTemp (int channel); int MoveProbe (double x, double y, double z); double HP_Calibrate (double Vp, unsigned int cal_n[], double cal_p[], unsigned int np); void RdCalFile (char *cal_file); int WriteDataFile(void); int LogZGauss (FILE *fpl, double Vx0, double Vy0); int ReadZGauss (FILE *fpl, double *Vx_ave, double *Vy_ave, double *Vx_rms, double *Vy_rms); #ifdef __cplusplus } #endif #endif /* ndef __Utilities_H__ */