
//************************************************************************************************************
// PARAM.H
// This file contains parameters required by the measurement
// program.
//
// Seva
// 12/14/99
//************************************************************************************************************
 
// Protection from multiple definitions 
#ifndef __PARAM_UFINT_HEADER
#define __PARAM_UFINT_HEADER

//#include "param_xps.h" //must be on a top of file to redefine xps setting

#define RUN_PARAM_FOLDER  "c:\\MagData"
#define COPY_PARAM_FOLDER "c:\\MagData"

//#define TUNING FINE_TUNING   //Kugler bench
#define TUNING ROUGH_TUNING 

#define UFINT_DIST_BTWN_ENC_PULSE       0.0001

// Measurement parameters
#define INTEGRAL_TYPE               	I1Y_VS_X
#define INTEGRAL_ORDER					FIRST_INTEGRAL
#define SAMPLES_NUMBER                  1000  //number of samples taken after both drifts and actual integral measurements
#define SAMPLING_RATE					240 //Hz

//X axis scan settings
#define X_POS_INIT_OFFSET               0 //0.019 // m  start offset set by moving both axes in group (no coil turn)
#define X_MEAS_CENTER_POS               0.019594//0.02 // center position of the current scan
#define MEAS_XINCREMENT                 1.0E-03 // m  scan increment
#define MEAS_XLENGTH                    0.5E-03 // m  scan length 
#define NUM_X_POS_VS_DIST               2 // //2 //6 //in one direction, actual number of positions 
                                        //will be =  2*NUM_X_POS_VS_DIST+1 = 3
//stages mode: Reversed historically.Our stages with encoder uses negative settings MODE_1N2N0, and stages with stepper motors
//are using positive modes(MODE_1P2P). History affects XPS motion functions, absolute and relative moves by change sign of 
//distance to move or absolute position. Does not harm. if new stage moves in a wrong direction and send error just change those
//parameters. 

//First integral modes
#define AXIS_X_MODE						MODE_1N2N //MODE_1P2P 1st integral
#define AXIS_Y_MODE						MODE_1P2P //MODE_1N2N //MODE_1P2P 1st integral

//Second integral modes
#define AXIS_X2_MODE					MODE_1S2N //MODE_1S2P //Place to swap axes for second integral
#define AXIS_Y2_MODE					MODE_1S2P //MODE_1S2P //Place to swap axes for second integral

//Y axis scan settings
#define Y_POS_INIT_OFFSET               0//-0.03// m  start offset set by moving both axes in group (no coil turn)
#define Y_MEAS_CENTER_POS               -0.024644 //Y_POS_INIT_OFFSET // position of center of magnet. One axis will move for second integral
#define MEAS_YINCREMENT                 0.1E-03 // m  scan increment
#define MEAS_YLENGTH                    0.5E-03 // m  scan length
#define NUM_Y_POS_VS_DIST               0 //6//one direction, actual number of positions 
                                        //will be =  2*NUM_$_POS_VS_DIST+1 = 3
//Place to change integral sign.Integral sign depends on  direction of the coil move, and coil connection.
//Set it to +1 or -1 by scaning known field (magnet) before doing actual measurements
#define INTEGRAL_X_SIGN			1
#define INTEGRAL_Y_SIGN			1

//axes sign depends on motion controller settings and stages orientation, do not suppouse to change integral signs
#define AXIS_X_SIGN				-1
#define AXIS_Y_SIGN				1  //////////
#define UFINT_NTRIES			3 //Number of attemts to get read of bad measurement



#define NUM_WIRE_TURNS                  620    //coil settings
#define COIL_LENGTH                  	1.219 //m    //coil length   
#define NUM_MEAS_AVE                    3 // Number of repetitive measurements at given position/		  

#define SMOOTH_PARAM                    11 // smoothing parameter for raw data 

#define PD_SOURCE_LOCATION              "dstp://134.79.80.57/labctrl"
#define INI_FILE     "c:\\cvi\\ufint\\param.ini" //default location at project folder

//******************************* FINAL SETTINGS ********************************************** 
//---------------------------------------------------------------------------------------------
#define F_MEAS_XINCREMENT                 1.0E-03 // m  scan increment
#define F_MEAS_XLENGTH                    0.5E-03 // m  scan length 
#define F_NUM_X_POS_VS_DIST               6  //in one direction, actual number of positions 
                                        //will be =  2*NUM_X_POS_VS_DIST+1 = 3
                                        
#define F_MEAS_YINCREMENT                 1.0E-03   //0.1E-03 //0.1E-03 // m  scan increment
#define F_MEAS_YLENGTH                    0.5E-03 // m  scan length
#define F_NUM_Y_POS_VS_DIST               2  //one direction, actual number of positions 2n+1
#define F_NUM_MEAS_AVE                    3 // Number of repetitive measurements at given position
//**********************************************************************************************
 //ENTRY_SCALE ADJUSTMENT = (distance from pivot point to entry coil edge)/(distance from pivot point to exit coil handle)
#define ENTRY_SCALE_ADJUSTMENT			   0.807
//ENTRY_SCALE ADJUSTMENT = (distance from pivot point to exit coil edge)/(distance from pivot point to exit coil handle)
#define EXIT_SCALE_ADJUSTMENT			   0.188


//**********************************************************************************************
// End protection 
#endif
