#if !defined(_ENVIRON_H_20130320_)
#define _ENVIRON_H_20130320_

//About ENVIRONMENTAL::fsUser
	//S400.CX---------bsUser[8]----------Diode Or SelfNianXian
	//S400.CX---------bsUser[9]----------Hot -- PWM Flags
	//S400.CX---------fsUser[8]----------Hot -- Hotting Time
	//S400.CX---------fsUser[9]----------Hot -- Restore Temp

	//S300.CX---------bsUser[8]----------Internal Cap

	//S300.cx---------fsUser[0]----------Cap startup Time
	//S300.cx---------fsUser[1]----------Cap Value
	//S300.cx---------fsUser[2]----------Cap Pole1
	//S300.cx---------fsUser[3]----------Cap Pole2
	//S300.cx---------fsUser[4]----------Cap StopZero Time
	//S300.cx---------fsUser[5]----------LowBoot Running Time
	//S300.cx---------fsUser[6]----------Noise Running Time
	//S300.cx---------fsUser[7]----------Around Hardware Style


	//fs750.cx2-------bsUser[4]----------LoadFlags
	//fs750.cx2-------bsUser[5]----------Read Speed and Torque
	//fs750.cx2-------bsUser[6]----------Curve

	//fs730.cx--------bsUser[5]----------CCW

	//C800.CX---------fsUser[0]----------Sense Location
	//C800.CX---------fsUser[1]----------Rotor Radus

