using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using GcDevicePc.Common;

namespace GcDevicePc.GCBuffer
{
    public struct stTemp
    {
        public ushort usCurTemp_Word1;
        public ushort usCurTemp_Word2;
    }

    [StructLayout(LayoutKind.Explicit, Size = 8)]
    public struct UNION_TEMP
    {
        [FieldOffset(0)]
        public float fCurTemp;

        [FieldOffset(0)]
        public stTemp t;
    }


    /// <summary>
    /// 辅助加热区
    /// </summary>
    public struct DevAux
    {
        public ushort u16AuxHeatArea1;		//辅助加热区1
        public bool fTemp_Enable1;          //加热器1升温开关
        public float fSetTemp_HeatArea1;	//加热器1温度设定值
        public float fActualTemp_HeatArea1; //加热器1温室实际值
        public ushort u16AuxHeatArea2;		//辅助加热区2
        public bool fTemp_Enable2;          //加热器2升温开关
        public float fSetTemp_HeatArea2;	//加热器2温度设定值
        public float fActualTemp_HeatArea2; //加热器2温室实际值
    }


    /// <summary>
    /// 色谱柱
    /// </summary>
    public struct DevChromato
    {
        public ushort sChromSelect;		        //选择的色谱柱
        public ushort u16ChromType;			    //色谱柱模式
        public float fHigestTempSet;		    //最高温度
        public float fLengthSet;			    //长度设置
        public float fCalSet;				    //口径设置
        public float fFilmThicknessSet;		    //膜厚设置
        public string sDescribe;				//描述
        public float fPreSetValue;		        //压力设定值
        public float fPreActualValue;	        //压力实际值
        public float fFlowSetValue;		        //流量设定值
        public float fFlowActualValue;	        //流量实际值
        public float fSetAverageLineSpeed;	    //平均线速度
        public float fActualAverageLineSpeed;	//实际线速度
    }

    /// <summary>
    /// 柱箱
    /// </summary>
    public struct DevCol
    {
        public ushort u16KeyCol;			//柱箱开关
        public ushort u16ColProNum;         //程升阶段数
        public float fColTempSet;			//柱箱设定温度
        public float fColTempActual;		//柱箱实际温度
        public float fHigestTemp;			//柱箱最高温度
        public float fBalanceTime;			//平衡时间
        public float fSumProgramTime;		//总程序时间
        public float fBehindRunTemp;		//程升结束之后的运行温度
        public float fBehindRunTime;		//后运行时间
        public ushort u16FastColdTrap;		//快速冷阱
        public ushort u16StartTarp_Type;    //启动冷阱（风扇）//  制冷剂
        public UNION_TEMP fCurTemp;			//实际温度
        public ushort uTcColStage;			//注箱进行程序升温的不同阶段
    }

    /// <summary>
    /// FID
    /// </summary>
    public struct DevFid
    {
        public string sFid;		            //Fid的位置
        public ushort u16SignalValve;	    //信号值
        public ushort u16KeyFire;	        //自动点火
        public ushort u16IsFire;            //是否已经点火
        public ushort u16Zero;		        //调零
        public ushort u16Sensitive;	        //灵敏度
        public ushort u16Polarity;	        //极性
        public ushort u16KeyHeater;		    //加热器开关
        public float fHeaterTempSet;        //加热器设定温度
        public float fHeaterActualTemp;     //加热器实际温度
        public ushort u16KeyH2Flow;		    //氢气流量开关
        public float fSetH2Flow;		    //氢气流量设定值
        public float fActualH2Flow;	        //氢气流量实际值
        public ushort u16KeyAirFlow;		//空气流量开关
        public float fAirFlowSet;			//空气流量设定值
        public float fAirFlowActual;		//空气流量实际值
        public ushort u16KeyTailGas;		//尾吹气开关
        public float fSetTailGas;			//尾吹气设定值
        public float fActualGasFlow;		//尾吹气实际
        public float fColumnFlowReference;  //柱流量参考值
        public ushort u16SigDeduct;		    //信号扣除

        //  ushort u16FilterDepth;		//滤波深度
    }

    /// <summary>
    /// TCD
    /// </summary>
    public struct DevTcd
    {
        public string sTcdLoc;		        //TCD位置
        public float fSigValve;	            //信号值
        public ushort u16Electric;	        //桥流
        public ushort u16Polarity;	        //极性
        public ushort u16AutoZeroSet;       //自动调零二R
        public float fHeaterTempSet;		//加热器设定值
        public float fHeaterTempActual;	    //加热器实际值
        public float fTaiGasSet;			//尾吹气设定值
        public float fTaiGasActual;		    //尾吹气实际值
        public float fColumnFlowReference;  //柱流量参考
        public ushort u16SigDeduct;		    //信号扣除
        public ushort u16KeyBridgeFlow;     //桥流开关
        public ushort u16FilterDepth;	    //滤波深度
        public ushort u16HeaterSel;	        //加热器
        public ushort u16TaiGasSel;	        //尾吹气
    };

    /// <summary>
    /// 进样口
    /// </summary>
    public struct DevPort
    {
        public string sInjPortLoc;	        //进样口位置
        public bool bHeater;			    //加热器
        public float fHeaterSetTemp;	    //加热器设定温度值
        public float fHeaterSetTempm;	    //加热器modbus设定温度值
        public float fHeaterTempActual;     //加热器实际温度值
        public float fSetPre;			    //设定压力
        public float fPreActual;		    //实际压力
        public float fSetSumFlow;		    //总流量设定值
        public float fSumFlowActual;	    //总流量实际值
        public float fSetPurgeFlow;	        //隔垫吹扫流量设定值
        public float fPurgeFlowActual;	    //隔垫吹扫流量实际值
        public float fSetColumnFlow;	    //柱流量设定值
        public float fColumnFlowActual;	    //柱流量实际值
        public string sWeatherShuntModel;   //分流不分流模式
        public ushort u16SplitRatio;		//分流比
        public float fSplitFlow;			//分流流量
        public float fCarrierGas1;			//分流流量
        public float fCarrierGas2;			//分流流量
        public float fCarrierGas3;			//分流流量
        public bool bCarrierGasSave;	    //载气节省开启
        public ushort u16CarrierGasSave;	//载气节省20ml/min
        public float fSaveGasTime;          //开始等待时间


        public string SamplePortType;                //进样口类型
        public float Protecttemp;                    //保护温度
        public ushort ControlMode;                   //控制方式
        public ushort CarrierGasType;                //载气类型
        public float splCarrierGasPressure;             //载气入口压力
        public ushort Heater;                        //加热器
        public float HeaterTmpSet;                   //加热器设定温度
        public float HeaterTmpActual;                //加热器实际温度
        public float splTotalFlowSet;                   //总流量设定值
        public float splTotalFlowActual;                //总流量实际值
        public ushort splPrecolumnPressure;             //柱前压
        public float splPrecolumnPressureSet;           //柱前压设定值
        public float splPrecolumnPressureActual;        //柱前压实际值
        public ushort splColumnFlow;                    //柱流量
        public float splColumnFlowSet;                  //柱流量设定值
        public float splColumnFlowActual;               //柱流量实际值
        public ushort splBlowFlow;                      //吹扫流量
        public float splBlowFlowSet;                    //吹扫流量设定值
        public float splBlowFlowActual;                 //吹扫流量实际值
        public ushort splShuntMode;                     //分流模式
        public float splShuntRatio;                     //分流比
        public float splShuntFlow;                      //分流流量
        public ushort splSaveEPC;                       //载气节省EPC
        public float splSaveAmount;                     //载气节省量
        public float pipFlowSet;                   //流量设定值
        public float pipFlowActual;                 //流量实际值
        public float pipPressureSet;                //压力设定值
        public float pipPressureActual;             //压力实际值
        public ushort pipSeptumBlowFlow;         //隔垫吹扫流量
        public float pipSeptumBlowFlowSet;       //隔垫吹扫流量设定值
        public float pipSeptumBlowFlowActual;    //隔垫吹扫流量实际值
    }

    /// <summary>
    /// epc
    /// </summary>
    public struct Epc
    {
        public float fristFlow;
        public ushort gasType1;
        public float SecondFlow;
        public ushort gasType2;
        public float ThirdFlow;
        public ushort gasType3;
    }

    //public struct DevPort
    //{
    //    public string sInjPortLoc;	        //进样口位置
    //    public bool bHeater;			    //加热器
    //    public float fHeaterSetTemp;	    //加热器设定温度值
    //    public float fHeaterSetTempm;	    //加热器modbus设定温度值
    //    public float fHeaterTempActual;     //加热器实际温度值
    //    public float fSetPre;			    //设定压力
    //    public float fPreActual;		    //实际压力
    //    public float fSetSumFlow;		    //总流量设定值
    //    public float fSumFlowActual;	    //总流量实际值
    //    public float fSetPurgeFlow;	        //隔垫吹扫流量设定值
    //    public float fPurgeFlowActual;	    //隔垫吹扫流量实际值
    //    public float fSetColumnFlow;	    //柱流量设定值
    //    public float fColumnFlowActual;	    //柱流量实际值
    //    public string sWeatherShuntModel;   //分流不分流模式
    //    public ushort u16SplitRatio;		//分流比
    //    public float fSplitFlow;			//分流流量
    //    public bool bCarrierGasSave;	    //载气节省开启
    //    public ushort u16CarrierGasSave;	//载气节省20ml/min
    //    public float fSaveGasTime;			//开始等待时间
    //}

    /// <summary>
    /// 进样器
    /// </summary>
    public struct DevInj
    {
        public string sSample;			    //配备的进样器
        public float fSampleQuantity;	    //进样量
        public float fInjectorSize;		    //注射器尺寸
        public string sFrontSample;		    //进样前样品
        public string sBSSolventA;		    //进样前溶剂A
        public string sBSSolventB;		    //进样前溶剂B
        public string sASSolventA;		    //进样后溶剂A
        public string sASSolventB;		    //进样后溶剂B
        public ushort u16PushPullTimes;		//推拉针芯次数
        //其他参数
       // UNION_TEMP fCurTemp;			    //进样室当前温度
        public float fSetTemp;			    //进样室设定温度
    }

    /// <summary>
    /// 阀
    /// </summary>
    public struct DevValve
    {
        public bool bValveKey;            //是否有阀存在
        public bool bHeaterKey;           //是否有加热器
        public float fSetTemp;            //设定值
        public float fActualTemp;         //当前值
        public ushort u16ValveSetTime1;
        public ushort u16ValveSetTime2;
        public ushort u16ValveSetTime3;
        public ushort u16ValveSetTime4;
        public ushort u16ValveSetTime5;
        public ushort u16ValveSetTime6;
        public ushort u16ValveSetTime7;
        public ushort u16ValveSetTime8;
        public char ValveStatus;
    }

    public struct DevSignal
    {
        public ushort u16ChannelA; 	//A通道开关  0-关  1-开
        public ushort u16ChannelB; 	//B通道开关
        public ushort[] uDetA;	//A通道检测器
        public ushort[] uDetB;	//B通道检测器
        public ushort[] u16DetTimeLengthA;	//A/B第一时间段的检测时间
        public ushort[] u16DetTimeLengthB;	//A/B第二时间段的检测时间
        public ushort[] u16ZeroA;				//A/B第一时间段归零操作
        public ushort[] u16ZeroB;				//A/B第二时间段归零操作
        public ushort[] u16SaveA;				//A/B第一时间段保存操作
        public ushort[] u16SaveB;				//A/B第二时间段保存操作
       
    }

    public class GCMethodConfig
    {
        string[] sStage = new string[5];

        public const int MAX_VALVE_NUM = 6;  //阀数目
        public const int MAX_CHROMATO_NUM = 2;  //阀数目
        public const int MAX_CHANNEL_NUM = 8;
        public const int MAX_SAMPLE_NUM = 2;  //进样器
        public const int MAX_PORT_NUM = 2;    //进样口
        public const int MAX_FID_NUM = 3;   //FID
        public const int MAX_TCD_NUM = 3;   //TCD
        public const int MAX_Detector_NUM = 3;   //检测器
        public const int MAX_EPC_NUM = 2;   //EPC

        public DevAux aux = new DevAux();
        public DevChromato[] chrom = new DevChromato[MAX_CHROMATO_NUM];
        public DevCol col = new DevCol();
        public DevFid[] fid = new DevFid[MAX_FID_NUM];
        public DevTcd[] tcd = new DevTcd[MAX_TCD_NUM];
        public DevPort[] port = new DevPort[MAX_PORT_NUM];
        public DevValve[] valve = new DevValve[MAX_VALVE_NUM];
        public DevSignal signal = new DevSignal();
        public DevInj[] sample = new DevInj[MAX_SAMPLE_NUM];
        public DevDetector[] detector = new DevDetector[MAX_Detector_NUM];
        public IPVal[] val = new IPVal[MAX_CHROMATO_NUM];

        public DevPort[] auxs = new DevPort[MAX_PORT_NUM];

        public Epc[] epc = new Epc[MAX_EPC_NUM];





        FileHelper methodconfigini;
        FileHelper savemethodconfig;

        public string savefilename = "";
        public string saveasfilename = "";

        public GCMethodConfig()
        {
            InitMethodConfig();

            sStage[0] = "Init";
            sStage[1] = "1st";
            sStage[2] = "2nd";
            sStage[3] = "3rd";

        }

        /// <summary>
        /// 初始化辅助加热器
        /// </summary>
        private void InitDevAux()
        {
            aux.u16AuxHeatArea1 = 0;
            aux.fTemp_Enable1 = false;
            aux.fSetTemp_HeatArea1=0.0f;
            aux.fActualTemp_HeatArea1 =0.0f;
            aux.u16AuxHeatArea2 =0;
            aux.fTemp_Enable2 = false;
            aux.fSetTemp_HeatArea2 = 0.0f;
            aux.fActualTemp_HeatArea2 = 0.0f;
        }

        /// <summary>
        ///  色谱柱
        /// </summary>
        private void InitDevChrom()
        {
            int i;

            for (i = 0; i < MAX_CHROMATO_NUM; i++ )
            {
                chrom[i].sChromSelect = 0;
                chrom[i].u16ChromType = 0;
                chrom[i].fHigestTempSet = 0.0f;
                chrom[i].fLengthSet = 0.0f;
                chrom[i].fCalSet = 0.0f;
                chrom[i].fFilmThicknessSet = 0.0f;
                chrom[i].sDescribe = "色谱柱";
                chrom[i].fPreSetValue = 0.0f;
                chrom[i].fPreActualValue = 0.0f;
                chrom[i].fFlowSetValue = 0.0f;
                chrom[i].fFlowActualValue = 0.0f;
                chrom[i].fSetAverageLineSpeed = 0.0f;
                chrom[i].fActualAverageLineSpeed = 0.0f;
            }
        }

        /// <summary>
        /// 柱箱
        /// </summary>
        private void InitDevCol()
        {
            col.u16KeyCol = 0; ;			//柱箱开关
            col.u16ColProNum = 0; ;         //程升阶段数
            col.fColTempSet = 0.0f;			//柱箱设定温度
            col.fColTempActual = 0.0f;		//柱箱实际温度
            col.fHigestTemp = 280.0f;			//柱箱最高温度
            col.fBalanceTime = 0.0f;		//平衡时间
            col.fSumProgramTime = 0.0f;		//总程序时间
            col.fBehindRunTemp = 0.0f;		//程升结束之后的运行温度
            col.fBehindRunTime = 0.0f;		//后运行时间
            col.u16FastColdTrap = 0;		//快速冷阱
            col.u16StartTarp_Type = 0;      //启动冷阱（风扇）//  制冷剂
            col.uTcColStage = 0;			//注箱进行程序升温的不同阶段
        }

