Beispiel #1
0
        public void Init_COM()
        {
            try
            {
                if (mainPanelForm.jcxxxb.FQFXYPZ != null)
                {
                    switch (mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[2])           //通过仪器型号选择初始化项目
                    {
                    case "MQW-50A":
                        try
                        {
                            UseFqy  = "MQW-50A";
                            mqw_50A = new Exhaust.MQW_50A();
                            if (mqw_50A.Init_Comm(mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0], mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[1]))
                            {
                                //mqw_50A.Auto_Zeroing();       //设置自动调零
                                Init_Flag = true;                   //初始化串口成功
                            }
                            else
                            {
                                mqw_50A            = null;
                                Init_Flag          = false;
                                toolStrip1.Enabled = false;
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            Init_Flag          = false;
                            toolStrip1.Enabled = false;
                        }
                        break;

                    case "FLA_502":
                        try
                        {
                            UseFqy  = "FLA_502";
                            fla_502 = new Exhaust.Fla502();
                            if (fla_502.Init_Comm(mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0], mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[1]))
                            {
                                //mqw_50A.Auto_Zeroing();       //设置自动调零
                                Init_Flag = true;                   //初始化串口成功
                            }
                            else
                            {
                                fla_502            = null;
                                Init_Flag          = false;
                                toolStrip1.Enabled = false;
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            toolStrip1.Enabled = false;
                        }
                        break;

                    case "FLA_501":
                        try
                        {
                            UseFqy  = "FLA_501";
                            fla_501 = new Exhaust.Fla501();
                            if (fla_501.Init_Comm(mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0], mainPanelForm.jcxxxb.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[1]))
                            {
                                //mqw_50A.Auto_Zeroing();       //设置自动调零
                                Init_Flag = true;                   //初始化串口成功
                            }
                            else
                            {
                                fla_501            = null;
                                Init_Flag          = false;
                                toolStrip1.Enabled = false;
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            toolStrip1.Enabled = false;
                        }
                        break;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("串口初始化失败,请检测相应设置", "出错啦");
                toolStrip1.Enabled = false;
            }
        }
Beispiel #2
0
        private void initEquipment()
        {
            bool   Init_flag    = true;
            string init_message = "";

            try
            {
                if (configdata.Fqyifpz == true)
                {
                    switch (configdata.Fqyxh.ToLower())           //通过仪器型号选择初始化项目
                    {
                    case "fla_502":
                        try
                        {
                            UseFqy  = "fla_502";
                            fla_502 = new Exhaust.Fla502(UseFqy);
                            if (fla_502.Init_Comm(configdata.Fqyck, "9600,N,8,1") == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "mqw_50a":
                        try
                        {
                            UseFqy  = "mqw_50a";
                            fla_502 = new Exhaust.Fla502(UseFqy);
                            if (fla_502.Init_Comm(configdata.Fqyck, "9600,N,8,1") == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fla_501":
                        try
                        {
                            UseFqy  = "fla_501";
                            fla_501 = new Exhaust.Fla501();
                            if (fla_501.Init_Comm(configdata.Fqyck, "9600,N,8,1") == false)
                            {
                                fla_501      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                            groupBox3.Enabled = false;    //如果是fla_501,则不提供零气和空气的调零选择
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_501   = null;
                            Init_flag = false;
                        }
                        break;

                    default: break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #3
0
        public void initEquipment()
        {
            bool   Init_flag    = true;
            string init_message = "";

            try
            {
                //checkBoxItemFqy.Checked = equipconfig.Fqyifpz;
                if (equipconfig.Fqyifpz == true)
                {
                    switch (equipconfig.Fqyxh.ToLower())           //通过仪器型号选择初始化项目
                    {
                    case "nha_503":
                        try
                        {
                            UseFqy              = "fla_502";
                            fla_502             = new Exhaust.Fla502(equipconfig.Fqyxh);
                            fla_502.isNhSelfUse = equipconfig.isFqyNhSelfUse;
                            if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "cdf5000":
                        try
                        {
                            UseFqy              = "fla_502";
                            fla_502             = new Exhaust.Fla502(equipconfig.Fqyxh);
                            fla_502.isNhSelfUse = equipconfig.isFqyNhSelfUse;
                            if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fla_502":
                        try
                        {
                            UseFqy  = "fla_502";
                            fla_502 = new Exhaust.Fla502(equipconfig.Fqyxh);
                            if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fasm_5000":
                        try
                        {
                            UseFqy  = "fasm_5000";
                            fla_502 = new Exhaust.Fla502(equipconfig.Fqyxh);
                            if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "mqw_50a":
                    case "mqw_50b":
                        try
                        {
                            UseFqy  = "mqw_50a";
                            fla_502 = new Exhaust.Fla502(equipconfig.Fqyxh);
                            if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "mqw_511":
                        try
                        {
                            UseFqy  = "mqw_511";
                            fla_502 = new Exhaust.Fla502(equipconfig.Fqyxh);
                            if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fla_501":
                        try
                        {
                            UseFqy  = "fla_501";
                            fla_501 = new Exhaust.Fla501();
                            if (fla_501.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false)
                            {
                                fla_501      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_501   = null;
                            Init_flag = false;
                        }
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #4
0
        public void initEquipment()
        {
            bool   Init_flag    = true;
            string init_message = "";

            try
            {
                if (configdata.Fqyifpz == true)
                {
                    switch (configdata.Fqyxh.ToLower())           //通过仪器型号选择初始化项目
                    {
                    case "nha_503":
                        try
                        {
                            UseFqy              = "fla_502";
                            fla_502             = new Exhaust.Fla502(configdata.Fqyxh);
                            fla_502.isNhSelfUse = configdata.isFqyNhSelfUse;
                            if (fla_502.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fla_502":
                        try
                        {
                            UseFqy  = "fla_502";
                            fla_502 = new Exhaust.Fla502(configdata.Fqyxh);
                            if (fla_502.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "cdf5000":
                        try
                        {
                            UseFqy  = "cdf5000";
                            fla_502 = new Exhaust.Fla502(configdata.Fqyxh);
                            if (fla_502.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "mqw_50a":
                    case "mqw_50b":
                        try
                        {
                            UseFqy  = "mqw_50a";
                            fla_502 = new Exhaust.Fla502(configdata.Fqyxh);
                            if (fla_502.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "mqw_511":
                        try
                        {
                            UseFqy  = "mqw_511";
                            fla_502 = new Exhaust.Fla502(configdata.Fqyxh);
                            if (fla_502.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fasm_5000":
                        try
                        {
                            UseFqy  = "fasm_5000";
                            fla_502 = new Exhaust.Fla502(configdata.Fqyxh);
                            if (fla_502.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_502      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_502   = null;
                            Init_flag = false;
                        }
                        break;

                    case "fla_501":
                        try
                        {
                            UseFqy  = "fla_501";
                            fla_501 = new Exhaust.Fla501();
                            if (fla_501.Init_Comm(configdata.Fqyck, configdata.Fqyckpzz) == false)
                            {
                                fla_501      = null;
                                Init_flag    = false;
                                init_message = "废气仪串口打开失败.";
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.ToString(), "出错啦");
                            fla_501   = null;
                            Init_flag = false;
                        }
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }

            //这里只初始化了废气分析仪其他设备要继续初始化
            try
            {
                if (configdata.Cgjifpz)
                {
                    try
                    {
                        igbt = new Dynamometer.IGBT("BNTD", configdata.isIgbtContainGdyk);
                        if (igbt.Init_Comm(configdata.Cgjck, configdata.cgjckpzz) == false)
                        {
                            igbt          = null;
                            Init_flag     = false;
                            init_message += "测功机串口打开失败.";
                        }
                    }
                    catch (Exception er)
                    {
                        igbt      = null;
                        Init_flag = false;
                        MessageBox.Show(er.ToString(), "出错啦");
                    }
                }
            }
            catch (Exception)
            {
            }
            try
            {
                if (configdata.Ydjifpz == true && configdata.Ydjxh != "CDF5000")
                {
                    try
                    {
                        flb_100             = new Exhaust.FLB_100(configdata.Ydjxh);
                        flb_100.isNhSelfUse = configdata.isYdjNhSelfUse;
                        if (flb_100.Init_Comm(configdata.Ydjck, configdata.Ydjckpzz) == false)
                        {
                            flb_100       = null;
                            Init_flag     = false;
                            init_message += "烟度计串口打开失败.";
                        }
                    }
                    catch (Exception er)
                    {
                        flb_100   = null;
                        Init_flag = false;
                        MessageBox.Show(er.ToString(), "出错啦");
                    }
                }
            }
            catch (Exception)
            {
            }
            try
            {
                if (configdata.Lljifpz == true)
                {
                    try
                    {
                        flv_1000             = new Exhaust.Flv_1000();
                        flv_1000.isNhSelfUse = configdata.isLljNhSelfUse;
                        if (flv_1000.Init_Comm(configdata.Lljck, configdata.Lljckpzz) == false)
                        {
                            flv_1000      = null;
                            Init_flag     = false;
                            init_message += "流量计串口打开失败.";
                        }
                    }
                    catch (Exception er)
                    {
                        flv_1000  = null;
                        Init_flag = false;
                        MessageBox.Show(er.ToString(), "出错啦");
                    }
                }
            }
            catch (Exception)
            {
                flv_1000  = null;
                Init_flag = false;
            }
            try
            {
                if (configdata.BpqMethod == "串口")
                {
                    try
                    {
                        bpq = new bpxcontrol(configdata.BpqXh);
                        if (bpq.Init_Comm(configdata.BpqCom, configdata.BpqComPz) == false)
                        {
                            bpq           = null;
                            Init_flag     = false;
                            init_message += "变频器串口打开失败.";
                        }
                    }
                    catch (Exception er)
                    {
                        bpq       = null;
                        Init_flag = false;
                        MessageBox.Show(er.ToString(), "出错啦");
                    }
                }
            }
            catch (Exception)
            {
                bpq       = null;
                Init_flag = false;
            }
        }