//2013-3-20
typedef struct _tagENVIRONMENTALEX
{
	//ARMATURE_TEST
	char  strModelName[24];
	char  strFile[24];

	int   nBar;
	int   nSkip;
	DWORD dwStyle;
	int   nMachineDot;
	int   nStyleEx;
#if defined(ARMATURE_TEST) && defined(ARMATURE_SUPPORT_WAVE_COIL)
	int   nCoilAngle;
	int   nWaveIn;
#endif
	DWORD dwCodePoint;
	DWORD dwCodeStart;
	DWORD dwCodeEnd;
	DWORD dwCodeLine;

	int   nYear;
	int   nMonth;
	int   nDay;

	//Hipot A-B
	float fHipotVol;
	float fHipotTime;
//	float fHipotCur[3][2];

	//Hipot A-C,  3P-2
	float fHipotVol2;
	float fHipotTime2;

	//Hipot B-C
	float fHipotVol3;
	float fHipotTime3;

#if defined(NEED_HIPOT_DC)
	float fHipotVol_DC;
	float fHipotTime_DC;

	float fHipotVol2_DC
	float fHipotTime2_DC

	//Hipot B-C
	float fHipotVol3_DC
	float fHipotTime3_DC
#endif




	//Insulation
	float fInsulationVol;
	float fInsulationTime;

	float fWeldRes;
	float fSurgePercent;

	float fSurgeVol;
	float fSurgeTime;

	int   nSurgeInternal;
	int   nBarInternal;
	float fSurgeSampleFreq;
	BOOL  bNormalization;
#if defined(MAX_YAMING_COUNT) || defined(MAX_YAMING_TRIGGER)  || defined(FS_610_CX)
	int   nYamingRange;
#endif
#if defined(NEED_YAMING_TRIGGER) || defined(FS_610_CX)
	float fSurgeSampleFreqEx;
	BOOL  bSurge2;
#endif

	int   nResistanceRange;
	int   nResistanceMethod;

#if defined(ARMATURE_TEST)
	float fsAutoConstI[4];

#endif
	//int   nInsulation;

	//BOOL  bsHipot[3];
	//BOOL  bInsulation;

	BOOL  bBar;
	BOOL  bWeld;
	BOOL  bSurge;
	BOOL  bElec;

    BOOL  bInductance;
    BOOL  bCapacitance;
    BOOL  bCapacitanceLeaking;

    BOOL  bAround;
	int   nBarExRange;
	int   nBarScale;

	//BOOL  bsSurge[MAX_ARMATURE_SUPPORT_COUNT];




	//STATOR
	float fStartupCapacitance;
	//int   nStatorStyle;
	//BOOL  bTStyle;
	//BOOL  bWStyle;

	//VBTION_710

	float fFreqScale;
	float fRunningTime;
	int   nDivide;
	int   nFreqResolution;
	int   nMotorStyle;
	int   nFilterStyle;
	int   nWindowStyle;
	float fsFilter[2];


	int   nFilterStyleEx;
	int   nWindowStyleEx;
	float fsFilterEx[2];

	BOOL  bAutoRange;
	int   nSpeedFromCurrent;
	int  nAmpRange;
	int  nStartAmpRange;


#if defined(FS_OTHER_CX2) || defined(ARMATURE_TEST) || defined(STATOR_400) || defined(FS_300_CX) || defined(FS_1500_CX) || defined(FS_1800_CX)// || defined(FS_550_CX)
	float fResistanceScale;
	float fResistanceDC;
	float fWeldResistanceScale;
	float fWeldResistanceDC;
#endif

#if defined(FS_1800_CX2) || defined(FS_550_CX2)//defined(FS_BLDC_LOAD_CX) || defined(FS_DC_LOAD_CX)
	int   nTorqueRange;
#endif

#if defined(NEED_ADD_ARC)
	int   nArcClass;
#endif

#if defined(FS_730C_CX) || defined(FS_610_CX)
    float fVoltage_Low;
    float fVoltage_Normal;
    float fVoltage_Startup;
#endif

#if defined(VBTIONFF_700) || defined(VBTIONFF_500)
	   BOOL  bManual_Low;
	    int   nTimes_Low;
	    int   nStartTime_Low;
    int   nEndTime_Low;
    float fBase_Low;
    int   nStep_Low;
    int   nRange_Low;

/*
	float fsAmp[2];
	float fsStartAmp[2];
	float fsVol[2];
	float fsSpeed[2];
	float fsVbtionA[2];
	float fsRes[2];
	float fsSound[2];
*/

	int   nCharacteristicIndex;
	float fCharacteristicValue;

	float fAmpModel;
	float  fStartupVolScale;
 #endif

#if defined(NEED_MODIFY_FUNC)
	float fsModify[MAX_TEST_ITEM_COUNT];
#endif


	#if defined(FS_730_CX) || defined(FS_730B_CX) || defined(FS_730C_CX)|| defined(FS_610_CX)
		int nAroundStyle;
	#endif

#if defined(FS_750_CX2) || defined(FS_750) || defined(FS_500) || defined(VBTIONFF_740)
	int   nStaffTestTimes;
	//float fsModify[MAX_TEST_ITEM_COUNT];
#elif defined(FS_1800_CX) || defined(FS_550_CX)
	//float fsModify[MAX_TEST_ITEM_COUNT];
#endif
	//NORMAL
	float fsTest[MAX_TEST_ITEM_COUNT][2];
	BOOL  bsTest[MAX_TEST_ITEM_COUNT];

#ifdef SURGE_TEST
	int  nFrameV;
	int  nFrameH;

	#if !defined(MAX_YAMING_COUNT)
		int   nYamingRange;
		float fSurgeSampleFreqEx;
		BOOL  bSurge2;
	#endif

#endif


#if defined(FS_730_CX) || defined(_WINDOWS)
         float fsCompensateVoltage[3];
         BOOL  bsCompensateVoltage[3];
#endif

#if defined(VBTIONFF_500) || defined(FS_780_CX)
	float fTorqueMax;
	float fTorqueAmp;
	int   nTorqueRange;
	int   nTorqueCrStyle;
	int   nTorqueModel;


#endif
	float fsUser[20];
	BOOL  bsUser[20];

#if defined(FS_900_CX)
	BOOL   bHipotAC;
	BOOL   bHipotDC;
	BOOL   bInsuDC;
	int    nsPole_AC_Hipot[MAX_FS900_COMBO][2];
	int    nsPole_DC_Hipot[MAX_FS900_COMBO][2];
	int    nsPole_DC_Insu[MAX_FS900_COMBO][2];

	float  fsVol_AC_Hipot[MAX_FS900_COMBO];
	float  fsVol_DC_Hipot[MAX_FS900_COMBO];
	float  fsVol_DC_Insu[MAX_FS900_COMBO];

#endif

#if defined(NEED_ADD_RESISTANCE_RELAY_DIFF)
	int    nsPole_Short[MAX_RESISTANCE_COUNT][2];//[2];
#endif

    #if defined(NEED_ADD_RESISTANCE_MODIFY)
		float  fsModify_Resistance[MAX_RESISTANCE_COUNT][2];
    #endif

#if defined(FS_610_CX)
	int    nsPole_Surge[MAX_RESISTANCE_COUNT][2];
#endif


#if defined(FS_OTHER_CX2) || defined(STATOR_400) || defined(FS_300_CX) || \
	defined(FS_1500_CX) || defined(FS_1800_CX) || defined(FS_550_CX) || \
	defined(FS_650_CX)
	float  fsSurgeVol_P[MAX_RESISTANCE_COUNT];
	int    nsColor[MAX_RESISTANCE_COUNT];
	BOOL   bsColor[MAX_RESISTANCE_COUNT];//[2];

	int    nsPole_Resis[MAX_RESISTANCE_COUNT][2];
	int    nsPole_Surge[MAX_RESISTANCE_COUNT][2];
	int    nsPole_Around[MAX_RESISTANCE_COUNT][2]; //Maigc Around
	#if defined(STATOR_400)
		int    nsPole_AroundEx[2]; //Motor Around
		int    nsPole_ShortEx[2];  //Motor Around Short
	#endif


	int    nsConnect[MAX_RESISTANCE_COUNT];//[2];
	int    nsPole_Noload[MAX_RESISTANCE_COUNT][2];

	#if defined(FS_300_CX)
		int    nsPole_Short[MAX_RESISTANCE_COUNT][2];//[2];
	#endif
	#if defined(NEED_ADD_WOCEN)
		float fsWocenVol[1 + 7];
	#endif
#else
	#if defined(SURGE_TEST) && !defined(FS_610_CX)
		float  fsSurgeVol_P[MAX_RESISTANCE_COUNT];
		int    nsPole_Surge[MAX_RESISTANCE_COUNT][2];
	#endif

#endif

    #if defined(NEED_ADD_INDUCTANCE) || defined(NEED_ADD_CAPACITANCE)
		//float  fMax038Freq;
	#endif

    #if defined(NEED_ADD_INDUCTANCE)
		float  fInductanceFreq;
		float  fInductanceTime;

		int    nsPole_Inductance[MAX_RESISTANCE_COUNT][2];//Motor Inductance
		float  fsModify_Inductance[MAX_RESISTANCE_COUNT][2];
    #endif



    #if defined(NEED_ADD_CAPACITANCE)
		float  fCapacitanceFreq;
		float  fCapacitanceTime;

		int    nsPole_Capacitance[MAX_RESISTANCE_COUNT][2];//Motor Inductance
		float  fsModify_Capacitance[MAX_RESISTANCE_COUNT][2];
    #endif

    #if defined(NEED_ADD_CAPACITANCE_LEAKING)
		float  fCapacitanceLeakingVol;
		float  fCapacitanceLeakingTime;

		//int    nsPole_CapacitanceLeaking[MAX_RESISTANCE_COUNT][2];//Motor Inductance
		float  fsModify_Capacitance_Leaking[MAX_RESISTANCE_COUNT][2];
    #endif



    BOOL bDiscard;

	DWORD   dwStaTimes; //2014-02-17

	#if defined(FS_721_CX) || defined(FS_722_CX) || defined(FS_680_CX)//Noise or Vration
		float fsSpectrum[30][3];
		int   nNoiseSense;
		int   nNoiseRange;
		int   nVbtionSense;
		int   nVbtionRange;
	#endif
	#if defined(NEED_ADD_GRAPH_AUTO)
		BOOL  bAutoFrameY;
		int   nsFrameX[2];
		int   nsFrameZ[2];
		float fsGraphLimit[2][2];
	#endif

#if defined(NEED_ADD_UNIT_CHANGE)
	BYTE bysUnit[MAX_TEST_ITEM_COUNT];
	double dbReservedUnit;
#endif


#if defined(NEED_ADD_DEFUSER)
	#include "DefUser.h"
#endif

#if defined(VBTIONFF_700) || defined(FS_750) || defined(FS_680_CX)
	DWORD dwSampleFreq1;
	DWORD dwSampleFreq2;
#endif


	int nsUser_Combo[8];
	int nsUser_Radio[8];
	int nsUser_Other[8];

}ENVIRONMENTAL;

typedef struct tagLOADTORQUEPAGE
{
	char  strCaption[32];
	float fTorque;
	DWORD dwSpeed;
	float fCurrent;
	DWORD dwDivide;
	float fMaxAD_Torque;

}LOADTORQUEPAGE, *LPLOADORQUEPAGE;


#endif