        /// <summary>
        /// FID
        /// </summary>
        private void InitDevFid()
        {

            for(int i = 0; i < 3; i++)
            {
                switch (i)
                {
                    case 0:
                        fid[i].sFid = "前";		//Fid的位置
                        break;
                    case 1:
                        fid[i].sFid = "中";		//Fid的位置
                        break;
                    case 2:
                        fid[i].sFid = "后";		//Fid的位置
                        break;
                    default:
                        fid[i].sFid = "前";		//Fid的位置
                        break;
                }
                fid[i].u16SignalValve =0;	//信号值
                fid[i].u16KeyFire = 0;	//自动点火
                fid[i].u16IsFire = 0;    //是否已经点火
                fid[i].u16Zero = 0; ;		//调零
                fid[i].u16Sensitive = 0;	//灵敏度
                fid[i].u16Polarity = 0;	//极性
                fid[i].u16KeyHeater = 0;		//加热器开关
                fid[i].fHeaterTempSet =0.0f;  //加热器设定温度
                fid[i].fHeaterActualTemp = 0.0f;//加热器实际温度
                fid[i].u16KeyH2Flow = 0;		//氢气流量开关
                fid[i].fSetH2Flow = 0.0f;		//氢气流量设定值
                fid[i].fActualH2Flow = 0.0f;	//氢气流量实际值
                fid[i].u16KeyAirFlow = 0;		//空气流量开关
                fid[i].fAirFlowSet = 0.0f;			//空气流量设定值
                fid[i].fAirFlowActual = 0.0f;		//空气流量实际值
                fid[i].u16KeyTailGas = 0;			//尾吹气开关
                fid[i].fSetTailGas = 0.0f;			//尾吹气设定值
                fid[i].fActualGasFlow = 0.0f;		//尾吹气实际
                fid[i].fColumnFlowReference = 0.0f;//柱流量参考值
                fid[i].u16SigDeduct = 0;		//信号扣除
            }
        }

        /// <summary>
        /// TCD
        /// </summary>
        private void InitDevTcd()
        {
            for(int i =0; i < 3; i++)
            {
                switch (i)
                {
                    case 0:
                        tcd[i].sTcdLoc = "前";
                        break;
                    case 1:
                        tcd[i].sTcdLoc = "中";		//Fid的位置
                        break;
                    case 2:
                        tcd[i].sTcdLoc = "后";		//Fid的位置
                        break;
                    default:
                        tcd[i].sTcdLoc = "前";		//Fid的位置
                        break;
                }

                tcd[i].fSigValve = 0.0f;	         //信号值
                tcd[i].u16Electric = 0;	     //桥流
                tcd[i].u16Polarity = 0;	     //极性
                tcd[i].u16AutoZeroSet = 0;      //自动调零
                tcd[i].fHeaterTempSet = 0.0f;		 //加热器设定值
                tcd[i].fHeaterTempActual = 0.0f;	 //加热器实际值
                tcd[i].fTaiGasSet = 0.0f;			 //尾吹气设定值
                tcd[i].fTaiGasActual = 0.0f;		 //尾吹气实际值
                tcd[i].fColumnFlowReference = 0.0f; //柱流量参考
                tcd[i].u16SigDeduct = 0;		 //信号扣除
                tcd[i].u16KeyBridgeFlow = 0;    //桥流开关
                tcd[i].u16FilterDepth = 0;	     //滤波深度
                tcd[i].u16HeaterSel = 0;	     //加热器
                tcd[i].u16TaiGasSel = 0;	     //尾吹气
            }
        }


        /// <summary>
        /// 检测器
        /// </summary>
        public struct DevDetector
        {
            public ushort epcType;              //检测器类型

            public ushort epcHeater;            //加热器开关
            public float epcHeaterTmpSet;       //加热器设定温度
            public float epcHeaterTmpActual;    //加热器实际温度

            public ushort epcfHFlow;             //氢气流量开关
            public float epcfHFlowSet;           //氢气流量设定值
            public float epcfHFlowActual;        //氢气流量实际值

            public ushort epcfAirFlow;           //空气流量开关
            public float epcfAirFlowSet;         //空气流量设定值
            public float epcfAirFlowActual;      //空气流量实际值

            public ushort epcfTGFR;              //尾吹气开关
            public float epcfTGFRSet;            //尾吹气设定值
            public float epcfTGFRActual;         //尾吹气实际值

            public ushort epcfFlame;             //火焰
            public float epcfFlameSet;           //火焰设定值
            public float epcfFlameActual;        //火焰实际值

            public ushort epcPolarity;          //极性
            public ushort epcPolaritySet;       //极性设定
            public ushort epcPolarityActual;    //极性实际
                                                /// /////////////////////////////////////////////////////////////////////////

            public ushort epctRGFR;                          //参比气流量开关
            public float epctRGFRSet;                        //参比气流量设定值
            public float epctRGFRActual;                     //参比气流量实际值

            public ushort epctAutoBridgeCurrent;             //桥电流自动开关
            public ushort epctAutoBridgeCurrentSet;          //桥电流自动开关设定
            public ushort epctAutoBridgeCurrentActual;       //桥电流自动开关实际

            public ushort epctBridgeCurrent;                 //桥电流
            public float epctBridgeCurrentSet;               //桥电流设定值
            public float epctBridgeCurrentActual;            //桥电流实际值

            public ushort epctElectricSignal;                //电信号开关
            public float epctElectricSignalSet;              //电信号设定值
            public float epctElectricSignalActual;           //电信号实际值
        }


        /// <summary>
        /// IPVAL
        /// </summary>
        public struct IPVal
        {
            public string valSamplePortType;        //进样口类型
            public float valProtecttemp;            //保护温度
            public ushort valControlMode;           //控制方式
            public ushort valCarrierGasType;        //载气类型

            public ushort valCG1;                   //载气开关1
            public float valCG1Set;                 //载气开关1时间设定值
            public float valCG1Actual;              //载气开关1时间实际值
            public float valCG1BlowFlow;            //载气开关1吹扫流量值
            public float valCG1UpFlowStartTime;     //载气开关1程序升流开始时间
            public float valCG1UpFlowEndTime;       //载气开关1程序升流结束时间

            public ushort valCG2;                   //载气开关2
            public float valCG2Set;                 //载气开关2时间设定值
            public float valCG2Actual;              //载气开关2时间实际值
            public float valCG2BlowFlow;            //载气开关2吹扫流量值
            public float valCG2UpFlowStartTime;     //载气开关2程序升流开始时间
            public float valCG2UpFlowEndTime;       //载气开关2程序升流结束时间

            public ushort valCG3;                   //载气开关3
            public float valCG3Set;                 //载气开关3时间设定值
            public float valCG3Actual;              //载气开关3时间实际值
            public float valCG3BlowFlow;            //载气开关3吹扫流量值
            public float valCG3UpFlowStartTime;     //载气开关3程序升流开始时间
            public float valCG3UpFlowEndTime;       //载气开关程序升流结束时间

            public float valCGColumn1Length;        //载气柱1长度
            public float valCGColumn1Bore;          //载气柱1口径
            public float valCGColumn1Theca;         //载气柱1膜厚
            public float valCGColumn1ColumnFlow;    //载气柱1柱流量

            public float valCGColumn2Length;        //载气柱2长度
            public float valCGColumn2Bore;          //载气柱2口径
            public float valCGColumn2Theca;         //载气柱2膜厚
            public float valCGColumn2ColumnFlow;    //载气柱2柱流量

            public float valCGColumn3Length;        //载气柱3长度
            public float valCGColumn3Bore;          //载气柱3口径
            public float valCGColumn3Theca;         //载气柱3膜厚
            public float valCGColumn3ColumnFlow;    //载气柱3柱流量
        }

        /// <summary>
        /// 进样口
        /// </summary>
        private void InitDevPort()
        {
            int i =0;
            for(i = 0; i < 2; i++)
            {

                if(i==0)
                {
                    port[i].sInjPortLoc = "前";
                }
                else
                {
                    port[i].sInjPortLoc = "后";
                }

                port[i].bHeater = false;			//加热器
                port[i].fHeaterSetTemp = 0.0f;	//加热器设定温度值
                port[i].fHeaterSetTempm = 0.0f;	//加热器modbus设定温度值
                port[i].fHeaterTempActual = 0.0f ;//加热器实际温度值
                port[i].fSetPre = 0.0f;			//设定压力
                port[i].fPreActual = 0.0f;		//实际压力
                port[i].fSetSumFlow = 0.0f;		//总流量设定值
                port[i].fSumFlowActual = 0.0f;	//总流量实际值
                port[i].fSetPurgeFlow = 0.0f;	//隔垫吹扫流量设定值
                port[i].fPurgeFlowActual = 0.0f;	//隔垫吹扫流量实际值
                port[i].fSetColumnFlow = 0.0f;	//柱流量设定值
                port[i].fColumnFlowActual = 0.0f;	//柱流量实际值
                port[i].sWeatherShuntModel = "不分流"; //分流不分流模式
                port[i].u16SplitRatio = 0;			//分流比
                port[i].fSplitFlow = 0.0f;			//分流流量
                port[i].bCarrierGasSave = false;	    //载气节省开启
                port[i].u16CarrierGasSave = 0;		//载气节省20ml/min
                port[i].fSaveGasTime = 0.0f;			//开始等待时间
            }
      
        }

        /// <summary>
        /// 阀
        /// </summary>
        private void InitDevValue()
        {
            for(int i = 0; i< MAX_VALVE_NUM; i++)
            {
                 valve[i].bValveKey = false;            //是否有阀存在
                 valve[i].bHeaterKey = false;           //是否有加热器
                 valve[i].fSetTemp = 0.0f;            //设定值
                 valve[i].fActualTemp = 0.0f;         //当前值
                 valve[i].u16ValveSetTime1 = 0;
                 valve[i].u16ValveSetTime2 = 0;
                 valve[i].u16ValveSetTime3 = 0;
                 valve[i].u16ValveSetTime4 = 0;
                 valve[i].u16ValveSetTime5 = 0;
                 valve[i].u16ValveSetTime6 = 0;
                 valve[i].u16ValveSetTime7 = 0;
                 valve[i].u16ValveSetTime8 = 0;
                 valve[i].ValveStatus = '0';
            }
        }

        /// <summary>
        /// 信号通道
        /// </summary>
        private void InitDevSignal()
        {

           signal.u16ChannelA=0; 	//A通道开关  0-关  1-开
           signal.u16ChannelB = 0; 	//B通道开关
           signal.uDetA = new ushort[MAX_CHANNEL_NUM];	//A通道检测器
           signal.uDetB = new ushort[MAX_CHANNEL_NUM];	//B通道检测器
           signal.u16DetTimeLengthA = new ushort[MAX_CHANNEL_NUM];	//A/B第一时间段的检测时间
           signal.u16DetTimeLengthB = new ushort[MAX_CHANNEL_NUM];	//A/B第二时间段的检测时间
           signal.u16ZeroA = new ushort[MAX_CHANNEL_NUM];				//A/B第一时间段归零操作
           signal.u16ZeroB = new ushort[MAX_CHANNEL_NUM];				//A/B第二时间段归零操作
           signal.u16SaveA = new ushort[MAX_CHANNEL_NUM];				//A/B第一时间段保存操作
           signal.u16SaveB = new ushort[MAX_CHANNEL_NUM];				//A/B第二时间段保存操作
        }
        
        /// <summary>
        /// 进样器
        /// </summary>
        private void InitDevSample()
        {
            for(int i =0; i < MAX_SAMPLE_NUM; i++)
            {
                switch(i)
                {
                    case 0:
                        sample[i].sSample ="前";			//配备的进样器
                        break;
                    case 1:
                        sample[i].sSample ="后";			//配备的进样器
                        break;
                    default:
                        sample[i].sSample ="前";			//配备的进样器
                        break;
                }
                sample[i].fSampleQuantity = 0.0f;	//进样量
                sample[i].fInjectorSize = 0.0f;		//注射器尺寸
                sample[i].sFrontSample = "酒精";		//进样前样品
                sample[i].sBSSolventA = "XX";		//进样前溶剂A
                sample[i].sBSSolventB = "XX";		//进样前溶剂B
                sample[i].sASSolventA = "XX";		//进样后溶剂A
                sample[i].sASSolventB = "XX";		//进样后溶剂B
                sample[i].u16PushPullTimes = 0;		//推拉针芯次数
               // sample[i].fCurTemp = 0.0f;			//进样室当前温度
                sample[i].fSetTemp = 0.0f;			//进样室设定温度
            }
        }


        public void InitMethodConfig()
        {
            InitDevAux();
            InitDevChrom();
            InitDevCol();
            InitDevFid();
            InitDevTcd();
            InitDevPort();
            InitDevValue();
            InitDevSignal();
            InitDevSample();
        }

        /// <summary>
        /// 设置方法文件
        /// </summary>
        /// <param name="filename"></param>
        public void SetMethodConfigName(string filename)
        {
            methodconfigini = new FileHelper(filename);
            this.savefilename = filename;
        }

        /// <summary>
        /// 设置方法保存文件
        /// </summary>
        /// <param name="filename"></param>
        public void SetMethodSaveName(string filename)
        {
            savemethodconfig = new FileHelper(filename);
            this.saveasfilename = filename;
        }

        #region 进样口
        ///// <summary>
        ///// 获取进样口参数
        ///// </summary>
        //public void GetDevInjPortAllPara()
        //{
        //    string strKey = "";
        //    ushort iDefault = 0;
        //    float fDefault = 0.0f;
        //    const int cFront = 0;
        //    const int cBehind = 1;

        //    strKey = "前进样口";
        //    port[cFront].sInjPortLoc = methodconfigini.GetProfileString(strKey, "进样口");
        //    port[cFront].bHeater = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "加热", iDefault));
        //    port[cFront].fHeaterSetTemp = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
        //    port[cFront].fHeaterSetTempm = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
        //    port[cFront].fSetPre = methodconfigini.GetProfileFloat(strKey, "设定压力", fDefault);
        //    port[cFront].fSetSumFlow = methodconfigini.GetProfileFloat(strKey, "设定总流量", fDefault);
        //    port[cFront].fSetPurgeFlow = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量设定值", fDefault);
        //    port[cFront].fSetColumnFlow = methodconfigini.GetProfileFloat(strKey, "柱流量设定值", fDefault);
        //    port[cFront].sWeatherShuntModel = methodconfigini.ReadValue(strKey, "分流不分流模式");
        //    port[cFront].u16SplitRatio = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "分流比", iDefault));
        //    port[cFront].fSplitFlow = methodconfigini.GetProfileFloat(strKey, "分流流量", fDefault);
        //    port[cFront].bCarrierGasSave = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "载气开启", iDefault));
        //    port[cFront].u16CarrierGasSave = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "载气节省量", iDefault));
        //    port[cFront].fSaveGasTime = methodconfigini.GetProfileFloat(strKey, "载气节省开始时间", fDefault);

        //    strKey = "后进样口";
        //    port[cBehind].sInjPortLoc = methodconfigini.GetProfileString(strKey, "进样口");
        //    port[cBehind].bHeater = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "加热", iDefault));
        //    port[cBehind].fHeaterSetTemp = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
        //    port[cBehind].fHeaterSetTempm = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
        //    port[cBehind].fSetPre = methodconfigini.GetProfileFloat(strKey, "设定压力", fDefault);
        //    port[cBehind].fSetSumFlow = methodconfigini.GetProfileFloat(strKey, "设定总流量", fDefault);
        //    port[cBehind].fSetPurgeFlow = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量设定值", fDefault);
        //    port[cBehind].fSetColumnFlow = methodconfigini.GetProfileFloat(strKey, "柱流量设定值", fDefault);
        //    port[cBehind].sWeatherShuntModel = methodconfigini.ReadValue(strKey, "分流不分流模式");
        //    port[cBehind].u16SplitRatio = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "分流比", iDefault));
        //    port[cBehind].fSplitFlow = methodconfigini.GetProfileFloat(strKey, "分流流量", fDefault);
        //    port[cBehind].bCarrierGasSave = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "载气开启", iDefault));
        //    port[cBehind].u16CarrierGasSave = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "载气节省量", iDefault));
        //    port[cBehind].fSaveGasTime = methodconfigini.GetProfileFloat(strKey, "载气节省开始时间", fDefault);

