
//  **************************************************************
//
// 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"
#include "param_pdi5025.h"

#define RUN_PARAM_FOLDER   				"s:\\magdata" 
#define COPY_PARAM_FOLDER  				"s:\\magdata"  
//#define ROUGH_TUNING    				0
//#define TUNING            			1
#define GAP_TUNING        				1 	// Gap tuning ON/OFF : ON for movable gap, OFF for fixed gap

// GPIB addresses 
#define GPIB_PDI5025_BOARD              0 	
#define GPIB_PDI5025_ADDR               14	

#define UFINT_DIST_BTWN_ENC_PULSE       0.0001

// Measurement parameters
#define INTEGRAL_TYPE               	I1Y_VS_X
#define INTEGRAL_ORDER					FIRST_INTEGRAL

// Measurement parameters
#define DESIRED_MEAS_TYPE               I1Y_VS_X 	// BL2_VS_Y //BL1_VS_X
#define SAMPLES_NUMBER                  1000  		// number of samples taken after both drifts and actual integral measurements
#define SAMPLING_RATE					120 		// 240 //Hz

//X axis scan settings
#define X_POS_INIT_OFFSET               0.0			// 0.010 // m  start offset set by moving both axes in group (no coil turn)
#define X_MEAS_CENTER_POS               0.0 		// 0.084822// position of the first measurement. One axis will move for second integral
#define MEAS_XINCREMENT                 1.0E-03 	// m  scan increment
#define MEAS_XLENGTH                    1.0E-03 	// m  scan length 
#define NUM_X_POS_VS_DIST               0 			// one direction, actual number of positions 
                                        			// will be =  2*NUM_X_POS_VS_DIST+1 = 3
//First integral modes
#define AXIS_X_MODE						MODE_1P2P 	// MODE_1P2P  MODE_1N2N 1st integral
#define AXIS_Y_MODE						MODE_1P2P 	// MODE_1N2N //MODE_1P2P 1st integral

//Second integral modes
#define AXIS_X2_MODE					MODE_1S2P 	// MODE_1P2S // Place to swap axes for second integral
#define AXIS_Y2_MODE					MODE_1S2P 	// MODE_1P2S // Place to swap axes for second integral


//Y axis scan settings
#define Y_POS_INIT_OFFSET               0.0 				// -0.065 // m  start offset set by moving both axes in group (no coil turn)
#define Y_MEAS_CENTER_POS               Y_POS_INIT_OFFSET 	// position of center of magnet. One axis will move for second integral
#define MEAS_YINCREMENT                 0.5E-03 //1.0E-03 			// m  scan increment
#define MEAS_YLENGTH                    1.0E-03 			// m  scan length
#define NUM_Y_POS_VS_DIST                0  	 			// one direction, actual number of positions 
	                                        				// will be =  2*NUM_Y_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 // -1 
#define INTEGRAL_Y_SIGN			 1 // -1  

//axes sign depends on motion controller settings and stages orientation, do not suppose to change integral signs
#define AXIS_X_SIGN				1 //-1
#define AXIS_Y_SIGN				1 //1  
#define UFINT_NTRIES			3 // 1 //Number of attemts to get read of bad measurement

//****************************** GAP SETTINGS *************************************************

#define GAP0	10.0
#define GAP1	10.0
#define GAP2	10.0
#define GAP3    10.0 
#define GAP4    13.0
#define GAP5    16.0
#define GAP6    22.0 
#define GAP7    12.0 
#define GAP8    13.0 
#define GAP9    14.0 
#define GAP10   15.0 
#define GAP11   16.0 
#define GAP12   17.0
#define GAP13   18.0
#define GAP14   19.0
#define GAP15   20.0
#define GAP16   21.0
#define GAP17   22.0

#define MAX_GAP_SETTINGS 29

#define GAP_NUMBER 3  


//*********************************************************************************************

#define NUM_WIRE_TURNS                  10    	// 120 	// coil settings
#define COIL_LENGTH                  	0.419 	// m   	//coil length   

#define EXTERNAL_AMP					2170.0  // 2170 for the pre-amp

#define NUM_MEAS_AVE                    1 		// 3 	// Number of repetitive measurements at given position

#define SMOOTH_PARAM                    11 		// smoothing parameter for raw data 

#define PD_SOURCE_LOCATION              "dstp://134.79.74.8/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                    1.0E-03 	// m  scan length 
#define F_NUM_X_POS_VS_DIST               2  		//	in one direction, actual number of positions 
                                        			//	will be =  2*NUM_X_POS_VS_DIST+1 = 3
                                        
#define F_MEAS_YINCREMENT                 1.0E-03 	// m  scan increment
#define F_MEAS_YLENGTH                    1.0E-03 	// m  scan length
#define F_NUM_Y_POS_VS_DIST               2  		// one direction, actual number of positions is 5

#define F_NUM_MEAS_AVE                    3 		// Number of repetitive measurements at given position
#define F_NUM_MEAS_AVE_GOOD_FIELD         3			// Number of repetitive measurements at given position
#define F_NUM_MEAS_AVE_ON_AXIS            5			// 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			  1.0 //0.9397 //
//ENTRY_SCALE ADJUSTMENT = (distance from pivot point to exit coil edge)/(distance from pivot point to exit coil handle)
#define EXIT_SCALE_ADJUSTMENT			  0.0 //0.0588 //

//**********************************************************************************************
// End protection 
#endif
