Exemplo n.º 1
0
        private SampleDataBase GetObjectByAddress(SampDataType sampData, byte addres)
        {
            try
            {
                switch (addres)
                {
                case 0xA1:        //0xA6
                {
                    return(sampData.RawXianquanCurrent);
                }

                case 0xA2:         //0xA7
                {
                    return(sampData.RawMainDuankouVolatageA);
                }

                case 0xA3:         //0xA8
                {
                    return(sampData.RawMainDuankouVolatageB);
                }

                case 0xA4:         //0xA9
                {
                    return(sampData.RawMainDuankouVolatageC);
                }

                case 0xA5:        //0xA3
                {
                    return(sampData.RawMainCurrentA);
                }

                case 0xA6:        //0xA4
                {
                    return(sampData.RawMainCurrentB);
                }

                case 0xA7:       //0xA5
                {
                    return(sampData.RawMainCurrentC);
                }


                default:
                {
                    return(null);
                }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "由地址查找字符");
                return(null);
            }
        }
Exemplo n.º 2
0
        private SampleDataBase GetObjectByIndex(SampDataType sampData, string name)
        {
            try
            {
                switch (name)
                {
                case "主回路电压A":
                {
                    return(sampData.RawMainVolatageA);
                }

                case "主回路电压B":
                {
                    return(sampData.RawMainVolatageB);
                }

                case "主回路电压C":        //0xA3
                {
                    return(sampData.RawMainVolatageC);
                }

                case "主回路电流A":        //0xA4
                {
                    return(sampData.RawMainCurrentA);
                }

                case "主回路电流B":        //0xA5
                {
                    return(sampData.RawMainCurrentB);
                }

                case "主回路电流C":        //0xA6
                {
                    return(sampData.RawMainCurrentC);
                }

                case "断口电压A":         //0xA7
                {
                    return(sampData.RawMainDuankouVolatageA);
                }

                case "断口电压B":         //0xA8
                {
                    return(sampData.RawMainDuankouVolatageB);
                }

                case "断口电压C":         //0xA9
                {
                    return(sampData.RawMainDuankouVolatageC);
                }

                case "线圈电流":          //0xAA
                {
                    return(sampData.RawXianquanCurrent);
                }

                case "加速度":           //0xAB
                {
                    return(sampData.RawJiasuduA);
                }

                default:
                {
                    return(null);
                }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "由名称查找字符");
                return(null);
            }
        }