        //}

        ///// <summary>
        ///// 设置进样口参数
        ///// </summary>
        //public void SetDevInjPortAllPara()
        //{
        //    string strKey = "";
        //    const int cFront = 0;
        //    const int cBehind = 1;

        //    strKey = "前进样口";
        //    savemethodconfig.WriteValue(strKey, "进样口", port[cFront].sInjPortLoc);
        //    savemethodconfig.WriteProfileBool(strKey, "加热", port[cFront].bHeater);
        //    savemethodconfig.WriteValue(strKey, "设定温度",port[cFront].fHeaterSetTemp.ToString());
        //    savemethodconfig.WriteValue(strKey, "设定压力", port[cFront].fSetPre.ToString());
        //    savemethodconfig.WriteValue(strKey, "设定总流量",port[cFront].fSetSumFlow.ToString());
        //    savemethodconfig.WriteValue(strKey, "隔垫吹扫流量设定值", port[cFront].fSetPurgeFlow.ToString());
        //    savemethodconfig.WriteValue(strKey, "柱流量设定值", port[cFront].fSetColumnFlow.ToString());
        //    savemethodconfig.WriteValue(strKey, "分流不分流模式", port[cFront].sWeatherShuntModel.ToString());
        //    savemethodconfig.WriteValue(strKey, "分流比", port[cFront].u16SplitRatio.ToString());
        //    savemethodconfig.WriteValue(strKey, "分流流量", port[cFront].fSplitFlow.ToString());
        //    savemethodconfig.WriteProfileBool(strKey, "载气开启", port[cFront].bCarrierGasSave);
        //    savemethodconfig.WriteValue(strKey, "载气节省量", port[cFront].u16CarrierGasSave.ToString());
        //    savemethodconfig.WriteValue(strKey, "载气节省开始时间", port[cFront].fSaveGasTime.ToString());

        //    strKey = "后进样口";
        //    savemethodconfig.WriteValue(strKey, "进样口", port[cBehind].sInjPortLoc);
        //    savemethodconfig.WriteProfileBool(strKey, "加热", port[cBehind].bHeater);
        //    savemethodconfig.WriteValue(strKey, "设定温度", port[cBehind].fHeaterSetTemp.ToString());
        //    savemethodconfig.WriteValue(strKey, "设定压力", port[cBehind].fSetPre.ToString());
        //    savemethodconfig.WriteValue(strKey, "设定总流量", port[cBehind].fSetSumFlow.ToString());
        //    savemethodconfig.WriteValue(strKey, "隔垫吹扫流量设定值", port[cBehind].fSetPurgeFlow.ToString());
        //    savemethodconfig.WriteValue(strKey, "柱流量设定值", port[cBehind].fSetColumnFlow.ToString());
        //    savemethodconfig.WriteValue(strKey, "分流不分流模式", port[cBehind].sWeatherShuntModel.ToString());
        //    savemethodconfig.WriteValue(strKey, "分流比", port[cBehind].u16SplitRatio.ToString());
        //    savemethodconfig.WriteValue(strKey, "分流流量", port[cBehind].fSplitFlow.ToString());
        //    savemethodconfig.WriteProfileBool(strKey, "载气开启", port[cBehind].bCarrierGasSave);
        //    savemethodconfig.WriteValue(strKey, "载气节省量", port[cBehind].u16CarrierGasSave.ToString());
        //    savemethodconfig.WriteValue(strKey, "载气节省开始时间", port[cBehind].fSaveGasTime.ToString());


        //}

        #endregion
        /// <summary>
        /// 获取进样口参数
        /// </summary>
        public void GetDevInjPortAllPara()
        {
            string strKey = "";
            ushort iDefault = 0;
            float fDefault = 0.0f;
            const int cFront = 0;
            const int cBehind = 1;

            strKey = "前进样口";
            port[cFront].sInjPortLoc = methodconfigini.GetProfileString(strKey, "进样口");
            //port[cFront].bHeater = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "加热", iDefault));
            //port[cFront].fHeaterSetTemp = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
            //port[cFront].fHeaterSetTempm = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
            //port[cFront].fSetPre = methodconfigini.GetProfileFloat(strKey, "设定压力", fDefault);
            //port[cFront].fSetSumFlow = methodconfigini.GetProfileFloat(strKey, "设定总流量", fDefault);
            //port[cFront].fSetPurgeFlow = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量设定值", fDefault);
            //port[cFront].fSetColumnFlow = methodconfigini.GetProfileFloat(strKey, "柱流量设定值", fDefault);
            //port[cFront].sWeatherShuntModel = methodconfigini.ReadValue(strKey, "分流不分流模式");
            //port[cFront].u16SplitRatio = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "分流比", iDefault));
            //port[cFront].fSplitFlow = methodconfigini.GetProfileFloat(strKey, "分流流量", fDefault);
            //port[cFront].fCarrierGas1 = methodconfigini.GetProfileFloat(strKey, "载气1", fDefault);
            //port[cFront].fCarrierGas2 = methodconfigini.GetProfileFloat(strKey, "载气2", fDefault);
            //port[cFront].fCarrierGas3 = methodconfigini.GetProfileFloat(strKey, "载气3", fDefault);
            port[cFront].bCarrierGasSave = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "载气开启", iDefault));
            //port[cFront].u16CarrierGasSave = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "载气节省量", iDefault));
            port[cFront].fSaveGasTime = methodconfigini.GetProfileFloat(strKey, "载气节省开始时间", fDefault);

            port[cFront].SamplePortType = methodconfigini.GetProfileString(strKey, "前进样口类型");
            port[cFront].ControlMode = methodconfigini.GetProfileInt(strKey, "控制方式", iDefault);
            port[cFront].Heater = methodconfigini.GetProfileInt(strKey, "加热", iDefault);
            port[cFront].HeaterTmpActual = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
            port[cFront].pipPressureActual = methodconfigini.GetProfileFloat(strKey, "设定压力", fDefault);
            port[cFront].pipFlowActual = methodconfigini.GetProfileFloat(strKey, "流量值", fDefault);
            port[cFront].CarrierGasType = methodconfigini.GetProfileInt(strKey, "进样口载气类型", iDefault);
            port[cFront].Protecttemp = methodconfigini.GetProfileFloat(strKey, "进样口保护温度", fDefault);
            port[cFront].pipSeptumBlowFlow = methodconfigini.GetProfileInt(strKey, "隔垫吹扫流量开关", iDefault);
            port[cFront].pipSeptumBlowFlowActual = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量设定值", fDefault);
            //port[cFront].splBlowFlow = methodconfigini.GetProfileInt(strKey, "吹扫流量开关", iDefault);
            //port[cFront].splBlowFlowActual = methodconfigini.GetProfileFloat(strKey, "吹扫流量值", fDefault);
            port[cFront].splCarrierGasPressure = methodconfigini.GetProfileFloat(strKey, "载气入口压力", fDefault);
            port[cFront].splColumnFlow = methodconfigini.GetProfileInt(strKey, "柱流量开关", iDefault);
            port[cFront].splColumnFlowActual = methodconfigini.GetProfileFloat(strKey, "柱流量设定值", fDefault);
            port[cFront].splPrecolumnPressure = methodconfigini.GetProfileInt(strKey, "柱前压开关", iDefault);
            port[cFront].splPrecolumnPressureActual = methodconfigini.GetProfileFloat(strKey, "柱前压值", fDefault);
            port[cFront].splSaveAmount = methodconfigini.GetProfileFloat(strKey, "载气节省量", fDefault);
            port[cFront].splSaveEPC = methodconfigini.GetProfileInt(strKey, "载气节省EPC", iDefault);
            port[cFront].splShuntFlow = methodconfigini.GetProfileFloat(strKey, "分流流量", fDefault);
            port[cFront].splShuntMode = methodconfigini.GetProfileInt(strKey, "分流不分流模式", iDefault);
            port[cFront].splShuntRatio = methodconfigini.GetProfileFloat(strKey, "分流比", fDefault);
            port[cFront].splTotalFlowActual = methodconfigini.GetProfileFloat(strKey, "设定总流量", fDefault);

            strKey = "后进样口";
            port[cBehind].sInjPortLoc = methodconfigini.GetProfileString(strKey, "进样口");
            //port[cBehind].bHeater = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "加热", iDefault));
            //port[cBehind].fHeaterSetTemp = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
            //port[cBehind].fHeaterSetTempm = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
            //port[cBehind].fSetPre = methodconfigini.GetProfileFloat(strKey, "设定压力", fDefault);
            //port[cBehind].fSetSumFlow = methodconfigini.GetProfileFloat(strKey, "设定总流量", fDefault);
            //port[cBehind].fSetPurgeFlow = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量设定值", fDefault);
            //port[cBehind].fSetColumnFlow = methodconfigini.GetProfileFloat(strKey, "柱流量设定值", fDefault);
            //port[cBehind].sWeatherShuntModel = methodconfigini.ReadValue(strKey, "分流不分流模式");
            //port[cBehind].u16SplitRatio = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "分流比", iDefault));
            //port[cBehind].fSplitFlow = methodconfigini.GetProfileFloat(strKey, "分流流量", fDefault);
            //port[cBehind].fCarrierGas1 = methodconfigini.GetProfileFloat(strKey, "载气1", fDefault);
            //port[cBehind].fCarrierGas2 = methodconfigini.GetProfileFloat(strKey, "载气2", fDefault);
            //port[cBehind].fCarrierGas3 = methodconfigini.GetProfileFloat(strKey, "载气3", fDefault);
            port[cBehind].bCarrierGasSave = Convert.ToBoolean(methodconfigini.GetProfileInt(strKey, "载气开启", iDefault));
            //port[cBehind].u16CarrierGasSave = Convert.ToUInt16(methodconfigini.GetProfileInt(strKey, "载气节省量", iDefault));
            port[cBehind].fSaveGasTime = methodconfigini.GetProfileFloat(strKey, "载气节省开始时间", fDefault);

            port[cBehind].SamplePortType = methodconfigini.GetProfileString(strKey, "后进样口类型");
            port[cBehind].ControlMode = methodconfigini.GetProfileInt(strKey, "控制方式", iDefault);
            port[cBehind].Heater = methodconfigini.GetProfileInt(strKey, "加热", iDefault);
            port[cBehind].HeaterTmpActual = methodconfigini.GetProfileFloat(strKey, "设定温度", fDefault);
            port[cBehind].pipPressureActual = methodconfigini.GetProfileFloat(strKey, "设定压力", fDefault);
            port[cBehind].pipFlowActual = methodconfigini.GetProfileFloat(strKey, "流量值", fDefault);
            port[cBehind].CarrierGasType = methodconfigini.GetProfileInt(strKey, "进样口载气类型", iDefault);
            port[cBehind].Protecttemp = methodconfigini.GetProfileFloat(strKey, "进样口保护温度", fDefault);
            port[cBehind].pipSeptumBlowFlow = methodconfigini.GetProfileInt(strKey, "隔垫吹扫流量开关", iDefault);
            port[cBehind].pipSeptumBlowFlowActual = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量设定值", fDefault);
            //port[cBehind].splBlowFlow = methodconfigini.GetProfileInt(strKey, "吹扫流量开关", iDefault);
            //port[cBehind].splBlowFlowActual = methodconfigini.GetProfileFloat(strKey, "吹扫流量值", fDefault);
            port[cBehind].splCarrierGasPressure = methodconfigini.GetProfileFloat(strKey, "载气入口压力", fDefault);
            port[cBehind].splColumnFlow = methodconfigini.GetProfileInt(strKey, "柱流量开关", iDefault);
            port[cBehind].splColumnFlowActual = methodconfigini.GetProfileFloat(strKey, "柱流量设定值", fDefault);
            port[cBehind].splPrecolumnPressure = methodconfigini.GetProfileInt(strKey, "柱前压开关", iDefault);
            port[cBehind].splPrecolumnPressureActual = methodconfigini.GetProfileFloat(strKey, "柱前压值", fDefault);
            port[cBehind].splSaveAmount = methodconfigini.GetProfileFloat(strKey, "载气节省量", fDefault);
            port[cBehind].splSaveEPC = methodconfigini.GetProfileInt(strKey, "载气节省EPC", iDefault);
            port[cBehind].splShuntFlow = methodconfigini.GetProfileFloat(strKey, "分流流量", fDefault);
            port[cBehind].splShuntMode = methodconfigini.GetProfileInt(strKey, "分流不分流模式", iDefault);
            port[cBehind].splShuntRatio = methodconfigini.GetProfileFloat(strKey, "分流比", fDefault);
            port[cBehind].splTotalFlowActual = methodconfigini.GetProfileFloat(strKey, "设定总流量", fDefault);

            //strKey = "EPC1";
            //epc[cFront].fristFlow = methodconfigini.GetProfileFloat(strKey, "第一路流量设定值", fDefault);
            //epc[cFront].gasType1 = methodconfigini.GetProfileInt(strKey, "第一路载气类型", iDefault);
            //epc[cFront].SecondFlow = methodconfigini.GetProfileFloat(strKey, "第二路流量设定值", fDefault);
            //epc[cFront].gasType2 = methodconfigini.GetProfileInt(strKey, "第二路载气类型", iDefault);
            //epc[cFront].ThirdFlow = methodconfigini.GetProfileFloat(strKey, "第三路流量设定值", fDefault);
            //epc[cFront].gasType3 = methodconfigini.GetProfileInt(strKey, "第三路载气类型", iDefault);

            //strKey = "EPC2";
            //epc[cBehind].fristFlow = methodconfigini.GetProfileFloat(strKey, "第一路流量设定值", fDefault);
            //epc[cBehind].gasType1 = methodconfigini.GetProfileInt(strKey, "第一路载气类型", iDefault);
            //epc[cBehind].SecondFlow = methodconfigini.GetProfileFloat(strKey, "第二路流量设定值", fDefault);
            //epc[cBehind].gasType2 = methodconfigini.GetProfileInt(strKey, "第二路载气类型", iDefault);
            //epc[cBehind].ThirdFlow = methodconfigini.GetProfileFloat(strKey, "第三路流量设定值", fDefault);
            //epc[cBehind].gasType3 = methodconfigini.GetProfileInt(strKey, "第三路载气类型", iDefault);
        }

        /// <summary>
        /// 设置进样口参数
        /// </summary>
        public void SetDevInjPortAllPara()
        {
            string strKey = "";
            const int cFront = 0;
            const int cBehind = 1;

            strKey = "前进样口";
            savemethodconfig.WriteValue(strKey, "进样口", port[cFront].sInjPortLoc);
            //savemethodconfig.WriteProfileBool(strKey, "加热", port[cFront].bHeater);
            //savemethodconfig.WriteValue(strKey, "设定温度",port[cFront].fHeaterSetTemp.ToString());
            //savemethodconfig.WriteValue(strKey, "设定压力", port[cFront].fSetPre.ToString());
            //savemethodconfig.WriteValue(strKey, "设定总流量",port[cFront].fSetSumFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "隔垫吹扫流量设定值", port[cFront].fSetPurgeFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "柱流量设定值", port[cFront].fSetColumnFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "分流不分流模式", port[cFront].sWeatherShuntModel.ToString());
            //savemethodconfig.WriteValue(strKey, "分流比", port[cFront].u16SplitRatio.ToString());
            //savemethodconfig.WriteValue(strKey, "分流流量", port[cFront].fSplitFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "载气1", port[cFront].fCarrierGas1.ToString());
            //savemethodconfig.WriteValue(strKey, "载气2", port[cFront].fCarrierGas2.ToString());
            //savemethodconfig.WriteValue(strKey, "载气3", port[cFront].fCarrierGas3.ToString());
            savemethodconfig.WriteProfileBool(strKey, "载气开启", port[cFront].bCarrierGasSave);
            //savemethodconfig.WriteValue(strKey, "载气节省量", port[cFront].u16CarrierGasSave.ToString());
            savemethodconfig.WriteValue(strKey, "载气节省开始时间", port[cFront].fSaveGasTime.ToString());
            savemethodconfig.WriteProfileString(strKey, "前进样口类型", port[cFront].SamplePortType);
            savemethodconfig.WriteProfileInt(strKey, "控制方式", port[cFront].ControlMode);
            savemethodconfig.WriteProfileInt(strKey, "加热", port[cFront].Heater);
            savemethodconfig.WriteProfileFloat(strKey, "设定温度", port[cFront].HeaterTmpSet);
            savemethodconfig.WriteProfileFloat(strKey, "设定压力", port[cFront].pipPressureSet);
            savemethodconfig.WriteProfileFloat(strKey, "流量值", port[cFront].pipFlowSet);
            savemethodconfig.WriteProfileInt(strKey, "进样口载气类型", port[cFront].CarrierGasType);
            savemethodconfig.WriteProfileFloat(strKey, "进样口保护温度", port[cFront].Protecttemp);
            savemethodconfig.WriteProfileInt(strKey, "隔垫吹扫流量开关", port[cFront].pipSeptumBlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "隔垫吹扫流量设定值", port[cFront].pipSeptumBlowFlowSet);
            //savemethodconfig.WriteProfileInt(strKey, "吹扫流量开关", port[cFront].splBlowFlow);
            //savemethodconfig.WriteProfileFloat(strKey, "吹扫流量值", port[cFront].splBlowFlowSet);
            savemethodconfig.WriteProfileFloat(strKey, "载气入口压力", port[cFront].splCarrierGasPressure);
            savemethodconfig.WriteProfileInt(strKey, "柱流量开关", port[cFront].splColumnFlow);
            savemethodconfig.WriteProfileFloat(strKey, "柱流量值", port[cFront].splColumnFlowSet);
            savemethodconfig.WriteProfileInt(strKey, "柱前压开关", port[cFront].splPrecolumnPressure);
            savemethodconfig.WriteProfileFloat(strKey, "柱前压值", port[cFront].splPrecolumnPressureSet);
            savemethodconfig.WriteProfileFloat(strKey, "载气节省量", port[cFront].splSaveAmount);
            savemethodconfig.WriteProfileInt(strKey, "载气节省EPC", port[cFront].splSaveEPC);
            savemethodconfig.WriteProfileFloat(strKey, "分流流量", port[cFront].splShuntFlow);
            savemethodconfig.WriteProfileInt(strKey, "分流不分流模式", port[cFront].splShuntMode);
            savemethodconfig.WriteProfileFloat(strKey, "分流比", port[cFront].splShuntRatio);
            savemethodconfig.WriteProfileFloat(strKey, "设定总流量", port[cFront].splTotalFlowSet);


            strKey = "后进样口";
            savemethodconfig.WriteValue(strKey, "进样口", port[cBehind].sInjPortLoc);
            //savemethodconfig.WriteProfileBool(strKey, "加热", port[cBehind].bHeater);
            //savemethodconfig.WriteValue(strKey, "设定温度",port[cBehind].fHeaterSetTemp.ToString());
            //savemethodconfig.WriteValue(strKey, "设定压力", port[cBehind].fSetPre.ToString());
            //savemethodconfig.WriteValue(strKey, "设定总流量",port[cBehind].fSetSumFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "隔垫吹扫流量设定值", port[cBehind].fSetPurgeFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "柱流量设定值", port[cBehind].fSetColumnFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "分流不分流模式", port[cBehind].sWeatherShuntModel.ToString());
            //savemethodconfig.WriteValue(strKey, "分流比", port[cBehind].u16SplitRatio.ToString());
            //savemethodconfig.WriteValue(strKey, "分流流量", port[cBehind].fSplitFlow.ToString());
            //savemethodconfig.WriteValue(strKey, "载气1", port[cBehind].fCarrierGas1.ToString());
            //savemethodconfig.WriteValue(strKey, "载气2", port[cBehind].fCarrierGas2.ToString());
            //savemethodconfig.WriteValue(strKey, "载气3", port[cBehind].fCarrierGas3.ToString());
            savemethodconfig.WriteProfileBool(strKey, "载气开启", port[cBehind].bCarrierGasSave);
            //savemethodconfig.WriteValue(strKey, "载气节省量", port[cBehind].u16CarrierGasSave.ToString());
            savemethodconfig.WriteValue(strKey, "载气节省开始时间", port[cBehind].fSaveGasTime.ToString());
            savemethodconfig.WriteProfileString(strKey, "后进样口类型", port[cBehind].SamplePortType);
            savemethodconfig.WriteProfileInt(strKey, "控制方式", port[cBehind].ControlMode);
            savemethodconfig.WriteProfileInt(strKey, "加热", port[cBehind].Heater);
            savemethodconfig.WriteProfileFloat(strKey, "设定温度", port[cBehind].HeaterTmpSet);
            savemethodconfig.WriteProfileFloat(strKey, "设定压力", port[cBehind].pipPressureSet);
            savemethodconfig.WriteProfileFloat(strKey, "流量值", port[cBehind].pipFlowSet);
            savemethodconfig.WriteProfileInt(strKey, "进样口载气类型", port[cBehind].CarrierGasType);
            savemethodconfig.WriteProfileFloat(strKey, "进样口保护温度", port[cBehind].Protecttemp);
            savemethodconfig.WriteProfileInt(strKey, "隔垫吹扫流量开关", port[cBehind].pipSeptumBlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "隔垫吹扫流量设定值", port[cBehind].pipSeptumBlowFlowSet);
            //savemethodconfig.WriteProfileInt(strKey, "吹扫流量开关", port[cBehind].splBlowFlow);
            //savemethodconfig.WriteProfileFloat(strKey, "吹扫流量值", port[cBehind].splBlowFlowSet);
            savemethodconfig.WriteProfileFloat(strKey, "载气入口压力", port[cBehind].splCarrierGasPressure);
            savemethodconfig.WriteProfileInt(strKey, "柱流量开关", port[cBehind].splColumnFlow);
            savemethodconfig.WriteProfileFloat(strKey, "柱流量值", port[cBehind].splColumnFlowSet);
            savemethodconfig.WriteProfileInt(strKey, "柱前压开关", port[cBehind].splPrecolumnPressure);
            savemethodconfig.WriteProfileFloat(strKey, "柱前压值", port[cBehind].splPrecolumnPressureSet);
            savemethodconfig.WriteProfileFloat(strKey, "载气节省量", port[cBehind].splSaveAmount);
            savemethodconfig.WriteProfileInt(strKey, "载气节省EPC", port[cBehind].splSaveEPC);
            savemethodconfig.WriteProfileFloat(strKey, "分流流量", port[cBehind].splShuntFlow);
            savemethodconfig.WriteProfileInt(strKey, "分流不分流模式", port[cBehind].splShuntMode);
            savemethodconfig.WriteProfileFloat(strKey, "分流比", port[cBehind].splShuntRatio);
            savemethodconfig.WriteProfileFloat(strKey, "设定总流量", port[cBehind].splTotalFlowSet);

        }

        /// <summary>
        /// 获取辅助加热器
        /// </summary>
        public void GetDevAux()
        {
            const int iDefault = 0;
	        const float fDefault = 0.0f;
	        string sAppName = "辅助";
            aux.u16AuxHeatArea1 = methodconfigini.GetProfileInt(sAppName, "辅助加热区1", iDefault);
            aux.fTemp_Enable1 = (methodconfigini.GetProfileInt(sAppName, "加热开关", iDefault) == 1) ? true : false;
            aux.fSetTemp_HeatArea1 = methodconfigini.GetProfileFloat(sAppName, "辅助加热区1设定温度", fDefault);
            aux.u16AuxHeatArea2 = methodconfigini.GetProfileInt(sAppName, "辅助加热区2", iDefault);
            aux.fTemp_Enable2 = (methodconfigini.GetProfileInt(sAppName, "加热开关", iDefault) == 1) ? true : false;
            aux.fSetTemp_HeatArea2 = methodconfigini.GetProfileFloat(sAppName, "辅助加热区2设定温度", fDefault);
        }

        /// <summary>
        /// 设置辅助加热器
        /// </summary>
        public void SetDevAux()
        {
            string sAppName = "辅助";
            savemethodconfig.WriteProfileInt(sAppName, "辅助加热区1", aux.u16AuxHeatArea1);
            savemethodconfig.WriteProfileInt(sAppName, "加热开关", (aux.fTemp_Enable1 || aux.fTemp_Enable2) ? 1 : 0);
            savemethodconfig.WriteProfileFloat(sAppName, "辅助加热区1设定温度", aux.fSetTemp_HeatArea1);
            savemethodconfig.WriteProfileInt(sAppName, "加热开关", (aux.fTemp_Enable1 || aux.fTemp_Enable2) ? 1 : 0);
            savemethodconfig.WriteProfileInt(sAppName, "辅助加热区2", aux.u16AuxHeatArea2);
            savemethodconfig.WriteProfileFloat(sAppName, "辅助加热区2设定温度", aux.fSetTemp_HeatArea2);
        }

        /// <summary>
        /// 获取辅助加热器s
        /// </summary>
        public void GetDevAuxs()
        {
            string strKey = "";
            ushort iDefault = 0;
            float fDefault = 0.0f;
            const int cFront = 0;
            const int cBehind = 1;

            strKey = "辅助1";

            auxs[cFront].SamplePortType = methodconfigini.GetProfileString(strKey, "辅助名");
            auxs[cFront].ControlMode = methodconfigini.GetProfileInt(strKey, "控制方式", iDefault);
            auxs[cFront].Heater = methodconfigini.GetProfileInt(strKey, "加热器开关", iDefault);
            auxs[cFront].HeaterTmpActual = methodconfigini.GetProfileFloat("辅助", "辅助加热区1设定温度", fDefault);
            auxs[cFront].pipPressureActual = methodconfigini.GetProfileFloat(strKey, "压力值", fDefault);
            auxs[cFront].pipFlowActual = methodconfigini.GetProfileFloat(strKey, "流量值", fDefault);
            auxs[cFront].CarrierGasType = methodconfigini.GetProfileInt(strKey, "进样口载气类型", iDefault);
            auxs[cFront].Protecttemp = methodconfigini.GetProfileFloat(strKey, "进样口保护温度", fDefault);
            auxs[cFront].pipSeptumBlowFlow = methodconfigini.GetProfileInt(strKey, "隔垫吹扫流量开关", iDefault);
            auxs[cFront].pipSeptumBlowFlowActual = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量值", fDefault);

            strKey = "辅助2";
            auxs[cBehind].SamplePortType = methodconfigini.GetProfileString(strKey, "辅助名");
            auxs[cBehind].ControlMode = methodconfigini.GetProfileInt(strKey, "控制方式", iDefault);
            auxs[cBehind].Heater = methodconfigini.GetProfileInt(strKey, "加热器开关", iDefault);
            auxs[cBehind].HeaterTmpActual = methodconfigini.GetProfileFloat("辅助", "辅助加热区2设定温度", fDefault);
            auxs[cBehind].pipPressureActual = methodconfigini.GetProfileFloat(strKey, "压力值", fDefault);
            auxs[cBehind].pipFlowActual = methodconfigini.GetProfileFloat(strKey, "流量值", fDefault);
            auxs[cBehind].CarrierGasType = methodconfigini.GetProfileInt(strKey, "进样口载气类型", iDefault);
            auxs[cBehind].Protecttemp = methodconfigini.GetProfileFloat(strKey, "进样口保护温度", fDefault);
            auxs[cBehind].pipSeptumBlowFlow = methodconfigini.GetProfileInt(strKey, "隔垫吹扫流量开关", iDefault);
            auxs[cBehind].pipSeptumBlowFlowActual = methodconfigini.GetProfileFloat(strKey, "隔垫吹扫流量值", fDefault);
            
        }

        /// <summary>
        /// 设置辅助加热器s
        /// </summary>
        public void SetDevAuxs()
        {
            string strKey = "";
            const int cFront = 0;
            const int cBehind = 1;

            strKey = "辅助1";

            savemethodconfig.WriteProfileString(strKey, "辅助名", auxs[cFront].SamplePortType);
            savemethodconfig.WriteProfileInt(strKey, "控制方式", auxs[cFront].ControlMode);
            savemethodconfig.WriteProfileInt(strKey, "加热器开关", auxs[cFront].Heater);
            savemethodconfig.WriteProfileInt("辅助", "辅助加热区1", auxs[cFront].Heater);
            savemethodconfig.WriteProfileFloat("辅助", "辅助加热区1设定温度", auxs[cFront].HeaterTmpSet);
            savemethodconfig.WriteProfileFloat(strKey, "压力值", auxs[cFront].pipPressureSet);
            savemethodconfig.WriteProfileFloat(strKey, "流量值", auxs[cFront].pipFlowSet);
            savemethodconfig.WriteProfileInt(strKey, "进样口载气类型", auxs[cFront].CarrierGasType);
            savemethodconfig.WriteProfileFloat(strKey, "进样口保护温度", auxs[cFront].Protecttemp);
            savemethodconfig.WriteProfileInt(strKey, "隔垫吹扫流量开关", auxs[cFront].pipSeptumBlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "隔垫吹扫流量值", auxs[cFront].pipSeptumBlowFlowSet);


            strKey = "辅助2";
            savemethodconfig.WriteProfileString(strKey, "辅助名", auxs[cBehind].SamplePortType);
            savemethodconfig.WriteProfileInt(strKey, "控制方式", auxs[cBehind].ControlMode);
            savemethodconfig.WriteProfileInt(strKey, "加热器开关", auxs[cBehind].Heater);
            savemethodconfig.WriteProfileInt("辅助", "辅助加热区2", auxs[cBehind].Heater);
            savemethodconfig.WriteProfileFloat("辅助", "辅助加热区2设定温度", auxs[cBehind].HeaterTmpSet);
            savemethodconfig.WriteProfileFloat(strKey, "压力值", auxs[cBehind].pipPressureSet);
            savemethodconfig.WriteProfileFloat(strKey, "流量值", auxs[cBehind].pipFlowSet);
            savemethodconfig.WriteProfileInt(strKey, "进样口载气类型", auxs[cBehind].CarrierGasType);
            savemethodconfig.WriteProfileFloat(strKey, "进样口保护温度", auxs[cBehind].Protecttemp);
            savemethodconfig.WriteProfileInt(strKey, "隔垫吹扫流量开关", auxs[cBehind].pipSeptumBlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "隔垫吹扫流量值", auxs[cBehind].pipSeptumBlowFlowSet);

            if (auxs[cFront].Heater == 1 || auxs[cBehind].Heater == 1)
            {
                savemethodconfig.WriteProfileInt("辅助", "加热开关", 1);
            }
            else
            {
                savemethodconfig.WriteProfileInt("辅助", "加热开关", 0);

            }




            strKey = "EPC2";
            savemethodconfig.WriteProfileFloat(strKey, "第一路流量设定值", epc[cBehind].fristFlow);
            savemethodconfig.WriteProfileInt(strKey, "第一路载气类型", epc[cBehind].gasType1);
            savemethodconfig.WriteProfileFloat(strKey, "第二路流量设定值", epc[cBehind].SecondFlow);
            savemethodconfig.WriteProfileInt(strKey, "第二路载气类型", epc[cBehind].gasType2);
            savemethodconfig.WriteProfileFloat(strKey, "第三路流量设定值", epc[cBehind].ThirdFlow);
            savemethodconfig.WriteProfileFloat(strKey, "第三路载气类型", epc[cBehind].gasType3);
        }


        /// <summary>
        /// 获取进样器参数
        /// </summary>
        /// <param name="strCurDev"></param>
        public void GetSampleAllPara()
        {
            ushort iDefault = 0;
            float fDefault = 0.0f;
            int cFront = 0;
            int cBehind = 1;

            sample[cFront].sSample = methodconfigini.GetProfileString("前进样器", "进样器");
            sample[cFront].fSampleQuantity = methodconfigini.GetProfileFloat("前进样器", "进样量", fDefault);
            sample[cFront].fInjectorSize = methodconfigini.GetProfileFloat("前进样器", "注射器尺寸", fDefault);
            sample[cFront].sFrontSample = methodconfigini.GetProfileString("前进样器", "进样前样品");
            sample[cFront].sBSSolventA = methodconfigini.GetProfileString("前进样器", "进样前溶剂A");
            sample[cFront].sBSSolventB = methodconfigini.GetProfileString("前进样器", "进样前溶剂B");
            sample[cFront].u16PushPullTimes = methodconfigini.GetProfileInt("前进样器", "推拉针芯次数", iDefault);
            sample[cFront].sASSolventA = methodconfigini.GetProfileString("前进样器", "进样后溶剂A");
            sample[cFront].sASSolventB = methodconfigini.GetProfileString("前进样器", "进样后溶剂B");
            sample[cBehind].sSample = methodconfigini.GetProfileString("后进样器", "进样器");
            sample[cBehind].fSampleQuantity = methodconfigini.GetProfileFloat("后进样器", "进样量", fDefault);
            sample[cBehind].fInjectorSize = methodconfigini.GetProfileFloat("后进样器", "注射器尺寸", fDefault);
            sample[cBehind].sFrontSample = methodconfigini.ReadValue("后进样器", "进样前样品");
            sample[cBehind].sBSSolventA = methodconfigini.ReadValue("后进样器", "进样前溶剂A");
            sample[cBehind].sBSSolventB = methodconfigini.ReadValue("后进样器", "进样前溶剂B");
            sample[cBehind].u16PushPullTimes = methodconfigini.GetProfileInt("后进样器", "推拉针芯次数", iDefault);
            sample[cBehind].sASSolventA = methodconfigini.ReadValue("后进样器", "进样后溶剂A");
            sample[cBehind].sASSolventB = methodconfigini.ReadValue("后进样器", "进样后溶剂B");
     
        }

        /// <summary>
        /// 设置进样器参数
        /// </summary>
        public void SetSampleAllPara()
        {
            string strCurDev = "";
            int cFront = 0;
            int cBehind = 1;
      
            strCurDev = "前进样器";
            savemethodconfig.WriteProfileString(strCurDev, "进样器", sample[cFront].sSample);
            savemethodconfig.WriteProfileFloat(strCurDev, "进样量", sample[cFront].fSampleQuantity);
            savemethodconfig.WriteProfileFloat(strCurDev, "注射器尺寸", sample[cFront].fInjectorSize);
            savemethodconfig.WriteProfileString(strCurDev, "进样前样品", sample[cFront].sFrontSample);
            savemethodconfig.WriteProfileString(strCurDev, "进样前溶剂A", sample[cFront].sBSSolventA);
            savemethodconfig.WriteProfileString(strCurDev, "进样前溶剂B", sample[cFront].sBSSolventB);
            savemethodconfig.WriteProfileInt(strCurDev, "推拉针芯次数", sample[cFront].u16PushPullTimes);
            savemethodconfig.WriteProfileString(strCurDev, "进样后溶剂A", sample[cFront].sASSolventA);
            savemethodconfig.WriteProfileString(strCurDev, "进样后溶剂B", sample[cFront].sASSolventB);
            
            strCurDev = "后进样器";
            savemethodconfig.WriteProfileString(strCurDev, "进样器", sample[cBehind].sSample);
            savemethodconfig.WriteProfileFloat(strCurDev, "进样量", sample[cBehind].fSampleQuantity);
            savemethodconfig.WriteProfileFloat(strCurDev, "注射器尺寸", sample[cBehind].fInjectorSize);
            savemethodconfig.WriteProfileString(strCurDev, "进样前样品", sample[cBehind].sFrontSample);
            savemethodconfig.WriteProfileString(strCurDev, "进样前溶剂A", sample[cBehind].sBSSolventA);
            savemethodconfig.WriteProfileString(strCurDev, "进样前溶剂B", sample[cBehind].sBSSolventB);
            savemethodconfig.WriteProfileInt(strCurDev, "推拉针芯次数", sample[cBehind].u16PushPullTimes);
            savemethodconfig.WriteProfileString(strCurDev, "进样后溶剂A", sample[cBehind].sASSolventA);
            savemethodconfig.WriteProfileString(strCurDev, "进样后溶剂B", sample[cBehind].sASSolventB);
        }

        /// <summary>
        /// 获取进样阀参数
        /// </summary>
        public void GetInjValveAllPara()
        {
            ushort iDefault = 0;
            float fDefault = 0.0f;
            string sAppName = "阀";
            string strKeyName = "阀";

            for (int i = 0; i < MAX_VALVE_NUM; i++)
            {
                int channel = i + 1;

                valve[i].bValveKey = Convert.ToBoolean(methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "开关", iDefault));
                valve[i].bHeaterKey = Convert.ToBoolean(methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "加热开关", iDefault));
                valve[i].fSetTemp = methodconfigini.GetProfileFloat(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定温度", fDefault);
                valve[i].u16ValveSetTime1 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间1", iDefault);
                valve[i].u16ValveSetTime2 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间2", iDefault);
                valve[i].u16ValveSetTime3 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间3", iDefault);
                valve[i].u16ValveSetTime4 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间4", iDefault);
                valve[i].u16ValveSetTime5 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间5", iDefault);
                valve[i].u16ValveSetTime6 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间6", iDefault);
                valve[i].u16ValveSetTime7 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间7", iDefault);
                valve[i].u16ValveSetTime8 = methodconfigini.GetProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间8", iDefault);
            }
        }

        /// <summary>
        /// 设置进样阀参数
        /// </summary>
        public void SetInjValveAllPara()
        {
            string sAppName = "阀";
            string strKeyName = "阀";

            for (int i = 0; i < MAX_VALVE_NUM; i++)
            {
                int channel = i + 1;
                savemethodconfig.WriteProfileBool(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "开关", valve[i].bValveKey);
                savemethodconfig.WriteProfileBool(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "加热开关", valve[i].bHeaterKey);
                savemethodconfig.WriteProfileFloat(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定温度",valve[i].fSetTemp);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间1", valve[i].u16ValveSetTime1);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间2", valve[i].u16ValveSetTime2);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间3", valve[i].u16ValveSetTime3);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间4", valve[i].u16ValveSetTime4);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间5", valve[i].u16ValveSetTime5);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间6", valve[i].u16ValveSetTime6);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间7", valve[i].u16ValveSetTime7);
                savemethodconfig.WriteProfileInt(sAppName, (channel == 6?"IO" : strKeyName + channel.ToString()) + "设定时间8", valve[i].u16ValveSetTime8);
            }
        }

        /// <summary>
        /// 获取色谱柱
        /// </summary>
        public void GetChromAllPara()
        {
            const int iDefault = 0;
            const float fDefault = 0.0f;
            string sAppName = null;
            const int cFront = 0;
            const int cBehind = 1;

            sAppName = "前色谱柱";
            chrom[cFront].sChromSelect = methodconfigini.GetProfileInt(sAppName, "色谱柱", iDefault);
            chrom[cFront].u16ChromType = methodconfigini.GetProfileInt(sAppName, "类型", iDefault);
            chrom[cFront].fHigestTempSet = methodconfigini.GetProfileFloat(sAppName, "最高温度", fDefault);
            chrom[cFront].fLengthSet = methodconfigini.GetProfileFloat(sAppName, "长度", fDefault);
            chrom[cFront].fCalSet = methodconfigini.GetProfileFloat(sAppName, "口径", fDefault);
            chrom[cFront].fFilmThicknessSet = methodconfigini.GetProfileFloat(sAppName, "膜厚", fDefault);
            chrom[cFront].sDescribe = methodconfigini.GetProfileString(sAppName, "描述");
            chrom[cFront].fPreSetValue = methodconfigini.GetProfileFloat(sAppName, "压力设定值", fDefault);
            chrom[cFront].fFlowSetValue = methodconfigini.GetProfileFloat(sAppName, "流量设定值", fDefault);
            chrom[cFront].fSetAverageLineSpeed = methodconfigini.GetProfileFloat(sAppName, "平均线速度设定值", fDefault);
            
            sAppName = "后色谱柱";
            chrom[cBehind].sChromSelect = methodconfigini.GetProfileInt(sAppName, "色谱柱", iDefault);
            chrom[cBehind].u16ChromType = methodconfigini.GetProfileInt(sAppName, "类型", iDefault);
            chrom[cBehind].fHigestTempSet = methodconfigini.GetProfileFloat(sAppName, "最高温度", fDefault);
            chrom[cBehind].fLengthSet = methodconfigini.GetProfileFloat(sAppName, "长度", fDefault);
            chrom[cBehind].fCalSet = methodconfigini.GetProfileFloat(sAppName, "口径", fDefault);
            chrom[cBehind].fFilmThicknessSet = methodconfigini.GetProfileFloat(sAppName, "膜厚", fDefault);
            chrom[cBehind].sDescribe = methodconfigini.GetProfileString(sAppName, "描述");
            chrom[cBehind].fPreSetValue = methodconfigini.GetProfileFloat(sAppName, "压力设定值", fDefault);
            chrom[cBehind].fFlowSetValue = methodconfigini.GetProfileFloat(sAppName, "流量设定值", fDefault);
            chrom[cBehind].fSetAverageLineSpeed = methodconfigini.GetProfileFloat(sAppName, "平均线速度设定值", fDefault);
            
        }

        /// <summary>
        /// 设置色谱柱
        /// </summary>
        public void SetChromAllPara()  
        {
            string sAppName = "前色谱柱";
            const int cFront = 0;
            const int cBehind = 1;

            savemethodconfig.WriteProfileInt(sAppName, "色谱柱", chrom[cFront].sChromSelect);
            savemethodconfig.WriteProfileInt(sAppName, "类型", chrom[cFront].u16ChromType);
            savemethodconfig.WriteProfileFloat(sAppName, "最高温度",chrom[cFront].fHigestTempSet);
            savemethodconfig.WriteProfileFloat(sAppName, "长度", chrom[cFront].fLengthSet);
            savemethodconfig.WriteProfileFloat(sAppName, "口径", chrom[cFront].fCalSet);
            savemethodconfig.WriteProfileFloat(sAppName, "膜厚", chrom[cFront].fFilmThicknessSet);
            savemethodconfig.WriteProfileString(sAppName, "描述", chrom[cFront].sDescribe);
            savemethodconfig.WriteProfileFloat(sAppName, "压力设定值", chrom[cFront].fPreSetValue);
            savemethodconfig.WriteProfileFloat(sAppName, "流量设定值", chrom[cFront].fFlowSetValue);
            savemethodconfig.WriteProfileFloat(sAppName, "平均线速度设定值", chrom[cFront].fSetAverageLineSpeed);
            sAppName = "后色谱柱";
            savemethodconfig.WriteProfileInt(sAppName, "色谱柱", chrom[cBehind].sChromSelect);
            savemethodconfig.WriteProfileInt(sAppName, "类型", chrom[cBehind].u16ChromType);
            savemethodconfig.WriteProfileFloat(sAppName, "最高温度", chrom[cBehind].fHigestTempSet);
            savemethodconfig.WriteProfileFloat(sAppName, "长度", chrom[cBehind].fLengthSet);
            savemethodconfig.WriteProfileFloat(sAppName, "口径", chrom[cBehind].fCalSet);
            savemethodconfig.WriteProfileFloat(sAppName, "膜厚", chrom[cBehind].fFilmThicknessSet);
            savemethodconfig.WriteProfileString(sAppName, "描述", chrom[cBehind].sDescribe);
            savemethodconfig.WriteProfileFloat(sAppName, "压力设定值", chrom[cBehind].fPreSetValue);
            savemethodconfig.WriteProfileFloat(sAppName, "流量设定值", chrom[cBehind].fFlowSetValue);
            savemethodconfig.WriteProfileFloat(sAppName, "平均线速度设定值", chrom[cBehind].fSetAverageLineSpeed);
            

        }

        /// <summary>
        /// 获取柱箱部分配置
        /// </summary>
        public void GetColTableElseAllPara()
        {
            ushort iDefault = 0;
            float fDefault = 0.0f;
            string sAppName = "柱箱";

            col.u16KeyCol = methodconfigini.GetProfileInt(sAppName, "柱箱开关", iDefault);
            col.fHigestTemp = methodconfigini.GetProfileFloat(sAppName, "最高温度", fDefault);
            col.fBalanceTime = methodconfigini.GetProfileFloat(sAppName, "平衡时间", fDefault);
            col.u16FastColdTrap = methodconfigini.GetProfileInt(sAppName, "快速冷阱", iDefault);
            col.u16StartTarp_Type = methodconfigini.GetProfileInt(sAppName, "冷却方式", iDefault);
            col.fColTempSet = methodconfigini.GetProfileFloat(sAppName, "设定温度", fDefault); 
            col.fBehindRunTemp = methodconfigini.GetProfileFloat(sAppName, "后运行温度", fDefault);
            col.fBehindRunTime = methodconfigini.GetProfileFloat(sAppName, "后运行时间", fDefault);

            sAppName = "程升表";
            col.u16ColProNum = methodconfigini.GetProfileInt(sAppName, "阶段数目", iDefault);

        }

        /// <summary>
        /// 设置柱箱
        /// </summary>
        public void SetColTableElseAllPara()
        {
            string sAppName = "柱箱";
            savemethodconfig.WriteProfileInt(sAppName, "柱箱", col.u16KeyCol);
            savemethodconfig.WriteProfileFloat(sAppName, "最高温度", col.fHigestTemp);
            savemethodconfig.WriteProfileFloat(sAppName, "平衡时间", col.fBalanceTime);
            savemethodconfig.WriteProfileInt(sAppName, "快速冷阱", col.u16FastColdTrap);
            savemethodconfig.WriteProfileInt(sAppName, "冷却方式", col.u16StartTarp_Type);
            savemethodconfig.WriteProfileInt(sAppName, "柱箱开关", col.u16KeyCol);
            savemethodconfig.WriteProfileFloat(sAppName, "设定温度", col.fColTempSet);
            savemethodconfig.WriteProfileFloat(sAppName, "后运行温度",col.fBehindRunTemp);
            savemethodconfig.WriteProfileFloat(sAppName, "后运行时间",col.fBehindRunTime);

            sAppName = "程升表";
            savemethodconfig.WriteProfileInt(sAppName, "阶段数目", col.u16ColProNum);
        }


        public struct stRunTableVal
        {
            public float StartTemp;  //开始温度
            public float TargetTemp; //目标温度
            public float HeatSpeed;  //上升速度
            public float BalanceTime;//平衡时间
        }

        /// <summary>
        /// 获取柱箱的程升表的配置
        /// </summary>
        /// <param name="stValue"></param>
        /// <param name="u16Stage"></param>
        public void  GetColTableStageVal(ref stRunTableVal stValue, ushort u16Stage)
        {
            string strStage;

            if (u16Stage >= 4)
            {
                strStage = u16Stage.ToString() + "th";
            }
            else
            {
                strStage = sStage[u16Stage];
            }

            stValue.StartTemp = methodconfigini.GetProfileFloat(strStage, "StartTemp", 0);
            stValue.TargetTemp = methodconfigini.GetProfileFloat(strStage, "TargetTemp", 0);
            stValue.HeatSpeed = methodconfigini.GetProfileFloat(strStage, "HeatSpeed", 0);
            stValue.BalanceTime = methodconfigini.GetProfileFloat(strStage, "BalanceTime", 0);

        }

        /// <summary>
        /// 擦除程升表
        /// </summary>
        /// <param name="Stagenum"></param>
        public void EraseColTable(int Stagenum)
        {
            int i;
            string tmpname;
            for (i = 0; i < Stagenum; i++)
            {
                if (i >= 4)
                {
                    tmpname = i.ToString() + "th";
                }
                else
                {
                    tmpname = sStage[i];
                }
                savemethodconfig.EraseSection(tmpname);
            }
        }

        /// <summary>
        /// 记录一次程升表
        /// </summary>
        /// <param name="stValue"></param>
        /// <param name="u16Stage"></param>
        public void SetColTableStageVal(stRunTableVal stValue, ushort u16Stage)
        {
            string strStage;

            if (u16Stage >= 4)
            {
                strStage = u16Stage.ToString() + "th";
            }
            else
            {
                strStage = sStage[u16Stage];
            }

            savemethodconfig.EraseSection(strStage);

            savemethodconfig.WriteProfileFloat(strStage, "TargetTemp", stValue.TargetTemp);
            savemethodconfig.WriteProfileFloat(strStage, "HeatSpeed", stValue.HeatSpeed);
            savemethodconfig.WriteProfileFloat(strStage, "BalanceTime", stValue.BalanceTime);
        }


        /// <summary>
        /// 获取TCD值
        /// </summary>
        /// <param name="flag">0-前 1-中 2-后</param>
        public void GetTcdByID(int flag)
        {
            ushort iDefault = 0;
            float fDefault = 0.0f;
            string sAppName = "";
            int cFront = 0;
            int cInter = 1;
            int cBehind = 2;

            if (flag == 0)
            {
                sAppName = "前检测器";
                tcd[cFront].sTcdLoc = methodconfigini.GetProfileString(sAppName, "TCD");
                //tcd[cFront].fSigValve = methodconfigini.GetProfileFloat(sAppName, "信号值", fDefault);
                //tcd[cFront].u16Electric = methodconfigini.GetProfileInt(sAppName, "桥电路", iDefault);
                tcd[cFront].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                tcd[cFront].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                //tcd[cFront].u16AutoZeroSet = methodconfigini.GetProfileInt(sAppName, "自动调零", iDefault);
                tcd[cFront].fHeaterTempSet = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                tcd[cFront].fTaiGasSet = methodconfigini.GetProfileFloat(sAppName, "参比气流量设定值", fDefault);
                //tcd[cFront].u16SigDeduct = methodconfigini.GetProfileInt(sAppName, "信号补偿", iDefault);
                tcd[cFront].u16HeaterSel = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                tcd[cFront].u16TaiGasSel = methodconfigini.GetProfileInt(sAppName, "参比气流量开关", iDefault);
            }
            else if (flag == 1)
            {
                sAppName = "中检测器";
                tcd[cInter].sTcdLoc = methodconfigini.GetProfileString(sAppName, "TCD");
                //tcd[cInter].fSigValve = methodconfigini.GetProfileFloat(sAppName, "信号值", fDefault);
                //tcd[cInter].u16Electric = methodconfigini.GetProfileInt(sAppName, "桥电路", iDefault);
                tcd[cInter].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                tcd[cInter].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                //tcd[cInter].u16AutoZeroSet = methodconfigini.GetProfileInt(sAppName, "自动调零", iDefault);
                tcd[cInter].fHeaterTempSet = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                tcd[cInter].fTaiGasSet = methodconfigini.GetProfileFloat(sAppName, "参比气流量设定值", fDefault);
                //tcd[cInter].u16SigDeduct = methodconfigini.GetProfileInt(sAppName, "信号补偿", iDefault);
                tcd[cInter].u16HeaterSel = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                tcd[cInter].u16TaiGasSel = methodconfigini.GetProfileInt(sAppName, "参比气流量开关", iDefault);
            }
            else if (flag == 2)
            {
                sAppName = "后检测器";
                tcd[cBehind].sTcdLoc = methodconfigini.GetProfileString(sAppName, "TCD");
                //tcd[cBehind].fSigValve = methodconfigini.GetProfileFloat(sAppName, "信号值", fDefault);
                //tcd[cBehind].u16Electric = methodconfigini.GetProfileInt(sAppName, "桥电路", iDefault);
                tcd[cBehind].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                tcd[cBehind].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                //tcd[cBehind].u16AutoZeroSet = methodconfigini.GetProfileInt(sAppName, "自动调零", iDefault);
                tcd[cBehind].fHeaterTempSet = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                tcd[cBehind].fTaiGasSet = methodconfigini.GetProfileFloat(sAppName, "参比气流量设定值", fDefault);
                //tcd[cBehind].u16SigDeduct = methodconfigini.GetProfileInt(sAppName, "信号补偿", iDefault);
                tcd[cBehind].u16HeaterSel = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                tcd[cBehind].u16TaiGasSel = methodconfigini.GetProfileInt(sAppName, "参比气流量开关", iDefault);
            }
            else
            {

            }
        }

        /// <summary>
        /// 设置TCD值
        /// </summary>
        /// <param name="flag"></param>
        public void SetTcdByID(int flag)
        {
            string sAppName = "";
            const int cFront = 0;
            const int cInter = 1;
            const int cBehind = 2;

            if (flag == 0)
            {
                sAppName = "前检测器";
                savemethodconfig.WriteProfileString(sAppName, "TCD", tcd[cFront].sTcdLoc);
                //savemethodconfig.WriteProfileFloat(sAppName, "信号值", tcd[cFront].fSigValve);
                //savemethodconfig.WriteProfileInt(sAppName, "桥电路", tcd[cFront].u16Electric);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", tcd[cFront].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "极性", tcd[cFront].u16Polarity);
                //savemethodconfig.WriteProfileInt(sAppName, "自动调零", tcd[cFront].u16AutoZeroSet);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", tcd[cFront].fHeaterTempSet);
                savemethodconfig.WriteProfileFloat(sAppName, "参比气流量设定值", tcd[cFront].fTaiGasSet);
                //savemethodconfig.WriteProfileInt(sAppName, "信号补偿", tcd[cFront].u16SigDeduct);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", tcd[cFront].u16HeaterSel);
                savemethodconfig.WriteProfileInt(sAppName, "参比气流量开关", tcd[cFront].u16TaiGasSel);
            }
            else if (flag == 1)
            {
                sAppName = "中检测器";
                savemethodconfig.WriteProfileString(sAppName, "TCD", tcd[cInter].sTcdLoc);
                //savemethodconfig.WriteProfileFloat(sAppName, "信号值", tcd[cInter].fSigValve);
                //savemethodconfig.WriteProfileInt(sAppName, "桥电路", tcd[cInter].u16Electric);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", tcd[cInter].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "极性", tcd[cInter].u16Polarity);
                //savemethodconfig.WriteProfileInt(sAppName, "自动调零", tcd[cInter].u16AutoZeroSet);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", tcd[cInter].fHeaterTempSet);
                savemethodconfig.WriteProfileFloat(sAppName, "参比气流量设定值", tcd[cInter].fTaiGasSet);
                //savemethodconfig.WriteProfileInt(sAppName, "信号补偿", tcd[cInter].u16SigDeduct);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", tcd[cInter].u16HeaterSel);
                savemethodconfig.WriteProfileInt(sAppName, "参比气流量开关", tcd[cInter].u16TaiGasSel);
            }
            else if (flag == 2)
            {
                sAppName = "后检测器";
                savemethodconfig.WriteProfileString(sAppName, "TCD", tcd[cBehind].sTcdLoc);
                //savemethodconfig.WriteProfileFloat(sAppName, "信号值",tcd[cBehind].fSigValve);
                //savemethodconfig.WriteProfileInt(sAppName, "桥电路",tcd[cBehind].u16Electric);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", tcd[cBehind].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "极性", tcd[cBehind].u16Polarity);
                //savemethodconfig.WriteProfileInt(sAppName, "自动调零", tcd[cBehind].u16AutoZeroSet);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", tcd[cBehind].fHeaterTempSet);
                savemethodconfig.WriteProfileFloat(sAppName, "参比气流量设定值", tcd[cBehind].fTaiGasSet);
                //savemethodconfig.WriteProfileInt(sAppName, "信号补偿", tcd[cBehind].u16SigDeduct);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", tcd[cBehind].u16HeaterSel);
                savemethodconfig.WriteProfileInt(sAppName, "参比气流量开关", tcd[cBehind].u16TaiGasSel);
            }
        }

        /// <summary>
        /// 获取FID
        /// </summary>
        /// <param name="flag"></param>
        public void GetFidByID(int flag)  //FID
        {
            ushort iDefault = 0;
            float fDefault = 0.0f;
            string sAppName = "";
            int cFront = 0;
            int cInter = 1;
            int cBehind = 2;

            if (flag == 0)
            {
                sAppName = "前检测器";
                //fid[cFront].sFid = methodconfigini.GetProfileString(sAppName, "检测器位置");
                fid[cFront].u16KeyFire = methodconfigini.GetProfileInt(sAppName, "自动点火", iDefault);
                fid[cFront].u16Zero = methodconfigini.GetProfileInt(sAppName, "归零", iDefault);
                fid[cFront].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                fid[cFront].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                fid[cFront].u16Sensitive = methodconfigini.GetProfileInt(sAppName, "灵敏度", iDefault);
                fid[cFront].u16KeyHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                fid[cFront].fHeaterTempSet = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                fid[cFront].u16KeyH2Flow = methodconfigini.GetProfileInt(sAppName, "氢气燃气流量开关", iDefault);
                fid[cFront].fSetH2Flow = methodconfigini.GetProfileFloat(sAppName, "氢气燃气流量设定值", fDefault);
                fid[cFront].u16KeyAirFlow = methodconfigini.GetProfileInt(sAppName, "空气流量开关", iDefault);
                fid[cFront].fAirFlowSet = methodconfigini.GetProfileFloat(sAppName, "空气流量设定值", fDefault);
                fid[cFront].u16KeyTailGas = methodconfigini.GetProfileInt(sAppName, "尾吹气流量开关", iDefault);
                fid[cFront].fSetTailGas = methodconfigini.GetProfileFloat(sAppName, "尾吹气流量设定值", fDefault);
                fid[cFront].u16SigDeduct = methodconfigini.GetProfileInt(sAppName, "补偿", iDefault);
            }
            else if (flag == 1)
            {
                sAppName = "中检测器";
                //fid[cInter].sFid = methodconfigini.GetProfileString(sAppName, "检测器位置");
                fid[cInter].u16KeyFire = methodconfigini.GetProfileInt(sAppName, "自动点火", iDefault);
                fid[cInter].u16Zero = methodconfigini.GetProfileInt(sAppName, "归零", iDefault);
                fid[cInter].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                fid[cInter].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                fid[cInter].u16Sensitive = methodconfigini.GetProfileInt(sAppName, "灵敏度", iDefault);
                fid[cInter].u16KeyHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                fid[cInter].fHeaterTempSet = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                fid[cInter].u16KeyH2Flow = methodconfigini.GetProfileInt(sAppName, "氢气燃气流量开关", iDefault);
                fid[cInter].fSetH2Flow = methodconfigini.GetProfileFloat(sAppName, "氢气燃气流量设定值", fDefault);
                fid[cInter].u16KeyAirFlow = methodconfigini.GetProfileInt(sAppName, "空气流量开关", iDefault);
                fid[cInter].fAirFlowSet = methodconfigini.GetProfileFloat(sAppName, "空气流量设定值", fDefault);
                fid[cInter].u16KeyTailGas = methodconfigini.GetProfileInt(sAppName, "尾吹气流量开关", iDefault);
                fid[cInter].fSetTailGas = methodconfigini.GetProfileFloat(sAppName, "尾吹气流量设定值", fDefault);
                fid[cInter].u16SigDeduct = methodconfigini.GetProfileInt(sAppName, "补偿", iDefault);
            }
            else if (flag == 2)
            {
                sAppName = "后检测器";
                //fid[cBehind].sFid = methodconfigini.GetProfileString(sAppName, "检测器位置");
                fid[cBehind].u16KeyFire = methodconfigini.GetProfileInt(sAppName, "自动点火", iDefault);
                fid[cBehind].u16Zero = methodconfigini.GetProfileInt(sAppName, "归零", iDefault);
                fid[cBehind].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                fid[cBehind].u16Polarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                fid[cBehind].u16Sensitive = methodconfigini.GetProfileInt(sAppName, "灵敏度", iDefault);
                fid[cBehind].u16KeyHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                fid[cBehind].fHeaterTempSet = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                fid[cBehind].u16KeyH2Flow = methodconfigini.GetProfileInt(sAppName, "氢气燃气流量开关", iDefault);
                fid[cBehind].fSetH2Flow = methodconfigini.GetProfileFloat(sAppName, "氢气燃气流量设定值", fDefault);
                fid[cBehind].u16KeyAirFlow = methodconfigini.GetProfileInt(sAppName, "空气流量开关", iDefault);
                fid[cBehind].fAirFlowSet = methodconfigini.GetProfileFloat(sAppName, "空气流量设定值", fDefault);
                fid[cBehind].u16KeyTailGas = methodconfigini.GetProfileInt(sAppName, "尾吹气流量开关", iDefault);
                fid[cBehind].fSetTailGas = methodconfigini.GetProfileFloat(sAppName, "尾吹气流量设定值", fDefault);
                fid[cBehind].u16SigDeduct = methodconfigini.GetProfileInt(sAppName, "补偿", iDefault);
            }
        }

        /// <summary>
        /// FID设置
        /// </summary>
        /// <param name="flag"></param>
        public void SetFidByID(int flag)
        {
            string sAppName = "";
            const int cFront = 0;
            const int cInter = 1;
            const int cBehind = 2;

            if (flag == 0)
            {
                sAppName = "前检测器";
                //savemethodconfig.WriteProfileString(sAppName, "检测器位置", fid[cFront].sFid);
                savemethodconfig.WriteProfileInt(sAppName, "自动点火", fid[cFront].u16KeyFire);
                savemethodconfig.WriteProfileInt(sAppName, "归零", fid[cFront].u16Zero);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", fid[cFront].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "极性", fid[cFront].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "灵敏度", fid[cFront].u16Sensitive);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", fid[cFront].u16KeyHeater);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", fid[cFront].fHeaterTempSet);
                savemethodconfig.WriteProfileInt(sAppName, "氢气燃气流量开关", fid[cFront].u16KeyH2Flow);
                savemethodconfig.WriteProfileFloat(sAppName, "氢气燃气流量设定值", fid[cFront].fSetH2Flow);
                savemethodconfig.WriteProfileInt(sAppName, "空气流量开关", fid[cFront].u16KeyAirFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "空气流量设定值",fid[cFront].fAirFlowSet);
                savemethodconfig.WriteProfileInt(sAppName, "尾吹气流量开关", fid[cFront].u16KeyTailGas);
                savemethodconfig.WriteProfileFloat(sAppName, "尾吹气流量设定值", fid[cFront].fSetTailGas);
                savemethodconfig.WriteProfileInt(sAppName, "补偿", fid[cFront].u16SigDeduct);
            }
            else if (flag == 1)
            {
                sAppName = "中检测器";
                //savemethodconfig.WriteProfileString(sAppName, "检测器位置",fid[cInter].sFid);
                savemethodconfig.WriteProfileInt(sAppName, "自动点火", fid[cInter].u16KeyFire);
                savemethodconfig.WriteProfileInt(sAppName, "归零", fid[cInter].u16Zero);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", fid[cInter].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "极性", fid[cInter].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "灵敏度", fid[cInter].u16Sensitive);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", fid[cInter].u16KeyHeater);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", fid[cInter].fHeaterTempSet);
                savemethodconfig.WriteProfileInt(sAppName, "氢气燃气流量开关", fid[cInter].u16KeyH2Flow);
                savemethodconfig.WriteProfileFloat(sAppName, "氢气燃气流量设定值", fid[cInter].fSetH2Flow);
                savemethodconfig.WriteProfileInt(sAppName, "空气流量开关", fid[cInter].u16KeyAirFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "空气流量设定值", fid[cInter].fAirFlowSet);
                savemethodconfig.WriteProfileInt(sAppName, "尾吹气流量开关", fid[cInter].u16KeyTailGas);
                savemethodconfig.WriteProfileFloat(sAppName, "尾吹气流量设定值",fid[cInter].fSetTailGas);
                savemethodconfig.WriteProfileInt(sAppName, "补偿", fid[cInter].u16SigDeduct);
            }
            else if ( flag == 2)
            {
                sAppName = "后检测器";
                //savemethodconfig.WriteProfileString(sAppName, "检测器位置", fid[cBehind].sFid);
                savemethodconfig.WriteProfileInt(sAppName, "自动点火", fid[cBehind].u16KeyFire);
                savemethodconfig.WriteProfileInt(sAppName, "归零", fid[cBehind].u16Zero);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", fid[cBehind].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "极性", fid[cBehind].u16Polarity);
                savemethodconfig.WriteProfileInt(sAppName, "灵敏度", fid[cBehind].u16Sensitive);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", fid[cBehind].u16KeyHeater);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", fid[cBehind].fHeaterTempSet);
                savemethodconfig.WriteProfileInt(sAppName, "氢气燃气流量开关", fid[cBehind].u16KeyH2Flow);
                savemethodconfig.WriteProfileFloat(sAppName, "氢气燃气流量设定值", fid[cBehind].fSetH2Flow);
                savemethodconfig.WriteProfileInt(sAppName, "空气流量开关", fid[cBehind].u16KeyAirFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "空气流量设定值", fid[cBehind].fAirFlowSet);
                savemethodconfig.WriteProfileInt(sAppName, "尾吹气流量开关", fid[cBehind].u16KeyTailGas);
                savemethodconfig.WriteProfileFloat(sAppName, "尾吹气流量设定值", fid[cBehind].fSetTailGas);
                savemethodconfig.WriteProfileInt(sAppName, "补偿", fid[cBehind].u16SigDeduct);
            }

            sAppName = "EPC1";
            savemethodconfig.WriteProfileFloat(sAppName, "第一路流量设定值", epc[cFront].fristFlow);
            savemethodconfig.WriteProfileInt(sAppName, "第一路载气类型", epc[cFront].gasType1);
            savemethodconfig.WriteProfileFloat(sAppName, "第二路流量设定值", epc[cFront].SecondFlow);
            savemethodconfig.WriteProfileInt(sAppName, "第二路载气类型", epc[cFront].gasType2);
            savemethodconfig.WriteProfileFloat(sAppName, "第三路流量设定值", epc[cFront].ThirdFlow);
            savemethodconfig.WriteProfileInt(sAppName, "第三路载气类型", epc[cFront].gasType3);
        }


        /// <summary>
        /// 获取检测器
        /// </summary>
        /// <param name="index"></param>
        /// <param name="type"></param>
        public void GetDetectorByID(int index, int type)
        {
            ushort iDefault = 0;
            float fDefault = 0.0f;
            string sAppName = "";
            int cFront = 0;
            int cInter = 1;
            int cBehind = 2;

            if (index == 0)
            {
                sAppName = "前检测器";
                if (type == 0)
                {
                    detector[cFront].epcType = 0;
                    detector[cFront].epcHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                    detector[cFront].epcHeaterTmpActual = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                    detector[cFront].epcPolarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                    detector[cFront].epcPolarityActual = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);

                    detector[cFront].epctElectricSignalActual = methodconfigini.GetProfileFloat(sAppName, "电信号设定值", fDefault);
                    detector[cFront].epctBridgeCurrentActual = methodconfigini.GetProfileFloat(sAppName, "桥电流设定值", fDefault);
                    detector[cFront].epctAutoBridgeCurrentActual = methodconfigini.GetProfileInt(sAppName, "桥电流自动开关设定值", iDefault);
                    detector[cFront].epctRGFRActual = methodconfigini.GetProfileFloat(sAppName, "参比气流量设定值", fDefault);

                    detector[cFront].epctElectricSignal = methodconfigini.GetProfileInt(sAppName, "电信号开关", iDefault);
                    detector[cFront].epctBridgeCurrent = methodconfigini.GetProfileInt(sAppName, "桥电流", iDefault);
                    detector[cFront].epctAutoBridgeCurrent = methodconfigini.GetProfileInt(sAppName, "桥电流自动开关", iDefault);
                    detector[cFront].epctRGFR = methodconfigini.GetProfileInt(sAppName, "参比气流量开关", iDefault);
                }
                else if (type == 1)
                {
                    detector[cFront].epcType = 1;
                    detector[cFront].epcfAirFlow = methodconfigini.GetProfileInt(sAppName, "空气流量开关", iDefault);
                    detector[cFront].epcfAirFlowActual = methodconfigini.GetProfileFloat(sAppName, "空气流量设定值", fDefault);
                    detector[cFront].epcfFlame = methodconfigini.GetProfileInt(sAppName, "火焰", iDefault);
                    detector[cFront].epcfFlameActual = methodconfigini.GetProfileFloat(sAppName, "火焰设定值", fDefault);
                    detector[cFront].epcHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                    detector[cFront].epcHeaterTmpActual = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                    detector[cFront].epcfHFlow = methodconfigini.GetProfileInt(sAppName, "氢气燃气流量开关", iDefault);
                    detector[cFront].epcfHFlowActual = methodconfigini.GetProfileFloat(sAppName, "氢气燃气流量设定值", fDefault);
                    detector[cFront].epcPolarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                    detector[cFront].epcPolarityActual = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                    detector[cFront].epcfTGFR = methodconfigini.GetProfileInt(sAppName, "尾吹气流量开关", iDefault);
                    detector[cFront].epcfTGFRActual = methodconfigini.GetProfileFloat(sAppName, "尾吹气流量设定值", fDefault);
                }
            }
            else if (index == 1)
            {
                sAppName = "中检测器";
                if (type == 0)
                {
                    detector[cInter].epcType = 0;
                    detector[cInter].epcHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                    detector[cInter].epcHeaterTmpActual = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                    detector[cInter].epcPolarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                    detector[cInter].epcPolarityActual = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);

                    detector[cInter].epctElectricSignalActual = methodconfigini.GetProfileFloat(sAppName, "电信号设定值", fDefault);
                    detector[cInter].epctBridgeCurrentActual = methodconfigini.GetProfileFloat(sAppName, "桥电流设定值", fDefault);
                    detector[cInter].epctAutoBridgeCurrentActual = methodconfigini.GetProfileInt(sAppName, "桥电流自动开关设定值", iDefault);
                    detector[cInter].epctRGFRActual = methodconfigini.GetProfileFloat(sAppName, "参比气流量设定值", fDefault);

                    detector[cInter].epctElectricSignal = methodconfigini.GetProfileInt(sAppName, "电信号开关", iDefault);
                    detector[cInter].epctBridgeCurrent = methodconfigini.GetProfileInt(sAppName, "桥电流", iDefault);
                    detector[cInter].epctAutoBridgeCurrent = methodconfigini.GetProfileInt(sAppName, "桥电流自动开关", iDefault);
                    detector[cInter].epctRGFR = methodconfigini.GetProfileInt(sAppName, "参比气流量开关", iDefault);
                }
                else if (type == 1)
                {
                    detector[cInter].epcType = 1;
                    detector[cInter].epcfAirFlow = methodconfigini.GetProfileInt(sAppName, "空气流量开关", iDefault);
                    detector[cInter].epcfAirFlowActual = methodconfigini.GetProfileFloat(sAppName, "空气流量设定值", fDefault);
                    detector[cInter].epcfFlame = methodconfigini.GetProfileInt(sAppName, "火焰", iDefault);
                    detector[cInter].epcfFlameActual = methodconfigini.GetProfileFloat(sAppName, "火焰设定值", fDefault);
                    detector[cInter].epcHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                    detector[cInter].epcHeaterTmpActual = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                    detector[cInter].epcfHFlow = methodconfigini.GetProfileInt(sAppName, "氢气燃气流量开关", iDefault);
                    detector[cInter].epcfHFlowActual = methodconfigini.GetProfileFloat(sAppName, "氢气燃气流量设定值", fDefault);
                    detector[cInter].epcPolarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                    detector[cInter].epcPolarityActual = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                    detector[cInter].epcfTGFR = methodconfigini.GetProfileInt(sAppName, "尾吹气流量开关", iDefault);
                    detector[cInter].epcfTGFRActual = methodconfigini.GetProfileFloat(sAppName, "尾吹气流量设定值", fDefault);
                }
            }
            else if (index == 2)
            {
                sAppName = "后检测器";
                if (type == 0)
                {
                    detector[cBehind].epcType = 0;
                    detector[cBehind].epcHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                    detector[cBehind].epcHeaterTmpActual = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                    detector[cBehind].epcPolarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                    detector[cBehind].epcPolarityActual = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);

                    detector[cBehind].epctElectricSignalActual = methodconfigini.GetProfileFloat(sAppName, "电信号设定值", fDefault);
                    detector[cBehind].epctBridgeCurrentActual = methodconfigini.GetProfileFloat(sAppName, "桥电流设定值", fDefault);
                    detector[cBehind].epctAutoBridgeCurrentActual = methodconfigini.GetProfileInt(sAppName, "桥电流自动开关设定值", iDefault);
                    detector[cBehind].epctRGFRActual = methodconfigini.GetProfileFloat(sAppName, "参比气流量设定值", fDefault);

                    detector[cBehind].epctElectricSignal = methodconfigini.GetProfileInt(sAppName, "电信号开关", iDefault);
                    detector[cBehind].epctBridgeCurrent = methodconfigini.GetProfileInt(sAppName, "桥电流", iDefault);
                    detector[cBehind].epctAutoBridgeCurrent = methodconfigini.GetProfileInt(sAppName, "桥电流自动开关", iDefault);
                    detector[cBehind].epctRGFR = methodconfigini.GetProfileInt(sAppName, "参比气流量开关", iDefault);

                }
                else if (type == 1)
                {
                    detector[cBehind].epcType = 1;
                    detector[cBehind].epcfAirFlow = methodconfigini.GetProfileInt(sAppName, "空气流量开关", iDefault);
                    detector[cBehind].epcfAirFlowActual = methodconfigini.GetProfileFloat(sAppName, "空气流量设定值", fDefault);
                    detector[cBehind].epcfFlame = methodconfigini.GetProfileInt(sAppName, "火焰", iDefault);
                    detector[cBehind].epcfFlameActual = methodconfigini.GetProfileFloat(sAppName, "火焰设定值", fDefault);
                    detector[cBehind].epcHeater = methodconfigini.GetProfileInt(sAppName, "加热器开关", iDefault);
                    detector[cBehind].epcHeaterTmpActual = methodconfigini.GetProfileFloat(sAppName, "加热器设定温度", fDefault);
                    detector[cBehind].epcfHFlow = methodconfigini.GetProfileInt(sAppName, "氢气燃气流量开关", iDefault);
                    detector[cBehind].epcfHFlowActual = methodconfigini.GetProfileFloat(sAppName, "氢气燃气流量设定值", fDefault);
                    detector[cBehind].epcPolarity = methodconfigini.GetProfileInt(sAppName, "极性", iDefault);
                    detector[cBehind].epcPolarityActual = methodconfigini.GetProfileInt(sAppName, "极性设定值", iDefault);
                    detector[cBehind].epcfTGFR = methodconfigini.GetProfileInt(sAppName, "尾吹气流量开关", iDefault);
                    detector[cBehind].epcfTGFRActual = methodconfigini.GetProfileFloat(sAppName, "尾吹气流量设定值", fDefault);
                }
            }
        }

        /// <summary>
        /// 设置检测器
        /// </summary>
        /// <param name="index"></param>
        public void SetDetectorByID(int index)
        {
            string sAppName = "";
            const int cFront = 0;
            const int cInter = 1;
            const int cBehind = 2;

            if (index == 0)
            {
                sAppName = "前检测器";
                //if (type == 0)
                //{
                savemethodconfig.WriteProfileInt(sAppName, "检测器类型", detector[cFront].epcType);
                savemethodconfig.WriteProfileInt(sAppName, "桥电流自动开关设定值", detector[cFront].epctAutoBridgeCurrentSet);
                savemethodconfig.WriteProfileFloat(sAppName, "桥电流设定值", detector[cFront].epctBridgeCurrentSet);
                savemethodconfig.WriteProfileFloat(sAppName, "电信号设定值", detector[cFront].epctElectricSignalSet);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", detector[cFront].epcHeaterTmpSet);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", detector[cFront].epcPolaritySet);
                savemethodconfig.WriteProfileFloat(sAppName, "参比气流量设定值", detector[cFront].epctRGFRSet);

                savemethodconfig.WriteProfileInt(sAppName, "桥电流自动开关", detector[cFront].epctAutoBridgeCurrent);
                savemethodconfig.WriteProfileInt(sAppName, "桥电流", detector[cFront].epctBridgeCurrent);
                savemethodconfig.WriteProfileInt(sAppName, "电信号开关", detector[cFront].epctElectricSignal);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", detector[cFront].epcHeater);
                savemethodconfig.WriteProfileInt(sAppName, "极性", detector[cFront].epcPolarity);
                savemethodconfig.WriteProfileInt(sAppName, "参比气流量开关", detector[cFront].epctRGFR);
                //}
                //else if (type == 1)
                //{
                //savemethodconfig.WriteProfileInt(sAppName, "检测器类型", detector[cFront].epcType);
                savemethodconfig.WriteProfileInt(sAppName, "空气流量开关", detector[cFront].epcfAirFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "空气流量设定值", detector[cFront].epcfAirFlowSet);
                savemethodconfig.WriteProfileInt(sAppName, "火焰", detector[cFront].epcfFlame);
                savemethodconfig.WriteProfileFloat(sAppName, "火焰设定值", detector[cFront].epcfFlameSet);
                //savemethodconfig.WriteProfileInt(sAppName, "加热器开关", detector[cFront].epcHeater);
                //savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", detector[cFront].epcHeaterTmpSet);
                savemethodconfig.WriteProfileInt(sAppName, "氢气燃气流量开关", detector[cFront].epcfHFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "氢气燃气流量设定值", detector[cFront].epcfHFlowSet);
                //savemethodconfig.WriteProfileInt(sAppName, "极性", detector[cFront].epcPolarity);
                //savemethodconfig.WriteProfileFloat(sAppName, "极性设定值", detector[cFront].epcPolaritySet);
                savemethodconfig.WriteProfileInt(sAppName, "尾吹气流量开关", detector[cFront].epcfTGFR);
                savemethodconfig.WriteProfileFloat(sAppName, "尾吹气流量设定值", detector[cFront].epcfTGFRSet);
                //}
            }
            else if (index == 1)
            {
                sAppName = "中检测器";
                //if (type == 0)
                //{
                savemethodconfig.WriteProfileInt(sAppName, "检测器类型", detector[cInter].epcType);
                savemethodconfig.WriteProfileInt(sAppName, "桥电流自动开关设定值", detector[cInter].epctAutoBridgeCurrentSet);
                savemethodconfig.WriteProfileFloat(sAppName, "桥电流设定值", detector[cInter].epctBridgeCurrentSet);
                savemethodconfig.WriteProfileFloat(sAppName, "电信号设定值", detector[cInter].epctElectricSignalSet);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", detector[cInter].epcHeaterTmpSet);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", detector[cInter].epcPolaritySet);
                savemethodconfig.WriteProfileFloat(sAppName, "参比气流量设定值", detector[cInter].epctRGFRSet);

                savemethodconfig.WriteProfileInt(sAppName, "桥电流自动开关", detector[cInter].epctAutoBridgeCurrent);
                savemethodconfig.WriteProfileInt(sAppName, "桥电流", detector[cInter].epctBridgeCurrent);
                savemethodconfig.WriteProfileInt(sAppName, "电信号开关", detector[cInter].epctElectricSignal);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", detector[cInter].epcHeater);
                savemethodconfig.WriteProfileInt(sAppName, "极性", detector[cInter].epcPolarity);
                //    savemethodconfig.WriteProfileInt(sAppName, "参比气流量开关", detector[cInter].epctRGFR);
                //}
                //else if (type == 1)
                //{
                //savemethodconfig.WriteProfileInt(sAppName, "检测器类型", detector[cInter].epcType);
                savemethodconfig.WriteProfileInt(sAppName, "空气流量开关", detector[cInter].epcfAirFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "空气流量设定值", detector[cInter].epcfAirFlowSet);
                savemethodconfig.WriteProfileInt(sAppName, "火焰", detector[cInter].epcfFlame);
                savemethodconfig.WriteProfileFloat(sAppName, "火焰设定值", detector[cInter].epcfFlameSet);
                //savemethodconfig.WriteProfileInt(sAppName, "加热器开关", detector[cInter].epcHeater);
                //savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", detector[cInter].epcHeaterTmpSet);
                savemethodconfig.WriteProfileInt(sAppName, "氢气燃气流量开关", detector[cInter].epcfHFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "氢气燃气流量设定值", detector[cInter].epcfHFlowSet);
                //savemethodconfig.WriteProfileInt(sAppName, "极性", detector[cInter].epcPolarity);
                //savemethodconfig.WriteProfileFloat(sAppName, "极性设定值", detector[cInter].epcPolaritySet);
                savemethodconfig.WriteProfileInt(sAppName, "尾吹气流量开关", detector[cInter].epcfTGFR);
                savemethodconfig.WriteProfileFloat(sAppName, "尾吹气流量设定值", detector[cInter].epcfTGFRSet);
                //}
            }
            else if (index == 2)
            {
                sAppName = "后检测器";
                //if (type == 0)
                //{
                savemethodconfig.WriteProfileInt(sAppName, "检测器类型", detector[cBehind].epcType);
                savemethodconfig.WriteProfileInt(sAppName, "桥电流自动开关设定值", detector[cBehind].epctAutoBridgeCurrentSet);
                savemethodconfig.WriteProfileFloat(sAppName, "桥电流设定值", detector[cBehind].epctBridgeCurrentSet);
                savemethodconfig.WriteProfileFloat(sAppName, "电信号设定值", detector[cBehind].epctElectricSignalSet);
                savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", detector[cBehind].epcHeaterTmpSet);
                savemethodconfig.WriteProfileInt(sAppName, "极性设定值", detector[cBehind].epcPolaritySet);
                savemethodconfig.WriteProfileFloat(sAppName, "参比气流量设定值", detector[cBehind].epctRGFRSet);

                savemethodconfig.WriteProfileInt(sAppName, "桥电流自动开关", detector[cBehind].epctAutoBridgeCurrent);
                savemethodconfig.WriteProfileInt(sAppName, "桥电流", detector[cBehind].epctBridgeCurrent);
                savemethodconfig.WriteProfileInt(sAppName, "电信号开关", detector[cBehind].epctElectricSignal);
                savemethodconfig.WriteProfileInt(sAppName, "加热器开关", detector[cBehind].epcHeater);
                savemethodconfig.WriteProfileInt(sAppName, "极性", detector[cBehind].epcPolarity);
                savemethodconfig.WriteProfileInt(sAppName, "参比气流量开关", detector[cBehind].epctRGFR);
                //}
                //else if (type == 1)
                //{
                //savemethodconfig.WriteProfileInt(sAppName, "检测器类型", detector[cBehind].epcType);
                savemethodconfig.WriteProfileInt(sAppName, "空气流量开关", detector[cBehind].epcfAirFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "空气流量设定值", detector[cBehind].epcfAirFlowSet);
                savemethodconfig.WriteProfileInt(sAppName, "火焰", detector[cBehind].epcfFlame);
                savemethodconfig.WriteProfileFloat(sAppName, "火焰设定值", detector[cBehind].epcfFlameSet);
                //savemethodconfig.WriteProfileInt(sAppName, "加热器开关", detector[cBehind].epcHeater);
                //savemethodconfig.WriteProfileFloat(sAppName, "加热器设定温度", detector[cBehind].epcHeaterTmpSet);
                savemethodconfig.WriteProfileInt(sAppName, "氢气燃气流量开关", detector[cBehind].epcfHFlow);
                savemethodconfig.WriteProfileFloat(sAppName, "氢气燃气流量设定值", detector[cBehind].epcfHFlowSet);
                //savemethodconfig.WriteProfileInt(sAppName, "极性", detector[cBehind].epcPolarity);
                //savemethodconfig.WriteProfileFloat(sAppName, "极性设定值", detector[cBehind].epcPolaritySet);
                savemethodconfig.WriteProfileInt(sAppName, "尾吹气流量开关", detector[cBehind].epcfTGFR);
                savemethodconfig.WriteProfileFloat(sAppName, "尾吹气流量设定值", detector[cBehind].epcfTGFRSet);
                //}
            }

            string strKey = "EPC1";
            savemethodconfig.WriteProfileFloat(strKey, "第一路流量设定值", epc[cFront].fristFlow);
            savemethodconfig.WriteProfileInt(strKey, "第一路载气类型", epc[cFront].gasType1);
            savemethodconfig.WriteProfileFloat(strKey, "第二路流量设定值", epc[cFront].SecondFlow);
            savemethodconfig.WriteProfileInt(strKey, "第二路载气类型", epc[cFront].gasType2);
            savemethodconfig.WriteProfileFloat(strKey, "第三路流量设定值", epc[cFront].ThirdFlow);
            savemethodconfig.WriteProfileFloat(strKey, "第三路载气类型", epc[cFront].gasType3);
        }


        /// <summary>
        /// 获取val配置
        /// </summary>
        public void GetValInjPortAllPara()
        {
            string strKey = "";
            ushort iDefault = 0;
            float fDefault = 0.0f;
            const int cFront = 0;

            strKey = "val进样口";

            val[cFront].valCarrierGasType = methodconfigini.GetProfileInt(strKey, "载气类型", iDefault);

            val[cFront].valCG1 = methodconfigini.GetProfileInt(strKey, "载气开关1", iDefault);
            val[cFront].valCG1Actual = methodconfigini.GetProfileFloat(strKey, "载气开关1时间", fDefault);
            val[cFront].valCG1BlowFlow = methodconfigini.GetProfileFloat(strKey, "载气开关1吹扫流量值", fDefault);
            val[cFront].valCG1UpFlowEndTime = methodconfigini.GetProfileFloat(strKey, "载气开关1程序升流结束时间", fDefault);
            val[cFront].valCG1UpFlowStartTime = methodconfigini.GetProfileFloat(strKey, "载气开关1程序升流开始时间", fDefault);

            val[cFront].valCG2 = methodconfigini.GetProfileInt(strKey, "载气开关2", iDefault);
            val[cFront].valCG2Actual = methodconfigini.GetProfileFloat(strKey, "载气开关2时间", fDefault);
            val[cFront].valCG2BlowFlow = methodconfigini.GetProfileFloat(strKey, "载气开关2吹扫流量值", fDefault);
            val[cFront].valCG2UpFlowEndTime = methodconfigini.GetProfileFloat(strKey, "载气开关2程序升流结束时间", fDefault);
            val[cFront].valCG2UpFlowStartTime = methodconfigini.GetProfileFloat(strKey, "载气开关2程序升流开始时间", fDefault);

            val[cFront].valCG3 = methodconfigini.GetProfileInt(strKey, "载气开关3", iDefault);
            val[cFront].valCG3Actual = methodconfigini.GetProfileFloat(strKey, "载气开关3时间", fDefault);
            val[cFront].valCG3BlowFlow = methodconfigini.GetProfileFloat(strKey, "载气开关3吹扫流量值", fDefault);
            val[cFront].valCG3UpFlowEndTime = methodconfigini.GetProfileFloat(strKey, "载气开关程序升流结束时间", fDefault);
            val[cFront].valCG3UpFlowStartTime = methodconfigini.GetProfileFloat(strKey, "载气开关3程序升流开始时间", fDefault);

            val[cFront].valCGColumn1Bore = methodconfigini.GetProfileFloat(strKey, "载气柱1口径", fDefault);
            val[cFront].valCGColumn1ColumnFlow = methodconfigini.GetProfileFloat(strKey, "载气柱1柱流量", fDefault);
            val[cFront].valCGColumn1Length = methodconfigini.GetProfileFloat(strKey, "载气柱1长度", fDefault);
            val[cFront].valCGColumn1Theca = methodconfigini.GetProfileFloat(strKey, "载气柱1膜厚", fDefault);

            val[cFront].valCGColumn2Bore = methodconfigini.GetProfileFloat(strKey, "载气柱2口径", fDefault);
            val[cFront].valCGColumn2ColumnFlow = methodconfigini.GetProfileFloat(strKey, "载气柱2柱流量", fDefault);
            val[cFront].valCGColumn2Length = methodconfigini.GetProfileFloat(strKey, "载气柱2长度", fDefault);
            val[cFront].valCGColumn2Theca = methodconfigini.GetProfileFloat(strKey, "载气柱2膜厚", fDefault);

            val[cFront].valCGColumn3Bore = methodconfigini.GetProfileFloat(strKey, "载气柱3口径", fDefault);
            val[cFront].valCGColumn3ColumnFlow = methodconfigini.GetProfileFloat(strKey, "载气柱3柱流量", fDefault);
            val[cFront].valCGColumn3Length = methodconfigini.GetProfileFloat(strKey, "载气柱3长度", fDefault);
            val[cFront].valCGColumn3Theca = methodconfigini.GetProfileFloat(strKey, "载气柱3膜厚", fDefault);

            val[cFront].valControlMode = methodconfigini.GetProfileInt(strKey, "控制方式", iDefault);
            val[cFront].valProtecttemp = methodconfigini.GetProfileFloat(strKey, "保护温度", fDefault);
            //val[cFront].valSamplePortType = methodconfigini.GetProfileString(strKey, "");




        }

        /// <summary>
        /// 设置val配置
        /// </summary>
        public void SetValInjPortAllPara()
        {
            string strKey = "";
            const int cFront = 0;

            strKey = "val进样口";

            savemethodconfig.WriteProfileInt(strKey, "载气类型", val[cFront].valCarrierGasType);

            savemethodconfig.WriteProfileInt(strKey, "载气开关1", val[cFront].valCG1);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关1时间", val[cFront].valCG1BlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关1吹扫流量值", val[cFront].valCG1Set);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关1程序升流结束时间", val[cFront].valCG1UpFlowEndTime);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关1程序升流开始时间", val[cFront].valCG1UpFlowStartTime);

            savemethodconfig.WriteProfileInt(strKey, "载气开关2", val[cFront].valCG2);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关2时间", val[cFront].valCG2BlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关2吹扫流量值", val[cFront].valCG2Set);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关2程序升流结束时间", val[cFront].valCG2UpFlowEndTime);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关2程序升流开始时间", val[cFront].valCG2UpFlowStartTime);

            savemethodconfig.WriteProfileInt(strKey, "载气开关3", val[cFront].valCG3);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关3时间", val[cFront].valCG3BlowFlow);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关3吹扫流量值", val[cFront].valCG3Set);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关3程序升流结束时间", val[cFront].valCG3UpFlowEndTime);
            savemethodconfig.WriteProfileFloat(strKey, "载气开关3程序升流开始时间", val[cFront].valCG3UpFlowStartTime);

            savemethodconfig.WriteProfileFloat(strKey, "载气柱1口径", val[cFront].valCGColumn1Bore);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱1柱流量", val[cFront].valCGColumn1ColumnFlow);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱1长度", val[cFront].valCGColumn1Length);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱1膜厚", val[cFront].valCGColumn1Theca);

            savemethodconfig.WriteProfileFloat(strKey, "载气柱2口径", val[cFront].valCGColumn2Bore);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱2柱流量", val[cFront].valCGColumn2ColumnFlow);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱2长度", val[cFront].valCGColumn2Length);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱2膜厚", val[cFront].valCGColumn2Theca);

            savemethodconfig.WriteProfileFloat(strKey, "载气柱3口径", val[cFront].valCGColumn3Bore);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱3柱流量", val[cFront].valCGColumn3ColumnFlow);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱3长度", val[cFront].valCGColumn3Length);
            savemethodconfig.WriteProfileFloat(strKey, "载气柱3膜厚", val[cFront].valCGColumn3Theca);

            savemethodconfig.WriteProfileFloat(strKey, "控制方式", val[cFront].valControlMode);
            savemethodconfig.WriteProfileFloat(strKey, "保护温度", val[cFront].valProtecttemp);
            //savemethodconfig.WriteProfileFloat(strKey, "", val[cFront].valSamplePortType);


        }


        /// <summary>
        /// 获取信号
        /// </summary>
        public void GetDevSignalAllPara()
        {
            ushort iDefault = 0;
            string sAppName = "信号";
            int i = 0;

            signal.u16ChannelA = methodconfigini.GetProfileInt(sAppName, "通道A", iDefault);
            signal.u16ChannelB = methodconfigini.GetProfileInt(sAppName, "通道B", iDefault);


            for (i = 0; i < MAX_CHANNEL_NUM; i++)
            {
                signal.uDetA[i] = methodconfigini.GetProfileInt(sAppName, "通道A检测器" + (i + 1).ToString(), iDefault);
                signal.uDetB[i] = methodconfigini.GetProfileInt(sAppName, "通道B检测器" + (i + 1).ToString(), iDefault);
            }

            for (i = 0; i < MAX_CHANNEL_NUM; i++)
            {
                signal.u16DetTimeLengthA[i] = methodconfigini.GetProfileInt(sAppName, "通道A检测时间" + (i + 1).ToString(), iDefault);
                signal.u16DetTimeLengthB[i] = methodconfigini.GetProfileInt(sAppName, "通道B检测时间" + (i + 1).ToString(), iDefault);
            }
        }

        /// <summary>
        /// 设置信号
        /// </summary>
        public void SetDevSignalAllPara()
        {
            string sAppName = "信号";
            int i = 0;

            savemethodconfig.WriteProfileInt(sAppName, "通道A", signal.u16ChannelA);
            savemethodconfig.WriteProfileInt(sAppName, "通道B", signal.u16ChannelB);

            for (i = 0; i < MAX_CHANNEL_NUM; i++)
            {
                savemethodconfig.WriteProfileInt(sAppName, "通道A检测器" + (i + 1).ToString(), signal.uDetA[i]);
                savemethodconfig.WriteProfileInt(sAppName, "通道B检测器" + (i + 1).ToString(), signal.uDetB[i]);
            }

            for (i = 0; i < MAX_CHANNEL_NUM; i++)
            {
                savemethodconfig.WriteProfileInt(sAppName, "通道A检测时间" + (i + 1).ToString(), signal.u16DetTimeLengthA[i]);
                savemethodconfig.WriteProfileInt(sAppName, "通道B检测时间" + (i + 1).ToString(), signal.u16DetTimeLengthB[i]);
            }
        }

        public void SaveMethodConfig(string filename)
        {
            savemethodconfig = new FileHelper(filename);

            if (System.IO.File.Exists(filename) == false)
            {
                System.IO.StreamWriter sw = new System.IO.StreamWriter(filename, false, System.Text.Encoding.Unicode);
                sw.WriteLine("[方法名称]");
                sw.Close();
            }
        }

    }
}
