Beispiel #1
0
 public TcpBug(string bug)
 {
     bug           = bug.Replace("0x", string.Empty).Replace(" ", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty);
     deviceAddress = SystemCode.HexNumberToDenary(bug.Substring(0, 1 * 2), true, 32, 'u').ToString();
     faultType     = (int)SystemCode.HexNumberToDenary(bug.Substring(1 * 2, 2 * 2), false, 16, 'u');
     faultTime     = new DateTime(2000 + (int)SystemCode.HexNumberToDenary(bug.Substring(3 * 2, 1 * 2), true, 32, 'u'),
                                  (int)SystemCode.HexNumberToDenary(bug.Substring(4 * 2, 1 * 2), true, 32, 'u'),
                                  (int)SystemCode.HexNumberToDenary(bug.Substring(5 * 2, 1 * 2), true, 32, 'u'),
                                  (int)SystemCode.HexNumberToDenary(bug.Substring(6 * 2, 1 * 2), true, 32, 'u'),
                                  (int)SystemCode.HexNumberToDenary(bug.Substring(7 * 2, 1 * 2), true, 32, 'u'),
                                  (int)SystemCode.HexNumberToDenary(bug.Substring(8 * 2, 1 * 2), true, 32, 'u'));
 }
Beispiel #2
0
        int deviceDataHeadLength = 5;//5字节
        /// <summary>
        /// 根据逆变器modbus协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //最大接入路数
            int MAXLINE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_MAXLINE] = MAXLINE;
            //机内温度0.1℃
            double JNTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            JNTEMPRATURE = Math.Round(JNTEMPRATURE * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_JNTEMPRATURE] = JNTEMPRATURE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_JNTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_JNTEMPRATURE] = JNTEMPRATURE;
            }
            //直流母线电压0.1V
            double DCUXVOLT = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            DCUXVOLT = Math.Round(DCUXVOLT * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_DCUXVOLT] = DCUXVOLT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DCUXVOLT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DCUXVOLT] = DCUXVOLT;
            }
            //数字输入
            int ATAINPUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DIGITALINPUT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            }

            //第一路电流0.01A
            double CURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(18 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT1 = Math.Round(CURRENT1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_1CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            }
            //第二路电流0.01A
            double CURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT2 = Math.Round(CURRENT2 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_2CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            }
            //第三路电流0.01A
            double CURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT3 = Math.Round(CURRENT3 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_3CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            }
            //第四路电流0.01A
            double CURRENT4 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT4 = Math.Round(CURRENT4 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_4CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            }

            //第五路电流0.01A
            double CURRENT5 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_5CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            }
            //第六路电流0.01A
            double CURRENT6 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT6 = Math.Round(CURRENT6 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_6CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            }
            //第七路电流0.01A
            double CURRENT7 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT7 = Math.Round(CURRENT7 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_7CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            }
            //第八路电流0.01A
            double CURRENT8 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT8 = Math.Round(CURRENT8 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_8CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            }

            //第九路电流0.01A
            double CURRENT9 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT9 = Math.Round(CURRENT9 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_9CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            }

            //第十路电流0.01A
            double CURRENT10 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT10 = Math.Round(CURRENT10 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_10CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            }
            //第十一路电流0.01A
            double CURRENT11 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT11 = Math.Round(CURRENT11 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_11CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            }
            //第十二路电流0.01A
            double CURRENT12 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT12 = Math.Round(CURRENT12 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_12CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            }
            //第十三路电流0.01A
            double CURRENT13 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT13 = Math.Round(CURRENT13 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_13CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            }
            //第十四路电流0.01A
            double CURRENT14 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT14 = Math.Round(CURRENT14 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_14CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            }

            // 第十五路电流0.01A
            double CURRENT15 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT15 = Math.Round(CURRENT15 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_15CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            }

            // 第十六路电流0.01A
            double CURRENT16 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT16 = Math.Round(CURRENT16 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_16CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            }

            //总电流
            double totalC = CURRENT1 + CURRENT2 + CURRENT3 + CURRENT4 + CURRENT5
                            + CURRENT6 + CURRENT7 + CURRENT8 + CURRENT9 + CURRENT10 + CURRENT11 + CURRENT12 +
                            +CURRENT13 + CURRENT14 + CURRENT15 + CURRENT16;

            realMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT]    = totalC;
            historyMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT] = totalC;

            deviceType = TableUtil.HUILIUXIANG;
        }
Beispiel #3
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据电表协议解析单个设备数据
        /// Rx为采样值, Ubb为电压互感比(电压变比),Ibb为电流互感比(电流变比)
        /// 适用参量
        /// 对应关系
        /// 电压V1,V2,V3
        /// U=Rx×Ubb
        /// 电流I1,I2,I3
        /// I=Rx×Ibb
        /// 有功功率P1,P2,P3,Psum
        /// P=Rx×Ubb×Ibb
        /// 无功功率Q1,Q2,Q3,Qsum
        /// Q=Rx×Ubb×Ibb
        /// 视在功率S1,S2,S3,Ssum
        /// S=Rx×Ubb×Ibb
        /// 有功电度
        /// Ep=Rx×Ubb×Ibb
        /// 无功电度
        /// Eq=Rx×Ubb×Ibb
        /// </summary>
        public void analysis()
        {
            //deviceData = "20 B0 02 00 01 00 00 02 00 02 00 00 08 66 08 A2 09 06 00 6E 00 05 00 15 23 32 03 20 00 0A 27 10 24 F9 00 01 14 50 00 00 00 01 00 00 07 E4 00 00 03 E8 00 00 C7 38 00 00 52 6C 00 00 CB 20 00 00 24 FF 00 01 C8 40 00 00 52 6B 00 00 CB 47 00 00 27 0D 00 00 14 51 00 00 13 B7 00 00 00 33 00 00 00 2F 00 00 00 0A 00 00 00 11 00 00 00 0A 00 00 0B E7 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 04 17 00 00 00 79 00 00 04 7B 00 00 00 0B 00 00 20 9B 00 00 13 ED 00 00 0F CF 00 00 00 15 00 00 64 01 02 00 00 00 28 00 96 00 01 01 2D 0B B8 00 00 00 46 00 00 00 DF 00 F2 00 FB 0E D8 01 8A 0E E4 01 89 0E EF 01 88 3A 83 00 00 08 98 08 A3 08 9D 02 AA 02 A6 02 A8 3A 9C 00 00 3A 8E 00 00 3A 92 00 00 AF AE 00 00 00 5A 00 00 03 E6 01 F4 03 E5 00 00 07 DA 00 0C 00 1F 00 08 00 08 00 08 00 00 00 00 00 00";
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //电表地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);//"20B002000100000200020000086608A20906006E0005001523320320000A271024F90001145000000001000007E4000003E80000C7380000526C0000CB20000024FF0001C8400000526B0000CB470000270D00001451000013B7000000330000002F0000000A000000110000000A00000BE7000000000000001B0000000000000417000000790000047B0000000B0000209B000013ED00000FCF0000001500006401020000002800960001012D0BB800000046000000DF00F200FB0ED8018A0EE401890EEF01883A830000089808A3089D02AA02A602A83A9C00003A8E00003A920000AFAE0000005A000003E601F403E5000007DA000C001F000800080008000000000000";
            //电压变比 u16
            string valuestr = monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum);
            int    dybb     = (int)SystemCode.HexNumberToDenary(valuestr, false, 16, 'u');

            //电流变比 u16
            valuestr = monitorstr.Substring(8 * hexbytecharnum, 2 * hexbytecharnum);
            int dlbb = (int)SystemCode.HexNumberToDenary(valuestr, false, 16, 'u');

            //系统频率F 0.01Hz u16
            valuestr = monitorstr.Substring(10 * hexbytecharnum, 2 * hexbytecharnum);
            double SYSFREQUENCY = (double)SystemCode.HexNumberToDenary(valuestr, false, 16, 'u');

            SYSFREQUENCY = Math.Round(SYSFREQUENCY * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSFREQUENCY] = SYSFREQUENCY;

            //相电压V1 0.1V U16 电压V1,V2,V3
            /// U=Rx×Ubb
            valuestr = monitorstr.Substring(12 * hexbytecharnum, 2 * hexbytecharnum);
            double PHASEVOLTAGE1 = (double)SystemCode.HexNumberToDenary(valuestr, false, 16, 'u');

            PHASEVOLTAGE1 = PHASEVOLTAGE1 * dybb;
            PHASEVOLTAGE1 = Math.Round(PHASEVOLTAGE1 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE1] = PHASEVOLTAGE1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEVOLTAGE1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE1] = PHASEVOLTAGE1;
            }

            //相电压V2 0.1V U16
            double PHASEVOLTAGE2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(14 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASEVOLTAGE2 = PHASEVOLTAGE2 * dybb;
            PHASEVOLTAGE2 = Math.Round(PHASEVOLTAGE2 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE2] = PHASEVOLTAGE2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEVOLTAGE2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE2] = PHASEVOLTAGE2;
            }

            //相电压V3 0.1V U16
            double PHASEVOLTAGE3 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASEVOLTAGE3 = PHASEVOLTAGE3 * dybb;
            PHASEVOLTAGE3 = Math.Round(PHASEVOLTAGE3 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE3] = PHASEVOLTAGE3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEVOLTAGE3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE3] = PHASEVOLTAGE3;
            }

            //相(线)电流I1  0.01A U16
            double PHASECURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(18 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASECURRENT1 = PHASECURRENT1 * dlbb;
            PHASECURRENT1 = Math.Round(PHASECURRENT1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT1] = PHASECURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASECURRENT1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT1] = PHASECURRENT1;
            }

            //相(线)电流I2  0.01A U16
            double PHASECURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASECURRENT2 = PHASECURRENT2 * dlbb;
            PHASECURRENT2 = Math.Round(PHASECURRENT2 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT2] = PHASECURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASECURRENT2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT2] = PHASECURRENT2;
            }

            //相(线)电流I3  0.01A U16
            double PHASECURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASECURRENT3 = PHASECURRENT3 * dlbb;
            PHASECURRENT3 = Math.Round(PHASECURRENT3 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT3] = PHASECURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASECURRENT3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT3] = PHASECURRENT3;
            }

            //分相功率因数PF1 S16 0.0001
            double PHASEPOWERFACTOR1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PHASEPOWERFACTOR1 = Math.Round(PHASEPOWERFACTOR1 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR1] = PHASEPOWERFACTOR1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEPOWERFACTOR1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR1] = PHASEPOWERFACTOR1;
            }
            //分相功率因数PF2 S16 0.0001
            double PHASEPOWERFACTOR2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PHASEPOWERFACTOR2 = Math.Round(PHASEPOWERFACTOR2 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR2] = PHASEPOWERFACTOR2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEPOWERFACTOR2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR2] = PHASEPOWERFACTOR2;
            }
            //分相功率因数PF3 S16 0.0001
            double PHASEPOWERFACTOR3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PHASEPOWERFACTOR3 = Math.Round(PHASEPOWERFACTOR3 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR3] = PHASEPOWERFACTOR3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEPOWERFACTOR3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR3] = PHASEPOWERFACTOR3;
            }
            //系统功率因数PF S16 0.0001
            double SYSPOWERFACTOR1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            SYSPOWERFACTOR1 = Math.Round(SYSPOWERFACTOR1 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSPOWERFACTOR1] = SYSPOWERFACTOR1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSPOWERFACTOR1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSPOWERFACTOR1] = SYSPOWERFACTOR1;
            }

            //分相有功功率P1 s32 0.1W
            //有功功率P1,P2,P3,Psum
            //P=Rx×Ubb×Ibb
            double PHASEACTIVEPOWER1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            PHASEACTIVEPOWER1 = PHASEACTIVEPOWER1 * dybb * dlbb;
            PHASEACTIVEPOWER1 = Math.Round(PHASEACTIVEPOWER1 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER1] = PHASEACTIVEPOWER1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEACTIVEPOWER1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER1] = PHASEACTIVEPOWER1;
            }

            //分相有功功率P2 s32 0.1W
            double PHASEACTIVEPOWER2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            PHASEACTIVEPOWER2 = PHASEACTIVEPOWER2 * dybb * dlbb;
            PHASEACTIVEPOWER2 = Math.Round(PHASEACTIVEPOWER2 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER2] = PHASEACTIVEPOWER2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEACTIVEPOWER2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER2] = PHASEACTIVEPOWER2;
            }

            //分相有功功率P3 s32 0.1W
            double PHASEACTIVEPOWER3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            PHASEACTIVEPOWER3 = PHASEACTIVEPOWER3 * dybb * dlbb;
            PHASEACTIVEPOWER3 = Math.Round(PHASEACTIVEPOWER3 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER3] = PHASEACTIVEPOWER3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEACTIVEPOWER3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER3] = PHASEACTIVEPOWER3;
            }

            //系统有功功率Psum s32 0.1W
            double SYSACTIVEPOWER = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            SYSACTIVEPOWER = SYSACTIVEPOWER * dybb * dlbb;
            SYSACTIVEPOWER = Math.Round(SYSACTIVEPOWER * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSACTIVEPOWER] = SYSACTIVEPOWER;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSACTIVEPOWER))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSACTIVEPOWER] = SYSACTIVEPOWER;
            }

            //分相无功功率Q1 0.1Var S32
            double PHASEREACTIVEPOWER1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            PHASEREACTIVEPOWER1 = PHASEREACTIVEPOWER1 * dybb * dlbb;
            PHASEREACTIVEPOWER1 = Math.Round(PHASEREACTIVEPOWER1 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER1] = PHASEREACTIVEPOWER1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER1] = PHASEREACTIVEPOWER1;
            }
            //分相无功功率Q2 0.1ar S32
            double PHASEREACTIVEPOWER2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(52 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            PHASEREACTIVEPOWER2 = PHASEREACTIVEPOWER2 * dybb * dlbb;
            PHASEREACTIVEPOWER2 = Math.Round(PHASEREACTIVEPOWER2 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER2] = PHASEREACTIVEPOWER2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER2] = PHASEREACTIVEPOWER2;
            }
            //分相无功功率Q3 0.1Var S32
            double PHASEREACTIVEPOWER3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(56 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            PHASEREACTIVEPOWER3 = PHASEREACTIVEPOWER3 * dybb * dlbb;
            PHASEREACTIVEPOWER3 = Math.Round(PHASEREACTIVEPOWER3 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER3] = PHASEREACTIVEPOWER3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER3] = PHASEREACTIVEPOWER3;
            }

            //系统无功功率Qsum S32 0.1Var
            double SYSREACTIVEPOWER = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(60 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            SYSREACTIVEPOWER = SYSREACTIVEPOWER * dybb * dlbb;
            SYSREACTIVEPOWER = Math.Round(SYSREACTIVEPOWER * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSREACTIVEPOWER] = SYSREACTIVEPOWER;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSREACTIVEPOWER))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSREACTIVEPOWER] = SYSREACTIVEPOWER;
            }

            //分相视在功率S1 U32 0.1VA
            //视在功率S1,S2,S3,Ssum
            //S=Rx×Ubb×Ibb
            double PHASEAPPARENTPOWER1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(64 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            PHASEAPPARENTPOWER1 = PHASEAPPARENTPOWER1 * dybb * dlbb;
            PHASEAPPARENTPOWER1 = Math.Round(PHASEAPPARENTPOWER1 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER1] = PHASEAPPARENTPOWER1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER1] = PHASEAPPARENTPOWER1;
            }
            //分相视在功率S2 U32 0.1VA
            double PHASEAPPARENTPOWER2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(68 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            PHASEAPPARENTPOWER2 = PHASEAPPARENTPOWER2 * dybb * dlbb;
            PHASEAPPARENTPOWER2 = Math.Round(PHASEAPPARENTPOWER2 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER2] = PHASEAPPARENTPOWER2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER2] = PHASEAPPARENTPOWER2;
            }
            //分相视在功率S1 U32 0.1VA
            double PHASEAPPARENTPOWER3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(72 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            PHASEAPPARENTPOWER3 = PHASEAPPARENTPOWER3 * dybb * dlbb;
            PHASEAPPARENTPOWER3 = Math.Round(PHASEAPPARENTPOWER3 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER3] = PHASEAPPARENTPOWER3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER3] = PHASEAPPARENTPOWER3;
            }

            //系统视在功率Ssum U32 0.1VA
            double _SYSAPPARENTPOWER = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(76 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            _SYSAPPARENTPOWER = _SYSAPPARENTPOWER * dybb * dlbb;
            _SYSAPPARENTPOWER = Math.Round(_SYSAPPARENTPOWER * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSAPPARENTPOWER] = _SYSAPPARENTPOWER;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSAPPARENTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSAPPARENTPOWER] = _SYSAPPARENTPOWER;
            }

            //正向有功电度 U32 0.01kWh
            //有功电度
            //Ep=Rx×Ubb×Ibb
            double POSITIVEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(80 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            POSITIVEACTIVEPOWERDEGREE = POSITIVEACTIVEPOWERDEGREE * dybb * dlbb;
            POSITIVEACTIVEPOWERDEGREE = Math.Round(POSITIVEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE] = POSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE] = POSITIVEACTIVEPOWERDEGREE;
            }
            //反向有功电度 U32 0.01kWh
            double REVERSEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(84 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            REVERSEACTIVEPOWERDEGREE = REVERSEACTIVEPOWERDEGREE * dybb * dlbb;
            REVERSEACTIVEPOWERDEGREE = Math.Round(REVERSEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_REVERSEACTIVEPOWERDEGREE] = REVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_REVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_REVERSEACTIVEPOWERDEGREE] = REVERSEACTIVEPOWERDEGREE;
            }
            //正向无功电度 U32 0.01kVarh
            double _POSITIVEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(88 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            _POSITIVEREACTIVEPOWERDEGREE = _POSITIVEREACTIVEPOWERDEGREE * dybb * dlbb;
            _POSITIVEREACTIVEPOWERDEGREE = Math.Round(_POSITIVEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_POSITIVEREACTIVEPOWERDEGREE] = _POSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_POSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_POSITIVEREACTIVEPOWERDEGREE] = _POSITIVEREACTIVEPOWERDEGREE;
            }
            //反向无功电度 U32 0.01kVarh
            double REVERSEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(92 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            REVERSEREACTIVEPOWERDEGREE = REVERSEREACTIVEPOWERDEGREE * dybb * dlbb;
            REVERSEREACTIVEPOWERDEGREE = Math.Round(REVERSEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_REVERSEREACTIVEPOWERDEGREE] = REVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_REVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_REVERSEREACTIVEPOWERDEGREE] = REVERSEREACTIVEPOWERDEGREE;
            }

            //1.1没有这些测点值
            ////绝对值和有功电度 U32 kWh
            //int ABSOLUTEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(88 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');
            //realMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEACTIVEPOWERDEGREE] = ABSOLUTEACTIVEPOWERDEGREE;
            //if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_ABSOLUTEACTIVEPOWERDEGREE))
            //    historyMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEACTIVEPOWERDEGREE] = ABSOLUTEACTIVEPOWERDEGREE;
            ////净有功电度 U32 kWh
            //int PUREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(92 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');
            //realMonitorMap[MonitorType.MIC_AMMETER_PUREACTIVEPOWERDEGREE] = PUREACTIVEPOWERDEGREE;
            //if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PUREACTIVEPOWERDEGREE))
            //    historyMonitorMap[MonitorType.MIC_AMMETER_PUREACTIVEPOWERDEGREE] = PUREACTIVEPOWERDEGREE;
            ////绝对值和无功电度 U32 kVarh
            //int ABSOLUTEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(96 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');
            //realMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEREACTIVEPOWERDEGREE] = ABSOLUTEREACTIVEPOWERDEGREE;
            //if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_ABSOLUTEREACTIVEPOWERDEGREE))
            //    historyMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEREACTIVEPOWERDEGREE] = ABSOLUTEREACTIVEPOWERDEGREE;
            ////净无功电度 U32 kVarh
            //int PUREREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(100 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');
            //realMonitorMap[MonitorType.MIC_AMMETER_PUREREACTIVEPOWERDEGREE] = PUREREACTIVEPOWERDEGREE;
            //if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PUREREACTIVEPOWERDEGREE))
            //    historyMonitorMap[MonitorType.MIC_AMMETER_PUREREACTIVEPOWERDEGREE] = PUREREACTIVEPOWERDEGREE;


            // 费率波正向有功电度 U32 0.01kWh
            double WAVERATEPOSITIVEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(96 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            WAVERATEPOSITIVEACTIVEPOWERDEGREE = WAVERATEPOSITIVEACTIVEPOWERDEGREE * dybb * dlbb;
            WAVERATEPOSITIVEACTIVEPOWERDEGREE = Math.Round(WAVERATEPOSITIVEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEACTIVEPOWERDEGREE] = WAVERATEPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEACTIVEPOWERDEGREE] = WAVERATEPOSITIVEACTIVEPOWERDEGREE;
            }
            // 费率波反向有功电度 U32 0.01kWh
            double WAVERATEREVERSEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(100 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            WAVERATEREVERSEACTIVEPOWERDEGREE = WAVERATEREVERSEACTIVEPOWERDEGREE * dybb * dlbb;
            WAVERATEREVERSEACTIVEPOWERDEGREE = Math.Round(WAVERATEREVERSEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEACTIVEPOWERDEGREE] = WAVERATEREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEACTIVEPOWERDEGREE] = WAVERATEREVERSEACTIVEPOWERDEGREE;
            }
            // 费率波正向无功电度 U32 0.01kVarh
            double WAVERATEPOSITIVEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(104 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            WAVERATEPOSITIVEREACTIVEPOWERDEGREE = WAVERATEPOSITIVEREACTIVEPOWERDEGREE * dybb * dlbb;
            WAVERATEPOSITIVEREACTIVEPOWERDEGREE = Math.Round(WAVERATEPOSITIVEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEREACTIVEPOWERDEGREE] = WAVERATEPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEREACTIVEPOWERDEGREE] = WAVERATEPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率波反向无功电度 U32 0.01kVarh
            double WAVERATEREVERSEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(108 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            WAVERATEREVERSEREACTIVEPOWERDEGREE = WAVERATEREVERSEREACTIVEPOWERDEGREE * dybb * dlbb;
            WAVERATEREVERSEREACTIVEPOWERDEGREE = Math.Round(WAVERATEREVERSEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEREACTIVEPOWERDEGREE] = WAVERATEREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEREACTIVEPOWERDEGREE] = WAVERATEREVERSEREACTIVEPOWERDEGREE;
            }

            // 费率峰正向有功电度 U32 0.01kWh
            double RATEPEAKPOSITIVEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(112 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEPEAKPOSITIVEACTIVEPOWERDEGREE = RATEPEAKPOSITIVEACTIVEPOWERDEGREE * dybb * dlbb;
            RATEPEAKPOSITIVEACTIVEPOWERDEGREE = Math.Round(RATEPEAKPOSITIVEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEACTIVEPOWERDEGREE;
            }
            // 费率峰反向有功度 U32 0.01kWh
            double RATEPEAKREVERSEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(116 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEPEAKREVERSEACTIVEPOWERDEGREE = RATEPEAKREVERSEACTIVEPOWERDEGREE * dybb * dlbb;
            RATEPEAKREVERSEACTIVEPOWERDEGREE = Math.Round(RATEPEAKREVERSEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEACTIVEPOWERDEGREE] = RATEPEAKREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEACTIVEPOWERDEGREE] = RATEPEAKREVERSEACTIVEPOWERDEGREE;
            }
            // 费率峰正向无功电度 U32 0.01kVarh
            double RATEPEAKPOSITIVEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(120 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEPEAKPOSITIVEREACTIVEPOWERDEGREE = RATEPEAKPOSITIVEREACTIVEPOWERDEGREE * dybb * dlbb;
            RATEPEAKPOSITIVEREACTIVEPOWERDEGREE = Math.Round(RATEPEAKPOSITIVEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEREACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEREACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率峰反向无功电度 U32 0.01kVarh
            double RATEPEAKREVERSEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(124 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEPEAKREVERSEREACTIVEPOWERDEGREE = RATEPEAKREVERSEREACTIVEPOWERDEGREE * dybb * dlbb;
            RATEPEAKREVERSEREACTIVEPOWERDEGREE = Math.Round(RATEPEAKREVERSEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEREACTIVEPOWERDEGREE] = RATEPEAKREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEREACTIVEPOWERDEGREE] = RATEPEAKREVERSEREACTIVEPOWERDEGREE;
            }

            // 费率谷正向有功电度 U32 0.01kWh
            double RATEVALLEYPOSITIVEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(128 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEVALLEYPOSITIVEACTIVEPOWERDEGREE = RATEVALLEYPOSITIVEACTIVEPOWERDEGREE * dybb * dlbb;
            RATEVALLEYPOSITIVEACTIVEPOWERDEGREE = Math.Round(RATEVALLEYPOSITIVEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEACTIVEPOWERDEGREE;
            }
            //  费率谷反向有功电度 U32 kWh
            double RATEVALLEYREVERSEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(132 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEVALLEYREVERSEACTIVEPOWERDEGREE = RATEVALLEYREVERSEACTIVEPOWERDEGREE * dybb * dlbb;
            RATEVALLEYREVERSEACTIVEPOWERDEGREE = Math.Round(RATEVALLEYREVERSEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEACTIVEPOWERDEGREE] = RATEVALLEYREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEACTIVEPOWERDEGREE] = RATEVALLEYREVERSEACTIVEPOWERDEGREE;
            }
            // 费率谷正向无功电度 U32 0.01kVarh
            double RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(136 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE = RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE * dybb * dlbb;
            RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE = Math.Round(RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率谷反向无功电度 U32 0.01kVarh
            double RATEVALLEYREVERSEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(140 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATEVALLEYREVERSEREACTIVEPOWERDEGREE = RATEVALLEYREVERSEREACTIVEPOWERDEGREE * dybb * dlbb;
            RATEVALLEYREVERSEREACTIVEPOWERDEGREE = Math.Round(RATEVALLEYREVERSEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEREACTIVEPOWERDEGREE] = RATEVALLEYREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEREACTIVEPOWERDEGREE] = RATEVALLEYREVERSEREACTIVEPOWERDEGREE;
            }

            // 费率平正向有功电度 U32 0.01kWh
            double RATELEVELPOSITIVEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(144 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATELEVELPOSITIVEACTIVEPOWERDEGREE = RATELEVELPOSITIVEACTIVEPOWERDEGREE * dybb * dlbb;
            RATELEVELPOSITIVEACTIVEPOWERDEGREE = Math.Round(RATELEVELPOSITIVEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEACTIVEPOWERDEGREE] = RATELEVELPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEACTIVEPOWERDEGREE] = RATELEVELPOSITIVEACTIVEPOWERDEGREE;
            }
            // 费率平反向有功电度 U32 0.01kWh
            double RATELEVELREVERSEACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(148 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATELEVELREVERSEACTIVEPOWERDEGREE = RATELEVELREVERSEACTIVEPOWERDEGREE * dybb * dlbb;
            RATELEVELREVERSEACTIVEPOWERDEGREE = Math.Round(RATELEVELREVERSEACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEACTIVEPOWERDEGREE] = RATELEVELREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEACTIVEPOWERDEGREE] = RATELEVELREVERSEACTIVEPOWERDEGREE;
            }
            // 费率平正向无功电度 U32 0.01kVarh
            double RATELEVELPOSITIVEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(152 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATELEVELPOSITIVEREACTIVEPOWERDEGREE = RATELEVELPOSITIVEREACTIVEPOWERDEGREE * dybb * dlbb;
            RATELEVELPOSITIVEREACTIVEPOWERDEGREE = Math.Round(RATELEVELPOSITIVEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEREACTIVEPOWERDEGREE] = RATELEVELPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEREACTIVEPOWERDEGREE] = RATELEVELPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率平反向无功电度 U32 0.01kVarh
            double RATELEVELREVERSEREACTIVEPOWERDEGREE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(156 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            RATELEVELREVERSEREACTIVEPOWERDEGREE = RATELEVELREVERSEREACTIVEPOWERDEGREE * dybb * dlbb;
            RATELEVELREVERSEREACTIVEPOWERDEGREE = Math.Round(RATELEVELREVERSEREACTIVEPOWERDEGREE * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEREACTIVEPOWERDEGREE] = RATELEVELREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEREACTIVEPOWERDEGREE] = RATELEVELREVERSEREACTIVEPOWERDEGREE;
            }

            tableType = TableUtil.AMMETER;
        }
Beispiel #4
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据电表协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData = "AC0B41010000E61387093D0941094000F000E800E515CC00001522000014EB00003FCF000003CF000003840000032000000A6E000016210000156D00001527000040A100002679268726A1269190F80000001A0000174D0000000000009112000090DD0000174D0000174D0000001E00000005000002550000000000001E1400000000000002E4000000000000014B0000000A00000410000000000000717A0000000B00000E05000000000000";
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //电表无地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            string valuestr   = monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum);
            //系统频率F 0.01Hz
            double SYSFREQUENCY = (double)SystemCode.HexNumberToDenary(valuestr, false, 16, 'u');

            SYSFREQUENCY = Math.Round(SYSFREQUENCY * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSFREQUENCY] = SYSFREQUENCY;

            //相电压V1 0.1V U16
            valuestr = monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum);
            double PHASEVOLTAGE1 = (double)SystemCode.HexNumberToDenary(valuestr, false, 16, 'u');

            PHASEVOLTAGE1 = Math.Round(PHASEVOLTAGE1 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE1] = PHASEVOLTAGE1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEVOLTAGE1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE1] = PHASEVOLTAGE1;
            }

            //相电压V2 0.1V U16
            double PHASEVOLTAGE2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASEVOLTAGE2 = Math.Round(PHASEVOLTAGE2 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE2] = PHASEVOLTAGE2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEVOLTAGE2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE2] = PHASEVOLTAGE2;
            }

            //相电压V3 0.1V U16
            double PHASEVOLTAGE3 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASEVOLTAGE3 = Math.Round(PHASEVOLTAGE3 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE3] = PHASEVOLTAGE3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEVOLTAGE3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEVOLTAGE3] = PHASEVOLTAGE3;
            }

            //相(线)电流I1  0.1A U16
            double PHASECURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(10 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASECURRENT1 = Math.Round(PHASECURRENT1 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT1] = PHASECURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASECURRENT1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT1] = PHASECURRENT1;
            }

            //相(线)电流I2  0.1A U16
            double PHASECURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASECURRENT2 = Math.Round(PHASECURRENT2 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT2] = PHASECURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASECURRENT2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT2] = PHASECURRENT2;
            }

            //相(线)电流I3  0.1A U16
            double PHASECURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(14 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            PHASECURRENT3 = Math.Round(PHASECURRENT3 * 0.1, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT3] = PHASECURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASECURRENT3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASECURRENT3] = PHASECURRENT3;
            }

            //分相有功功率P1 s32 W
            double PHASEACTIVEPOWER1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            //PHASEACTIVEPOWER1 = Math.Round(PHASEACTIVEPOWER1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER1] = PHASEACTIVEPOWER1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEACTIVEPOWER1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER1] = PHASEACTIVEPOWER1;
            }

            //分相有功功率P2 s32 W
            double PHASEACTIVEPOWER2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            // CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER2] = PHASEACTIVEPOWER2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEACTIVEPOWER2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER2] = PHASEACTIVEPOWER2;
            }

            //分相有功功率P3 s32 W
            double PHASEACTIVEPOWER3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            // CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER3] = PHASEACTIVEPOWER3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEACTIVEPOWER3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEACTIVEPOWER3] = PHASEACTIVEPOWER3;
            }

            //系统有功功率Psum s32 W
            double SYSACTIVEPOWER = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_AMMETER_SYSACTIVEPOWER] = SYSACTIVEPOWER;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSACTIVEPOWER))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSACTIVEPOWER] = SYSACTIVEPOWER;
            }

            //分相无功功率Q1 Var S32
            double PHASEREACTIVEPOWER1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER1] = PHASEREACTIVEPOWER1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER1] = PHASEREACTIVEPOWER1;
            }
            //分相无功功率Q2 Var S32
            double PHASEREACTIVEPOWER2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER2] = PHASEREACTIVEPOWER2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER2] = PHASEREACTIVEPOWER2;
            }
            //分相无功功率Q3 Var S32
            double PHASEREACTIVEPOWER3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER3] = PHASEREACTIVEPOWER3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEREACTIVEPOWER3] = PHASEREACTIVEPOWER3;
            }

            //系统无功功率Qsum S32 Var
            double SYSREACTIVEPOWER = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_AMMETER_SYSREACTIVEPOWER] = SYSREACTIVEPOWER;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSREACTIVEPOWER))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSREACTIVEPOWER] = SYSREACTIVEPOWER;
            }

            //分相视在功率S1 U32 VA
            double PHASEAPPARENTPOWER1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER1] = PHASEAPPARENTPOWER1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER1] = PHASEAPPARENTPOWER1;
            }
            //分相视在功率S2 U32 VA
            double PHASEAPPARENTPOWER2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(52 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER2] = PHASEAPPARENTPOWER2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER2] = PHASEAPPARENTPOWER2;
            }
            //分相视在功率S1 U32 VA
            double PHASEAPPARENTPOWER3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(56 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER3] = PHASEAPPARENTPOWER3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEAPPARENTPOWER3] = PHASEAPPARENTPOWER3;
            }


            //系统视在功率Ssum U32 VA
            double _SYSAPPARENTPOWER = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(60 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_SYSAPPARENTPOWER] = _SYSAPPARENTPOWER;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSAPPARENTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSAPPARENTPOWER] = _SYSAPPARENTPOWER;
            }

            //分相功率因数PF1 S16 0.0001
            double PHASEPOWERFACTOR1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(64 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PHASEPOWERFACTOR1 = Math.Round(PHASEPOWERFACTOR1 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR1] = PHASEPOWERFACTOR1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEPOWERFACTOR1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR1] = PHASEPOWERFACTOR1;
            }
            //分相功率因数PF1 S16 0.0001
            double PHASEPOWERFACTOR2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(66 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PHASEPOWERFACTOR2 = Math.Round(PHASEPOWERFACTOR2 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR2] = PHASEPOWERFACTOR2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEPOWERFACTOR2))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR2] = PHASEPOWERFACTOR2;
            }
            //分相功率因数PF3 S16 0.0001
            double PHASEPOWERFACTOR3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(68 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PHASEPOWERFACTOR3 = Math.Round(PHASEPOWERFACTOR3 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR3] = PHASEPOWERFACTOR3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PHASEPOWERFACTOR3))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PHASEPOWERFACTOR3] = PHASEPOWERFACTOR3;
            }
            //系统功率因数PF S16 0.0001
            double SYSPOWERFACTOR1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(70 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            SYSPOWERFACTOR1 = Math.Round(SYSPOWERFACTOR1 * 0.0001, 3);
            realMonitorMap[MonitorType.MIC_AMMETER_SYSPOWERFACTOR1] = SYSPOWERFACTOR1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_SYSPOWERFACTOR1))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_SYSPOWERFACTOR1] = SYSPOWERFACTOR1;
            }

            //向有功电度 U32 kWh 反映说部队
            int POSITIVEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(72 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE] = POSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE] = POSITIVEACTIVEPOWERDEGREE;
            }
            //反向有功电度 U32 kWh
            int REVERSEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(76 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_REVERSEACTIVEPOWERDEGREE] = REVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_REVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_REVERSEACTIVEPOWERDEGREE] = REVERSEACTIVEPOWERDEGREE;
            }
            //正向无功电度 U32 kVarh
            int _POSITIVEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(80 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_POSITIVEREACTIVEPOWERDEGREE] = _POSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_POSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_POSITIVEREACTIVEPOWERDEGREE] = _POSITIVEREACTIVEPOWERDEGREE;
            }
            //反向无功电度 U32 kVarh
            int REVERSEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(84 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_REVERSEREACTIVEPOWERDEGREE] = REVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_REVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_REVERSEREACTIVEPOWERDEGREE] = REVERSEREACTIVEPOWERDEGREE;
            }
            //绝对值和有功电度 U32 kWh
            int ABSOLUTEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(88 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEACTIVEPOWERDEGREE] = ABSOLUTEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_ABSOLUTEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEACTIVEPOWERDEGREE] = ABSOLUTEACTIVEPOWERDEGREE;
            }
            //净有功电度 U32 kWh
            int PUREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(92 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_PUREACTIVEPOWERDEGREE] = PUREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PUREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PUREACTIVEPOWERDEGREE] = PUREACTIVEPOWERDEGREE;
            }
            //绝对值和无功电度 U32 kVarh
            int ABSOLUTEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(96 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEREACTIVEPOWERDEGREE] = ABSOLUTEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_ABSOLUTEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_ABSOLUTEREACTIVEPOWERDEGREE] = ABSOLUTEREACTIVEPOWERDEGREE;
            }
            //净无功电度 U32 kVarh
            int PUREREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(100 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_PUREREACTIVEPOWERDEGREE] = PUREREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_PUREREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_PUREREACTIVEPOWERDEGREE] = PUREREACTIVEPOWERDEGREE;
            }


            // 费率波正向有功电度 U32 kWh
            int WAVERATEPOSITIVEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(104 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEACTIVEPOWERDEGREE] = WAVERATEPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEACTIVEPOWERDEGREE] = WAVERATEPOSITIVEACTIVEPOWERDEGREE;
            }
            // 费率波反向有功电度 U32 kWh
            int WAVERATEREVERSEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(108 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEACTIVEPOWERDEGREE] = WAVERATEREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEACTIVEPOWERDEGREE] = WAVERATEREVERSEACTIVEPOWERDEGREE;
            }
            // 费率波正向无功电度 U32 kVarh
            int WAVERATEPOSITIVEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(112 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEREACTIVEPOWERDEGREE] = WAVERATEPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEPOSITIVEREACTIVEPOWERDEGREE] = WAVERATEPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率波反向无功电度 U32 kVarh
            int WAVERATEREVERSEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(116 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEREACTIVEPOWERDEGREE] = WAVERATEREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_WAVERATEREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_WAVERATEREVERSEREACTIVEPOWERDEGREE] = WAVERATEREVERSEREACTIVEPOWERDEGREE;
            }

            // 费率峰正向有功电度 U32 kWh
            int RATEPEAKPOSITIVEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(120 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEACTIVEPOWERDEGREE;
            }
            // 费率峰反向有功度 U32 kWh
            int RATEPEAKREVERSEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(124 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEACTIVEPOWERDEGREE] = RATEPEAKREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEACTIVEPOWERDEGREE] = RATEPEAKREVERSEACTIVEPOWERDEGREE;
            }
            // 费率峰正向无功电度 U32 kVarh
            int RATEPEAKPOSITIVEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(128 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEREACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKPOSITIVEREACTIVEPOWERDEGREE] = RATEPEAKPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率峰反向无功电度 U32 kVarh
            int RATEPEAKREVERSEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(132 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEREACTIVEPOWERDEGREE] = RATEPEAKREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEPEAKREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEPEAKREVERSEREACTIVEPOWERDEGREE] = RATEPEAKREVERSEREACTIVEPOWERDEGREE;
            }

            // 费率谷正向有功电度 U32 kWh
            int RATEVALLEYPOSITIVEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(136 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEACTIVEPOWERDEGREE;
            }
            //  费率谷反向有功电度 U32 kWh
            int RATEVALLEYREVERSEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(140 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEACTIVEPOWERDEGREE] = RATEVALLEYREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEACTIVEPOWERDEGREE] = RATEVALLEYREVERSEACTIVEPOWERDEGREE;
            }
            // 费率谷正向无功电度 U32 kVarh
            int RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(144 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE] = RATEVALLEYPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率谷反向无功电度 U32 kVarh
            int RATEVALLEYREVERSEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(148 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEREACTIVEPOWERDEGREE] = RATEVALLEYREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATEVALLEYREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATEVALLEYREVERSEREACTIVEPOWERDEGREE] = RATEVALLEYREVERSEREACTIVEPOWERDEGREE;
            }

            // 费率平正向有功电度 U32 kWh
            int RATELEVELPOSITIVEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(152 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEACTIVEPOWERDEGREE] = RATELEVELPOSITIVEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELPOSITIVEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEACTIVEPOWERDEGREE] = RATELEVELPOSITIVEACTIVEPOWERDEGREE;
            }
            // 费率平反向有功电度 U32 kWh
            int RATELEVELREVERSEACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(156 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEACTIVEPOWERDEGREE] = RATELEVELREVERSEACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELREVERSEACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEACTIVEPOWERDEGREE] = RATELEVELREVERSEACTIVEPOWERDEGREE;
            }
            // 费率平正向无功电度 U32 kVarh
            int RATELEVELPOSITIVEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(160 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEREACTIVEPOWERDEGREE] = RATELEVELPOSITIVEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELPOSITIVEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELPOSITIVEREACTIVEPOWERDEGREE] = RATELEVELPOSITIVEREACTIVEPOWERDEGREE;
            }
            // 费率平反向无功电度 U32 kVarh
            int RATELEVELREVERSEREACTIVEPOWERDEGREE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(164 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEREACTIVEPOWERDEGREE] = RATELEVELREVERSEREACTIVEPOWERDEGREE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_AMMETER_RATELEVELREVERSEREACTIVEPOWERDEGREE))
            {
                historyMonitorMap[MonitorType.MIC_AMMETER_RATELEVELREVERSEREACTIVEPOWERDEGREE] = RATELEVELREVERSEREACTIVEPOWERDEGREE;
            }

            tableType = TableUtil.AMMETER;
        }
Beispiel #5
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据逆变器modbus协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);

            //实时状态测点数据
            //额定输出功率 0.1kW
            double outpower = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            outpower = Math.Round(outpower * 0.1, 3);
            realMonitorMap[MonitorType.MIC_INVERTER_POWER] = outpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_POWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_POWER] = outpower;
            }

            //输出类型 bank不显示改为显示,以便做类型判断逆变器显示方式
            long outtype = SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_OUTTYPE] = outtype;

            //日发电量0.1kWh
            double dayenergy = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dayenergy = Math.Round(dayenergy * 0.1, 2);
            realMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = dayenergy;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TODAYENERGY))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = dayenergy;
            }
            base.todayEnergy = dayenergy;

            //总发电量
            long totalenergy = SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALENERGY] = totalenergy;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALENERGY))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALENERGY] = totalenergy;
            }

            //总运行时间
            long totalruntime = SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_RUNTIME] = totalruntime;

            //机内空气温度 0.1℃
            double jnkqtemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            jnkqtemprature = Math.Round(jnkqtemprature * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNKQTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
            }


            //机内变压器温度  0.1℃
            double jnbyqtemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(18 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            jnbyqtemprature = Math.Round(jnbyqtemprature * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_JNBYQTEMPRATURE] = jnbyqtemprature;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNBYQTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_JNBYQTEMPRATURE] = jnbyqtemprature;
            }

            //机内散热器温度  0.1℃
            double jnsrqtemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            jnsrqtemprature = Math.Round(jnsrqtemprature * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_JNSRQTEMPRATURE] = jnsrqtemprature;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNSRQTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_JNSRQTEMPRATURE] = jnsrqtemprature;
            }

            //直流电压1 0.1V
            double dv1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dv1 = Math.Round(dv1 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV1] = dv1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV1))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DV1] = dv1;
            }

            //直流电流1 0.1A
            double dc1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dc1 = Math.Round(dc1 * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC1] = dc1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC1))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DC1] = dc1;
            }

            //直流电压2 0.1V
            double dv2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dv2 = Math.Round(dv2 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV2] = dv2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV2))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DV2] = dv2;
            }

            //直流电流2 0.1A
            double dc2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dc2 = Math.Round(dc2 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC2] = dc2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC2))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DC2] = dc2;
            }

            //直流电压3 0.1V
            double dv3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dv3 = Math.Round(dv3 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV3] = dv3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV3))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DV3] = dv3;
            }

            //直流电流3 0.1A
            double dc3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dc3 = Math.Round(dc3 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC3] = dc3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC3))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DC3] = dc3;
            }

            //总直流功率
            int totaldcpower = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALDPOWER] = totaldcpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALDPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALDPOWER] = totaldcpower;
            }

            //A相电压 0.1V
            double adirectvolt = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            adirectvolt = Math.Round(adirectvolt * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTVOLT] = adirectvolt;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTVOLT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTVOLT] = adirectvolt;
            }

            //B相电压 0.1V
            double bdirectvolt = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            bdirectvolt = Math.Round(bdirectvolt * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTVOLT] = bdirectvolt;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTVOLT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTVOLT] = bdirectvolt;
            }

            //C相电压 0.1V
            double cdirectvolt = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            cdirectvolt = Math.Round(cdirectvolt * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTVOLT] = cdirectvolt;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTVOLT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTVOLT] = cdirectvolt;
            }

            //A相电流 0.1V
            double adirectcurrent = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            adirectcurrent = Math.Round(adirectcurrent * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTCURRENT] = adirectcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTCURRENT] = adirectcurrent;
            }

            //B相电流 0.1V
            double bdirectcurrent = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            bdirectcurrent = Math.Round(bdirectcurrent * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTCURRENT] = bdirectcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTCURRENT] = bdirectcurrent;
            }

            //C相电流 0.1V
            double cdirectcurrent = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            cdirectcurrent = Math.Round(cdirectcurrent * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTCURRENT] = cdirectcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTCURRENT] = cdirectcurrent;
            }

            //A相有功功率
            long adirectygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(50 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTPOWER] = adirectygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTPOWER] = adirectygpower;
            }

            //B相有功功率
            long bdirectygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTPOWER] = bdirectygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTPOWER] = bdirectygpower;
            }

            //C相有功功率
            long cdirectygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(58 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTPOWER] = cdirectygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTPOWER] = cdirectygpower;
            }

            //总有功功率
            long totalygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(62 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALYGPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            }

            //总无功功率
            long totalwgpower = SystemCode.HexNumberToDenary(monitorstr.Substring(66 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALWGPOWER] = totalwgpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALWGPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALWGPOWER] = totalwgpower;
            }

            //总功率因数 0.001
            double totalpowerfactor = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(70 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            totalpowerfactor = Math.Round(totalpowerfactor * 0.001F, 3);
            realMonitorMap[MonitorType.MIC_INVERTER_TOTALPOWERFACTOR] = totalpowerfactor;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALPOWERFACTOR))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALPOWERFACTOR] = totalpowerfactor;
            }

            //电网频率 0.1Hz
            double dwpl = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(72 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dwpl = Math.Round(dwpl * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DWPL))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
            }

            //逆变器效率 0.1%
            double inverterxl = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(74 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            inverterxl = Math.Round(inverterxl * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_INVERTERXL] = inverterxl;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_INVERTERXL))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_INVERTERXL] = inverterxl;
            }

            //设备状态
            int devicestatus = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(76 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_DEVICESTATUS] = devicestatus;
            base.deviceState = devicestatus;

            //设备时间
            int statusyear   = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(78 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusmonth  = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(80 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusday    = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(82 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statushh     = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(84 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusminuts = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(86 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statussecond = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(88 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSTIME] = "";// statusyear + "/" + statusmonth + "/" + statusday + " " + statushh + ":" + statusminuts + ":" + statussecond;

            //状态数据1
            int statusdata1 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(90 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA1] = statusdata1;

            //状态数据2
            int statusdata2 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(92 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA2] = statusdata2;

            //状态数据3
            int statusdata3 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(94 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA3] = statusdata3;

            //add by qhb in 20120823
            //保留	4字节
            //故障状态	4字节 无符号
            string tempstr = monitorstr.Substring(100 * hexbytecharnum, 4 * hexbytecharnum);

            if (!tempstr.ToLower().Equals("ffffffff"))//ffffffff不做处理
            {
                int errorstatus = (int)SystemCode.HexNumberToDenary(tempstr, true, 32, 'u');
                realMonitorMap[MonitorType.MIC_INVERTER_ERRORSTATUS] = errorstatus;
            }
            //故障状态2	4字节 无符号
            tempstr = monitorstr.Substring(104 * hexbytecharnum, 4 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffffffff"))//ffffffff不做处理
            {
                int errorstatus2 = (int)SystemCode.HexNumberToDenary(tempstr, true, 32, 'u');
                realMonitorMap[MonitorType.MIC_INVERTER_ERRORSTATUS2] = errorstatus2;
            }
            //保留	8字节
            //保留	4字节
            //保留	4字节
            //电抗器温度	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(124 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double dkqtemp = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                dkqtemp = Math.Round(dkqtemp * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DKQTEMPRATURE] = dkqtemp;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DKQTEMPRATURE))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DKQTEMPRATURE] = dkqtemp;
                }
            }
            //模块温度1	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(126 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double moduletemp1 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                moduletemp1 = Math.Round(moduletemp1 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP1] = moduletemp1;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_MODULETEMP1))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP1] = moduletemp1;
                }
            }
            //模块温度2	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(128 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double moduletemp2 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                moduletemp2 = Math.Round(moduletemp2 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP2] = moduletemp2;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_MODULETEMP2))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP2] = moduletemp2;
                }
            }
            //模块温度3	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(130 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double moduletemp3 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                moduletemp3 = Math.Round(moduletemp3 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP3] = moduletemp3;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_MODULETEMP3))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP3] = moduletemp3;
                }
            }
            //模块温度4	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(132 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double moduletemp4 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                moduletemp4 = Math.Round(moduletemp4 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP4] = moduletemp4;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_MODULETEMP4))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP4] = moduletemp4;
                }
            }
            //模块温度5	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(134 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double moduletemp5 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                moduletemp5 = Math.Round(moduletemp5 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP5] = moduletemp5;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_MODULETEMP5))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP5] = moduletemp5;
                }
            }
            //模块温度6	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(136 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double moduletemp6 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                moduletemp6 = Math.Round(moduletemp6 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP6] = moduletemp6;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_MODULETEMP6))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_MODULETEMP6] = moduletemp6;
                }
            }
            //环境温度1	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(138 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double envtemp1 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                envtemp1 = Math.Round(envtemp1 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_ENVTEMP1] = envtemp1;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ENVTEMP1))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_ENVTEMP1] = envtemp1;
                }
            }
            //环境温度2	2字节	0.1℃	有符号
            tempstr = monitorstr.Substring(140 * hexbytecharnum, 2 * hexbytecharnum);
            if (!tempstr.ToLower().Equals("ffff"))//ffffffff不做处理
            {
                double envtemp2 = (double)SystemCode.HexNumberToDenary(tempstr, false, 16, 's');
                envtemp2 = Math.Round(envtemp2 * 0.1D, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_ENVTEMP2] = envtemp2;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ENVTEMP2))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_ENVTEMP2] = envtemp2;
                }
            }
            //保留	2字节
            //保留	4字节

            tableType = TableUtil.INVERTER_TABLE_NAME;
        }
Beispiel #6
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据逆变器modbus协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);

            //实时状态测点数据
            //额定输出功率 0.1kW
            double outpower = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            outpower = Math.Round(outpower * 0.1, 3);
            realMonitorMap[MonitorType.MIC_INVERTER_POWER] = outpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_POWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_POWER] = outpower;
            }

            //输出类型
            long outtype = SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_OUTTYPE] = outtype;

            //日发电量0.1kWh
            double dayenergy = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dayenergy = Math.Round(dayenergy * 0.1, 2);
            realMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = dayenergy;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TODAYENERGY))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = dayenergy;
            }
            base.todayEnergy = dayenergy;

            //总发电量
            long totalenergy = SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALENERGY] = totalenergy;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALENERGY))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALENERGY] = totalenergy;
            }

            //总运行时间
            long totalruntime = SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_RUNTIME] = totalruntime;

            //机内空气温度 0.1℃
            double jnkqtemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            jnkqtemprature = Math.Round(jnkqtemprature * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNKQTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
            }


            //机内变压器温度  0.1℃
            double jnbyqtemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(18 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            jnbyqtemprature = Math.Round(jnbyqtemprature * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_JNBYQTEMPRATURE] = jnbyqtemprature;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNKQTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
            }

            //机内散热器温度  0.1℃
            double jnsrqtemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            jnsrqtemprature = Math.Round(jnsrqtemprature * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_JNSRQTEMPRATURE] = jnsrqtemprature;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNKQTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
            }

            //直流电压1 0.1V
            double dv1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dv1 = Math.Round(dv1 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV1] = dv1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV1))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DV1] = dv1;
            }

            //直流电流1 0.1A
            double dc1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dc1 = Math.Round(dc1 * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC1] = dc1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC1))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DC1] = dc1;
            }

            //直流电压2 0.1V
            double dv2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dv2 = Math.Round(dv2 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV2] = dv2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV2))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DV2] = dv2;
            }

            //直流电流2 0.1A
            double dc2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dc2 = Math.Round(dc2 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC2] = dc2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC2))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DC2] = dc2;
            }

            //直流电压3 0.1V
            double dv3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dv3 = Math.Round(dv3 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV3] = dv3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV3))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DV3] = dv3;
            }

            //直流电流3 0.1A
            double dc3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dc3 = Math.Round(dc3 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC3] = dc3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC3))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DC3] = dc3;
            }

            //总直流功率
            int totaldcpower = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALDPOWER] = totaldcpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALDPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALDPOWER] = totaldcpower;
            }

            //A相电压 0.1V
            double adirectvolt = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            adirectvolt = Math.Round(adirectvolt * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTVOLT] = adirectvolt;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTVOLT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTVOLT] = adirectvolt;
            }

            //B相电压 0.1V
            double bdirectvolt = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            bdirectvolt = Math.Round(bdirectvolt * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTVOLT] = bdirectvolt;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTVOLT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTVOLT] = bdirectvolt;
            }

            //C相电压 0.1V
            double cdirectvolt = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            cdirectvolt = Math.Round(cdirectvolt * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTVOLT] = cdirectvolt;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTVOLT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTVOLT] = cdirectvolt;
            }

            //A相电流 0.1V
            double adirectcurrent = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            adirectcurrent = Math.Round(adirectcurrent * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTCURRENT] = adirectcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTCURRENT] = adirectcurrent;
            }

            //B相电流 0.1V
            double bdirectcurrent = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            bdirectcurrent = Math.Round(bdirectcurrent * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTCURRENT] = bdirectcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTCURRENT] = bdirectcurrent;
            }

            //C相电流 0.1V
            double cdirectcurrent = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            cdirectcurrent = Math.Round(cdirectcurrent * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTCURRENT] = cdirectcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTCURRENT] = cdirectcurrent;
            }

            //A相有功功率
            long adirectygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(50 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTPOWER] = adirectygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTPOWER] = adirectygpower;
            }

            //B相有功功率
            long bdirectygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTPOWER] = bdirectygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTPOWER] = bdirectygpower;
            }

            //C相有功功率
            long cdirectygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(58 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTPOWER] = cdirectygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTPOWER] = cdirectygpower;
            }

            //总有功功率
            long totalygpower = SystemCode.HexNumberToDenary(monitorstr.Substring(62 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALYGPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            }

            //总无功功率
            long totalwgpower = SystemCode.HexNumberToDenary(monitorstr.Substring(66 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALWGPOWER] = totalwgpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALWGPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALWGPOWER] = totalwgpower;
            }

            //总功率因数 0.001
            double totalpowerfactor = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(70 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            totalpowerfactor = Math.Round(totalpowerfactor * 0.001F, 3);
            realMonitorMap[MonitorType.MIC_INVERTER_TOTALPOWERFACTOR] = totalpowerfactor;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALPOWERFACTOR))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALPOWERFACTOR] = totalpowerfactor;
            }

            //电网频率 0.1Hz
            double dwpl = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(72 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            dwpl = Math.Round(dwpl * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DWPL))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
            }

            //逆变器效率 0.1%
            double inverterxl = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(74 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            inverterxl = Math.Round(inverterxl * 0.1F, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_INVERTERXL] = inverterxl;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_INVERTERXL))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_INVERTERXL] = inverterxl;
            }

            //设备状态
            int devicestatus = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(76 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_DEVICESTATUS] = devicestatus;
            base.deviceState = devicestatus;

            //设备时间
            int statusyear   = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(78 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusmonth  = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(80 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusday    = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(82 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statushh     = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(84 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusminuts = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(86 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statussecond = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(88 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSTIME] = "";// statusyear + "/" + statusmonth + "/" + statusday + " " + statushh + ":" + statusminuts + ":" + statussecond;

            //状态数据1
            int statusdata1 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(90 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA1] = statusdata1;

            //状态数据2
            int statusdata2 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(92 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA2] = statusdata2;

            //状态数据3
            int statusdata3 = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(94 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA3] = statusdata3;

            deviceType = TableUtil.INVERTER_TABLE_NAME;
        }
Beispiel #7
0
        int deviceDataHeadLength = 5;//5字节
        /// <summary>
        /// 根据逆变器光伏直流配电柜通信协议(Modbus)V1.0-柴达木-2011.8.30.pdf解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);

            //数字输入即输入路数
            //原来就有
            //输入路数 add by hbqian in 2013-03-16 for
            //2013-03-13
            //周辉 13:32:29
            //注意: 这个协议里面地址7001的上面写了保留,其实不是保留,是输入路数,跟汇流箱一样,你看好不好处理
            //老钱 13:33:38
            //那为何不更新下协议 就写上是输入路数呢
            //周辉 13:34:11
            //协议没有更新,但是他们做下位机的没有按协议做
            //周辉 13:34:21
            //把这个当输入路数用了
            //老钱 13:36:21
            //类型?
            //老钱 13:36:24
            //u16?
            //老钱 13:36:35
            //7001
            int ATAINPUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DIGITALINPUT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            }

            //最大电流0.1A
            //modify by hbqian in 2013-03-16 for
            //2012-03-13
            //周辉 13:22:03
            //光伏直流配电柜通信协议(Modbus)V1.0-柴达木-2011.8.30.pdf
            //老钱 13:22:14
            //?
            //周辉 13:22:28
            //里面的第9个 最大电流 你看看是不是解析错了
            //周辉 13:22:45
            //系数是0。1 ,你是不是当0。01处理了?
            //周辉 13:23:03
            //直流配电柜的 0X14
            double maxcurrent = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            maxcurrent = Math.Round(maxcurrent * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_MAXCURRENT] = maxcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_MAXCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_MAXCURRENT] = maxcurrent;
            }

            //第一路电流0.01A
            double CURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT1 = Math.Round(CURRENT1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_1CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            }
            //第二路电流0.01A
            double CURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT2 = Math.Round(CURRENT2 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_2CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            }
            //第三路电流0.01A
            double CURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT3 = Math.Round(CURRENT3 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_3CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            }
            //第四路电流0.01A
            double CURRENT4 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT4 = Math.Round(CURRENT4 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_4CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            }

            //第五路电流0.01A
            double CURRENT5 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_5CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            }
            //第六路电流0.01A
            double CURRENT6 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT6 = Math.Round(CURRENT6 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_6CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            }
            //第七路电流0.01A
            double CURRENT7 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT7 = Math.Round(CURRENT7 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_7CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            }
            //第八路电流0.01A
            double CURRENT8 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT8 = Math.Round(CURRENT8 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_8CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            }

            //第九路电流0.01A
            double CURRENT9 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT9 = Math.Round(CURRENT9 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_9CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            }

            //第十路电流0.01A
            double CURRENT10 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT10 = Math.Round(CURRENT10 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_10CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            }
            //第十一路电流0.01A
            double CURRENT11 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT11 = Math.Round(CURRENT11 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_11CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            }
            //第十二路电流0.01A
            double CURRENT12 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT12 = Math.Round(CURRENT12 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_12CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            }
            //第十三路电流0.01A
            double CURRENT13 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(50 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT13 = Math.Round(CURRENT13 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_13CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            }
            //第十四路电流0.01A
            double CURRENT14 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(52 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT14 = Math.Round(CURRENT14 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_14CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            }

            // 第十五路电流0.01A
            double CURRENT15 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT15 = Math.Round(CURRENT15 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_15CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            }

            // 第十六路电流0.01A
            double CURRENT16 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(56 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT16 = Math.Round(CURRENT16 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_16CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            }

            //总电流0.1A
            double totalC = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(62 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            totalC = Math.Round(totalC * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT]    = totalC;
            historyMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT] = totalC;

            tableType = TableUtil.CABINET;
        }
Beispiel #8
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据逆变器sungrow协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //按照测点在协议中的顺序依次解析具体测点数据
            //交流电压 0.1
            ushort avl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(0 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');
            double av  = 0;

            if (avl != ushort.MaxValue)
            {//最大值无效
                av = Math.Round(avl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_AV]    = av;
                historyMonitorMap[MonitorType.MIC_INVERTER_AV] = av;
            }
            //交流电流
            ushort acl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');
            double ac  = 0;

            if (acl != ushort.MaxValue)
            {//最大值无效
                ac = Math.Round(acl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_AC]    = ac;
                historyMonitorMap[MonitorType.MIC_INVERTER_AC] = ac;
            }
            //直流电压
            ushort dvl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            if (dvl != ushort.MaxValue)
            {//最大值无效
                double dv = Math.Round(dvl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DV]    = dv;
                historyMonitorMap[MonitorType.MIC_INVERTER_DV] = dv;
            }
            //直流电流
            ushort dcl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            if (dcl != ushort.MaxValue)//最大值无效
            {
                double dc = Math.Round(dcl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DC]    = dc;
                historyMonitorMap[MonitorType.MIC_INVERTER_DC] = dc;
            }
            //逆变器温度 为补吗是啥意思?
            ushort invertertempraturel = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            if (invertertempraturel != ushort.MaxValue)//最大值无效
            {
                double invertertemprature = Math.Round(invertertempraturel * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_INVETERTEMPRATURE]    = invertertemprature;
                historyMonitorMap[MonitorType.MIC_INVERTER_INVETERTEMPRATURE] = invertertemprature;
            }
            //日发电量
            ushort todayEnergyl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(10 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            if (todayEnergyl != ushort.MaxValue)//最大值无效
            {
                double todayEnergy = Math.Round(todayEnergyl * 0.1, 3);
                realMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY]    = todayEnergy;
                historyMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = todayEnergy;
                base.todayEnergy = todayEnergy;
            }

            //交流发电量即总发电量
            string acEnergyStr = monitorstr.Substring(12 * hexbytecharnum, 4 * hexbytecharnum);
            uint   acEnergyl   = (uint)SystemCode.HexNumberToDenary(acEnergyStr, SystemCode.ReversionType_groupinner, 32, 'u');

            if (acEnergyl != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_ACENERGY]    = acEnergyl;
                historyMonitorMap[MonitorType.MIC_INVERTER_ACENERGY] = acEnergyl;
            }
            //状态信息
            ushort statusinfo = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            if (statusinfo != ushort.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_DEVICESTATUS] = statusinfo;
            }
            //电网频率
            ushort dwpll = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            if (dwpll != ushort.MaxValue)//最大值无效
            {
                double dwpl = Math.Round(dwpll * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DWPL]    = dwpl;
                historyMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
            }

            //总有功功率,协议中无要加工交流电压*交流电流
            double totalygpower = av * ac;

            totalygpower = Math.Round(totalygpower, 1);

            realMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALYGPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            }

            //设备型号 25序号的是设备型号,单字节无符号整型
            string xh = monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum);

            if (!xh.Equals("00") && !xh.Equals("0"))
            {
                base.deviceXh = (int)SystemCode.HexNumberToDenary(xh, true, 8, 'u');
            }

            tableType = TableUtil.INVERTER_TABLE_NAME;
        }
Beispiel #9
0
        /// <summary>
        /// 根据协议解析
        /// </summary>
        public static PlantInfo analysis(string deviceData)
        {
            //deviceData = "69 69 01 00 C3 00 00 00 01 00 01 00 00 00 02 00 0B 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 E4 B8 AD E5 9B BD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E5 8C 97 E4 BA AC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 34 08 00 00 00 AF 00 00 B1 65 C9";
            PlantInfo plant = new PlantInfo();

            //电站项目编号
            string projectName = StringUtil.Hex2UTF8(deviceData.Substring(2 * hexbytecharnum, 32 * hexbytecharnum));
            //电站名称
            string plantName = StringUtil.Hex2UTF8(deviceData.Substring(34 * hexbytecharnum, 32 * hexbytecharnum));

            plant.name = plantName;
            //电站业主
            string plantOwner = StringUtil.Hex2UTF8(deviceData.Substring(66 * hexbytecharnum, 32 * hexbytecharnum));

            plant.owner = plantOwner;
            //电站设计功率
            float designPower = (float)SystemCode.HexNumberToDenary(deviceData.Substring(98 * hexbytecharnum, 4 * hexbytecharnum), SystemCode.ReversionType_all, 32, 'u');

            plant.designPower = designPower;
            //电站所在国家
            string country = StringUtil.Hex2UTF8(deviceData.Substring(102 * hexbytecharnum, 32 * hexbytecharnum));

            plant.country = country;
            //城市
            string city = StringUtil.Hex2UTF8(deviceData.Substring(134 * hexbytecharnum, 32 * hexbytecharnum));

            plant.city = city;
            //电站所在地的邮政编码
            string postCode = StringUtil.Hex2UTF8(deviceData.Substring(166 * hexbytecharnum, 12 * hexbytecharnum));

            plant.postCode = postCode;

            //电站时区
            int timezone = (int)SystemCode.HexNumberToDenary(deviceData.Substring(178 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 's');

            timezone       = timezone / 100;
            plant.timezone = timezone;

            //夏令时支持
            int xls = (int)SystemCode.HexNumberToDenary(deviceData.Substring(180 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            plant.isxls = xls == 1?true:false;
            //电站经纬度  6*U8 = 6字节
            //纬度秒
            int ws = (int)SystemCode.HexNumberToDenary(deviceData.Substring(181 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');
            int wm = (int)SystemCode.HexNumberToDenary(deviceData.Substring(182 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');
            int wh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(183 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');

            plant.latd = wh;
            plant.latm = wm;
            plant.lats = ws;

            //精度秒
            int js = (int)SystemCode.HexNumberToDenary(deviceData.Substring(184 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');
            int jm = (int)SystemCode.HexNumberToDenary(deviceData.Substring(185 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');
            int jh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(186 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');

            plant.longd = jh;
            plant.longm = jm;
            plant.longs = js;
            return(plant);
        }
Beispiel #10
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据逆变器modbus协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);

            //实时状态测点数据
            //额定输出功率 0.1kW
            ushort outpowerl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (outpowerl != ushort.MaxValue)//最大值无效
            {
                double outpower = Math.Round(outpowerl * 0.1, 3);
                realMonitorMap[MonitorType.MIC_INVERTER_POWER] = outpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_POWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_POWER] = outpower;
                }
            }

            //输出类型 bank不显示改为显示,以便做类型判断逆变器显示方式
            ushort outtype = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (outtype != ushort.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_OUTTYPE] = outtype;
            }

            //日发电量0.1kWh
            ushort dayenergyl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dayenergyl != ushort.MaxValue)//最大值无效
            {
                double dayenergy = Math.Round(dayenergyl * 0.1, 2);
                realMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = dayenergy;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TODAYENERGY))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = dayenergy;
                }
                base.todayEnergy = dayenergy;
            }

            //总发电量
            uint totalenergy = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (totalenergy != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_TOTALENERGY] = totalenergy;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALENERGY))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_TOTALENERGY] = totalenergy;
                }
            }
            //总运行时间
            uint totalruntime = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (totalruntime != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_RUNTIME] = totalruntime;
            }

            //机内空气温度 0.1℃
            short jnkqtempraturel = (short)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            if (jnkqtempraturel != short.MaxValue)//最大值无效
            {
                double jnkqtemprature = Math.Round(jnkqtempraturel * 0.1F, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNKQTEMPRATURE))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_JNKQTEMPRATURE] = jnkqtemprature;
                }
            }

            //机内变压器温度  0.1℃
            short jnbyqtempraturel = (short)SystemCode.HexNumberToDenary(monitorstr.Substring(18 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            if (jnbyqtempraturel != short.MaxValue)//最大值无效
            {
                double jnbyqtemprature = Math.Round(jnbyqtempraturel * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_JNBYQTEMPRATURE] = jnbyqtemprature;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNBYQTEMPRATURE))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_JNBYQTEMPRATURE] = jnbyqtemprature;
                }
            }

            //机内散热器温度  0.1℃
            short jnsrqtempraturel = (short)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            if (jnsrqtempraturel != short.MaxValue)//最大值无效
            {
                double jnsrqtemprature = Math.Round(jnsrqtempraturel * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_JNSRQTEMPRATURE] = jnsrqtemprature;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_JNSRQTEMPRATURE))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_JNSRQTEMPRATURE] = jnsrqtemprature;
                }
            }

            //直流电压1 0.1V
            ushort dv1l = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dv1l != ushort.MaxValue)//最大值无效
            {
                double dv1 = Math.Round(dv1l * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DV1] = dv1;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV1))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DV1] = dv1;
                }
            }

            //直流电流1 0.1A
            ushort dc1l = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dc1l != ushort.MaxValue)//最大值无效
            {
                double dc1 = Math.Round(dc1l * 0.1F, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DC1] = dc1;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC1))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DC1] = dc1;
                }
            }
            //直流电压2 0.1V
            ushort dv2l = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dv2l != ushort.MaxValue)//最大值无效
            {
                double dv2 = Math.Round(dv2l * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DV2] = dv2;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV2))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DV2] = dv2;
                }
            }
            //直流电流2 0.1A
            ushort dc2l = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dc2l != ushort.MaxValue)//最大值无效
            {
                double dc2 = Math.Round(dc2l * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DC2] = dc2;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC2))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DC2] = dc2;
                }
            }

            //直流电压3 0.1V
            ushort dv3l = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dv3l != ushort.MaxValue)//最大值无效
            {
                double dv3 = Math.Round(dv3l * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DV3] = dv3;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DV3))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DV3] = dv3;
                }
            }

            //直流电流3 0.1A
            ushort dc3l = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dc3l != ushort.MaxValue)//最大值无效
            {
                double dc3 = Math.Round(dc3l * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DC3] = dc3;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DC3))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DC3] = dc3;
                }
            }

            //总直流功率
            uint totaldcpower = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (totaldcpower != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_TOTALDPOWER] = totaldcpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALDPOWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_TOTALDPOWER] = totaldcpower;
                }
            }

            //A相电压 0.1V
            ushort adirectvoltl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (adirectvoltl != ushort.MaxValue)//最大值无效
            {
                double adirectvolt = Math.Round(adirectvoltl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTVOLT] = adirectvolt;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTVOLT))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTVOLT] = adirectvolt;
                }
            }
            //B相电压 0.1V
            ushort bdirectvoltl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (bdirectvoltl != ushort.MaxValue)//最大值无效
            {
                double bdirectvolt = Math.Round(bdirectvoltl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTVOLT] = bdirectvolt;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTVOLT))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTVOLT] = bdirectvolt;
                }
            }
            //C相电压 0.1V
            ushort cdirectvoltl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (cdirectvoltl != ushort.MaxValue)//最大值无效
            {
                double cdirectvolt = Math.Round(cdirectvoltl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTVOLT] = cdirectvolt;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTVOLT))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTVOLT] = cdirectvolt;
                }
            }

            //A相电流 0.1V
            ushort adirectcurrentl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (adirectcurrentl != ushort.MaxValue)//最大值无效
            {
                double adirectcurrent = Math.Round(adirectcurrentl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTCURRENT] = adirectcurrent;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTCURRENT))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTCURRENT] = adirectcurrent;
                }
            }

            //B相电流 0.1V
            ushort bdirectcurrentl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (bdirectcurrentl != ushort.MaxValue)//最大值无效
            {
                double bdirectcurrent = Math.Round(bdirectcurrentl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTCURRENT] = bdirectcurrent;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTCURRENT))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTCURRENT] = bdirectcurrent;
                }
            }

            //C相电流 0.1V
            ushort cdirectcurrentl = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (cdirectcurrentl != ushort.MaxValue)//最大值无效
            {
                double cdirectcurrent = Math.Round(cdirectcurrentl * 0.1, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTCURRENT] = cdirectcurrent;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTCURRENT))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTCURRENT] = cdirectcurrent;
                }
            }

            //A相有功功率
            uint adirectygpower = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(50 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (adirectygpower != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_ADIRECTPOWER] = adirectygpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_ADIRECTPOWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_ADIRECTPOWER] = adirectygpower;
                }
            }

            //B相有功功率
            uint bdirectygpower = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (bdirectygpower != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_BDIRECTPOWER] = bdirectygpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_BDIRECTPOWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_BDIRECTPOWER] = bdirectygpower;
                }
            }

            //C相有功功率
            uint cdirectygpower = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(58 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (cdirectygpower != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_CDIRECTPOWER] = cdirectygpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_CDIRECTPOWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_CDIRECTPOWER] = cdirectygpower;
                }
            }

            //总有功功率
            uint totalygpower = (uint)SystemCode.HexNumberToDenary(monitorstr.Substring(62 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            if (totalygpower != uint.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALYGPOWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
                }
            }

            //总无功功率
            int totalwgpower = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(66 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 's');

            if (totalwgpower != int.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_TOTALWGPOWER] = totalwgpower;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALWGPOWER))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_TOTALWGPOWER] = totalwgpower;
                }
            }

            //总功率因数 0.001
            short totalpowerfactorl = (short)SystemCode.HexNumberToDenary(monitorstr.Substring(70 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            if (totalpowerfactorl != short.MaxValue)//最大值无效
            {
                double totalpowerfactor = Math.Round(totalpowerfactorl * 0.001F, 3);
                realMonitorMap[MonitorType.MIC_INVERTER_TOTALPOWERFACTOR] = totalpowerfactor;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALPOWERFACTOR))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_TOTALPOWERFACTOR] = totalpowerfactor;
                }
            }

            //电网频率 0.1Hz
            ushort dwpll = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(72 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (dwpll != ushort.MaxValue)//最大值无效
            {
                double dwpl = Math.Round(dwpll * 0.1F, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_DWPL))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;
                }
            }

            //逆变器效率 0.1%
            ushort inverterxll = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(74 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (inverterxll != ushort.MaxValue)//最大值无效
            {
                double inverterxl = Math.Round(inverterxll * 0.1F, 1);
                realMonitorMap[MonitorType.MIC_INVERTER_INVERTERXL] = inverterxl;
                if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_INVERTERXL))
                {
                    historyMonitorMap[MonitorType.MIC_INVERTER_INVERTERXL] = inverterxl;
                }
            }

            //设备状态
            ushort devicestatus = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(76 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (devicestatus != ushort.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_DEVICESTATUS] = devicestatus;
                base.deviceState = devicestatus;
            }

            //设备时间
            int statusyear   = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(78 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusmonth  = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(80 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusday    = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(82 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statushh     = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(84 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statusminuts = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(86 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            int statussecond = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(88 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_STATUSTIME] = "";// statusyear + "/" + statusmonth + "/" + statusday + " " + statushh + ":" + statusminuts + ":" + statussecond;

            //状态数据1
            ushort statusdata1 = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(90 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (statusdata1 != ushort.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA1] = statusdata1;
            }

            //状态数据2
            ushort statusdata2 = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(92 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (statusdata2 != ushort.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA2] = statusdata2;
            }
            //状态数据3
            ushort statusdata3 = (ushort)SystemCode.HexNumberToDenary(monitorstr.Substring(94 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            if (statusdata3 != ushort.MaxValue)//最大值无效
            {
                realMonitorMap[MonitorType.MIC_INVERTER_STATUSDATA3] = statusdata3;
            }
            tableType = TableUtil.INVERTER_TABLE_NAME;
        }
Beispiel #11
0
        /// <summary>
        /// 根据环境检测仪MODBUS协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //按照测点在协议中的顺序依次解析具体测点数据
            //16每个数据的高位字节在前,低位字节在后
            //32双“字”数据前低后高。“字节”为前高后低

            //日照强度(0.1W/m2)
            double SUNLINGHT = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            SUNLINGHT = Math.Round(SUNLINGHT * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_SUNLINGHT]                  = SUNLINGHT;
            historyMonitorMap[MonitorType.MIC_DETECTOR_SUNLINGHT]               = SUNLINGHT;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_LINGT_CODE]    = SUNLINGHT;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_LINGT_CODE] = SUNLINGHT;


            //环境温度0.1 ℃
            double ENRIONMENTTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            ENRIONMENTTEMPRATURE = Math.Round(ENRIONMENTTEMPRATURE * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATURE]             = ENRIONMENTTEMPRATURE;
            historyMonitorMap[MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATURE]          = ENRIONMENTTEMPRATURE;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_AMBIENTTEMP_CODE]    = ENRIONMENTTEMPRATURE;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_AMBIENTTEMP_CODE] = ENRIONMENTTEMPRATURE;

            //电池板温度0.1 ℃
            double PANELTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PANELTEMPRATURE = Math.Round(PANELTEMPRATURE * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_PANELTEMPRATURE]    = PANELTEMPRATURE;
            historyMonitorMap[MonitorType.MIC_DETECTOR_PANELTEMPRATURE] = PANELTEMPRATURE;

            //风速(0.1 m/s)
            double WINDSPEED = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            WINDSPEED = Math.Round(WINDSPEED * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_WINDSPEED]                 = WINDSPEED;
            historyMonitorMap[MonitorType.MIC_DETECTOR_WINDSPEED]              = WINDSPEED;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_WINDSPEED]    = WINDSPEED;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_WINDSPEED] = WINDSPEED;


            // 日辐射量 0.01 Wh/m2
            double radiation = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            radiation = Math.Round(radiation * 0.01, 2);
            realMonitorMap[MonitorType.MIC_DETECTOR_DAYRADIATION]                 = radiation;
            historyMonitorMap[MonitorType.MIC_DETECTOR_DAYRADIATION]              = radiation;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_DAYRADIATION]    = radiation;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_DAYRADIATION] = radiation;

            // 总辐射量 0.01 Wh/m2
            double totalradiation = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            totalradiation = Math.Round(totalradiation * 0.01, 2);
            realMonitorMap[MonitorType.MIC_DETECTOR_TOTALRADIATION]                 = totalradiation;
            historyMonitorMap[MonitorType.MIC_DETECTOR_TOTALRADIATION]              = totalradiation;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_TOTALRADIATION]    = totalradiation;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_TOTALRADIATION] = totalradiation;


            todaySunshine = radiation;
            //风向度数	U16	0.1 度暂不考虑

            //风向7 位格雷码是啥意思?
            //int WINDDIRECTION = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 8, 'u');
            //realMonitorMap[MonitorType.MIC_DETECTOR_WINDDIRECTION] = WINDDIRECTION;
            //historyMonitorMap[MonitorType.MIC_DETECTOR_WINDDIRECTION] = WINDDIRECTION;
            //message.realMonitorMap[MonitorType.PLANT_MONITORITEM_WINDDIRECTION] = WINDDIRECTION;
            //message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_WINDDIRECTION] = WINDDIRECTION;
            tableType = TableUtil.DETECTOR;
        }
Beispiel #12
0
        int deviceDataHeadLength = 5;//5字节
        /// <summary>
        /// 根据逆变器光伏阵列汇流箱通讯协议(Modbus)V1.1.1.0解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);

            //最大接入路数
            int MAXLINE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_MAXLINE] = MAXLINE;

            //直流母线电压0.1V
            double DCUXVOLT = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            DCUXVOLT = Math.Round(DCUXVOLT * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_DCUXVOLT] = DCUXVOLT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DCUXVOLT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DCUXVOLT] = DCUXVOLT;
            }

            //机内温度0.1℃
            double JNTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(14 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            JNTEMPRATURE = Math.Round(JNTEMPRATURE * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_JNTEMPRATURE] = JNTEMPRATURE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_JNTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_JNTEMPRATURE] = JNTEMPRATURE;
            }

            //数字输入
            int ATAINPUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DIGITALINPUT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            }

            //最大电流0.01A
            double maxcurrent = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            maxcurrent = Math.Round(maxcurrent * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_MAXCURRENT] = maxcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_MAXCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_MAXCURRENT] = maxcurrent;
            }

            //平均电流0.01A
            double avgcurrent = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            avgcurrent = Math.Round(avgcurrent * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_AVGCURRENT] = avgcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_AVGCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_AVGCURRENT] = avgcurrent;
            }

            //第一路电流0.01A
            double CURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'U');

            CURRENT1 = Math.Round(CURRENT1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_1CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            }

            //第二路电流0.01A
            double CURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'U');

            CURRENT2 = Math.Round(CURRENT2 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_2CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            }

            //第三路电流0.01A
            double CURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT3 = Math.Round(CURRENT3 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_3CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            }

            //第四路电流0.01A
            double CURRENT4 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT4 = Math.Round(CURRENT4 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_4CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            }

            //第五路电流0.01A
            double CURRENT5 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_5CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            }

            //第六路电流0.01A
            double CURRENT6 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT6 = Math.Round(CURRENT6 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_6CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            }

            //第七路电流0.01A
            double CURRENT7 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT7 = Math.Round(CURRENT7 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_7CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            }

            //第八路电流0.01A
            double CURRENT8 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT8 = Math.Round(CURRENT8 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_8CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            }

            //第九路电流0.01A
            double CURRENT9 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT9 = Math.Round(CURRENT9 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_9CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            }

            //第十路电流0.01A
            double CURRENT10 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT10 = Math.Round(CURRENT10 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_10CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            }

            //第十一路电流0.01A
            double CURRENT11 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT11 = Math.Round(CURRENT11 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_11CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            }

            //第十二路电流0.01A
            double CURRENT12 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT12 = Math.Round(CURRENT12 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_12CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            }

            //第十三路电流0.01A
            double CURRENT13 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(50 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT13 = Math.Round(CURRENT13 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_13CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            }

            //第十四路电流0.01A
            double CURRENT14 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(52 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT14 = Math.Round(CURRENT14 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_14CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            }

            // 第十五路电流0.01A
            double CURRENT15 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT15 = Math.Round(CURRENT15 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_15CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            }

            // 第十六路电流0.01A
            double CURRENT16 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(56 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT16 = Math.Round(CURRENT16 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_16CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            }

            //总电流0.1A
            double totalC = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(62 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            totalC = Math.Round(totalC * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT]    = totalC;
            historyMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT] = totalC;

            //状态
            int status = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(82 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            realMonitorMap[MonitorType.MIC_BUSBAR_STATUS]    = status;
            historyMonitorMap[MonitorType.MIC_BUSBAR_STATUS] = status;

            //短路数据
            int dxdata = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(86 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            realMonitorMap[MonitorType.MIC_BUSBAR_DUANLUDATA]    = dxdata;
            historyMonitorMap[MonitorType.MIC_BUSBAR_DUANLUDATA] = dxdata;

            //电流过高数据
            int dlgg = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(94 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            realMonitorMap[MonitorType.MIC_BUSBAR_DLGGDATA]    = dlgg;
            historyMonitorMap[MonitorType.MIC_BUSBAR_DLGGDATA] = dlgg;

            //电流过低数据
            int dlgd = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(102 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            realMonitorMap[MonitorType.MIC_BUSBAR_DLGDDATA]    = dlgd;
            historyMonitorMap[MonitorType.MIC_BUSBAR_DLGDDATA] = dlgd;

            //开路数据
            int kailudata = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(110 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            realMonitorMap[MonitorType.MIC_BUSBAR_KAILUDATA]    = kailudata;
            historyMonitorMap[MonitorType.MIC_BUSBAR_KAILUDATA] = kailudata;

            deviceType = TableUtil.HUILIUXIANG;
        }
Beispiel #13
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据汇流箱sungorw协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号 此协议中无此数据
            //base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //按照测点在协议中的顺序依次解析具体测点数据
            //第一路电流 0.1A
            double current1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(0 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current1 = Math.Round(current1 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = current1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_1CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = current1;
            }
            //第二路电流
            double current2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current2 = Math.Round(current2 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = current2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_2CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = current2;
            }
            //三路电流
            double current3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current3 = Math.Round(current3 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = current3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_3CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = current3;
            }
            //第四路电流
            double current4 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current4 = Math.Round(current4 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = current4;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_4CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = current4;
            }
            //第五路电流
            double current5 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current5 = Math.Round(current5 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = current5;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_5CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = current5;
            }
            //第六路电流
            double current6 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(5 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current6 = Math.Round(current6 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = current6;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_6CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = current6;
            }
            //第七路电流
            double current7 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current7 = Math.Round(current7 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = current7;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_7CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = current7;
            }
            //第八路电流
            double current8 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(7 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current8 = Math.Round(current8 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = current8;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_8CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = current8;
            }
            //第九路电流
            double current9 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current9 = Math.Round(current9 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = current9;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_9CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = current9;
            }
            //第十路电流
            double current10 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(9 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current10 = Math.Round(current10 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = current10;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_10CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = current10;
            }
            //第十路电流
            double current11 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(10 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current11 = Math.Round(current11 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = current11;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_11CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = current11;
            }
            //第十二路电流
            double current12 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(11 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current12 = Math.Round(current12 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = current12;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_12CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = current12;
            }
            //第十三路电流
            double current13 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current13 = Math.Round(current13 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = current13;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_13CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = current13;
            }
            //第十四路电流
            double current14 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(13 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current14 = Math.Round(current14 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = current14;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_14CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = current14;
            }
            //第十五路电流
            double current15 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(14 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current15 = Math.Round(current15 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = current15;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_15CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = current15;
            }
            //第十六路电流
            double current16 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(15 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            current16 = Math.Round(current16 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = current16;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_16CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = current16;
            }

            //阵列电压
            int ZLVOILT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(17 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            current3 = Math.Round(current3 * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_ZLVOILT] = ZLVOILT;

            //数字输入
            int DIGITALINPUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(19 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = DIGITALINPUT;
            //继电器输出
            int JDQOUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_JDQOUT] = JDQOUT;
            //接入传感器路数
            int CGQLINENUM = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(21 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_CGQLINENUM] = CGQLINENUM;
            //通讯类型 bank不显示
            int COMMUNICATION = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //realMonitorMap[MonitorType.MIC_BUSBAR_COMMUNICATION] =COMMUNICATION;


            //总电流
            double totalC = current1 + current2 + current3 + current4 + current5
                            + current6 + current7 + current8 + current9 + current10 + current11 + current12 +
                            +current13 + current14 + current15 + current16;

            realMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT]    = totalC;
            historyMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT] = totalC;

            tableType = TableUtil.CABINET;
        }
Beispiel #14
0
        int deviceDataHeadLength = 5;//5字节
        /// <summary>
        /// 根据逆变器光伏直流配电柜通信协议(Modbus)V1.0-柴达木-2011.8.30.pdf解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);

            //数字输入
            int ATAINPUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DIGITALINPUT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;
            }

            //最大电流0.01A
            double maxcurrent = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            maxcurrent = Math.Round(maxcurrent * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_MAXCURRENT] = maxcurrent;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_MAXCURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_MAXCURRENT] = maxcurrent;
            }

            //第一路电流0.01A
            double CURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT1 = Math.Round(CURRENT1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_1CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            }
            //第二路电流0.01A
            double CURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT2 = Math.Round(CURRENT2 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_2CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            }
            //第三路电流0.01A
            double CURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT3 = Math.Round(CURRENT3 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_3CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            }
            //第四路电流0.01A
            double CURRENT4 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT4 = Math.Round(CURRENT4 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_4CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            }

            //第五路电流0.01A
            double CURRENT5 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_5CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            }
            //第六路电流0.01A
            double CURRENT6 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT6 = Math.Round(CURRENT6 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_6CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            }
            //第七路电流0.01A
            double CURRENT7 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT7 = Math.Round(CURRENT7 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_7CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            }
            //第八路电流0.01A
            double CURRENT8 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT8 = Math.Round(CURRENT8 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_8CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            }

            //第九路电流0.01A
            double CURRENT9 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT9 = Math.Round(CURRENT9 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_9CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            }

            //第十路电流0.01A
            double CURRENT10 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT10 = Math.Round(CURRENT10 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_10CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            }
            //第十一路电流0.01A
            double CURRENT11 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT11 = Math.Round(CURRENT11 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_11CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            }
            //第十二路电流0.01A
            double CURRENT12 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT12 = Math.Round(CURRENT12 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_12CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            }
            //第十三路电流0.01A
            double CURRENT13 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(50 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT13 = Math.Round(CURRENT13 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_13CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            }
            //第十四路电流0.01A
            double CURRENT14 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(52 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT14 = Math.Round(CURRENT14 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_14CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            }

            // 第十五路电流0.01A
            double CURRENT15 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(54 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT15 = Math.Round(CURRENT15 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_15CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            }

            // 第十六路电流0.01A
            double CURRENT16 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(56 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT16 = Math.Round(CURRENT16 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_16CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            }

            //总电流0.1A
            double totalC = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(62 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'U');

            totalC = Math.Round(totalC * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT]    = totalC;
            historyMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT] = totalC;

            deviceType = TableUtil.CABINET;
        }
Beispiel #15
0
        int deviceDataHeadLength = 5;//5字节
        /// <summary>
        /// 根据逆变器modbus协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号
            base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //最大接入路数
            int MAXLINE = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_BUSBAR_MAXLINE] = MAXLINE;
            //机内温度0.1℃
            double JNTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            JNTEMPRATURE = Math.Round(JNTEMPRATURE * 0.1, 1);
            realMonitorMap[MonitorType.MIC_BUSBAR_JNTEMPRATURE] = JNTEMPRATURE;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_JNTEMPRATURE))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_JNTEMPRATURE] = JNTEMPRATURE;
            }
            //直流母线电压0.1V
            double DCUXVOLT = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            DCUXVOLT = Math.Round(DCUXVOLT * 0.1, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_DCUXVOLT] = DCUXVOLT;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DCUXVOLT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_DCUXVOLT] = DCUXVOLT;
            }
            //数字输入
            int ATAINPUT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 4 * hexbytecharnum), true, 32, 'u');

            //if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_DIGITALINPUT))
            //historyMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;

            //数字输入modify by qhb in 20120825 for 新需求《数据处理新需求整理及工作量评估-调整》这个是U16的,16个字节 ,其中0-4字节用了,其他字节没用,现在要按附录一解析,将一个变量拆成2个 ,分别是防雷器和断路器,界面用2个圆灯表示  ,正常灯是绿色 ,不正常灯是红色,防雷器状态 为1表示正常 ,断路器 为0表示正常。
            //modify by qhb in 20120825 for 将十进制转化为二进制,然后从后开始依次是bit0 bit1
            //string inputstr = getFullbitstr(ATAINPUT, 16);
            realMonitorMap[MonitorType.MIC_BUSBAR_DIGITALINPUT] = ATAINPUT;

            //第一路电流0.01A
            double CURRENT1 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(18 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT1 = Math.Round(CURRENT1 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_1CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_1CURRENT] = CURRENT1;
            }
            //第二路电流0.01A
            double CURRENT2 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT2 = Math.Round(CURRENT2 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_2CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_2CURRENT] = CURRENT2;
            }
            //第三路电流0.01A
            double CURRENT3 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(22 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT3 = Math.Round(CURRENT3 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_3CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_3CURRENT] = CURRENT3;
            }
            //第四路电流0.01A
            double CURRENT4 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT4 = Math.Round(CURRENT4 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_4CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_4CURRENT] = CURRENT4;
            }

            //第五路电流0.01A
            double CURRENT5 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT5 = Math.Round(CURRENT5 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_5CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_5CURRENT] = CURRENT5;
            }
            //第六路电流0.01A
            double CURRENT6 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(28 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT6 = Math.Round(CURRENT6 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_6CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_6CURRENT] = CURRENT6;
            }
            //第七路电流0.01A
            double CURRENT7 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(30 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT7 = Math.Round(CURRENT7 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_7CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_7CURRENT] = CURRENT7;
            }
            //第八路电流0.01A
            double CURRENT8 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(32 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT8 = Math.Round(CURRENT8 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_8CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_8CURRENT] = CURRENT8;
            }

            //第九路电流0.01A
            double CURRENT9 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(34 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT9 = Math.Round(CURRENT9 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_9CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_9CURRENT] = CURRENT9;
            }

            //第十路电流0.01A
            double CURRENT10 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(36 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT10 = Math.Round(CURRENT10 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_10CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_10CURRENT] = CURRENT10;
            }
            //第十一路电流0.01A
            double CURRENT11 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(38 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT11 = Math.Round(CURRENT11 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_11CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_11CURRENT] = CURRENT11;
            }
            //第十二路电流0.01A
            double CURRENT12 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT12 = Math.Round(CURRENT12 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_12CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_12CURRENT] = CURRENT12;
            }
            //第十三路电流0.01A
            double CURRENT13 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(42 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT13 = Math.Round(CURRENT13 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_13CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_13CURRENT] = CURRENT13;
            }
            //第十四路电流0.01A
            double CURRENT14 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT14 = Math.Round(CURRENT14 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_14CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_14CURRENT] = CURRENT14;
            }

            // 第十五路电流0.01A
            double CURRENT15 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT15 = Math.Round(CURRENT15 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_15CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_15CURRENT] = CURRENT15;
            }

            // 第十六路电流0.01A
            double CURRENT16 = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(48 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            CURRENT16 = Math.Round(CURRENT16 * 0.01, 2);
            realMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_BUSBAR_16CURRENT))
            {
                historyMonitorMap[MonitorType.MIC_BUSBAR_16CURRENT] = CURRENT16;
            }

            //总电流
            double totalC = CURRENT1 + CURRENT2 + CURRENT3 + CURRENT4 + CURRENT5
                            + CURRENT6 + CURRENT7 + CURRENT8 + CURRENT9 + CURRENT10 + CURRENT11 + CURRENT12 +
                            +CURRENT13 + CURRENT14 + CURRENT15 + CURRENT16;

            realMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT]    = totalC;
            historyMonitorMap[MonitorType.MIC_BUSBAR_TOTALCURRENT] = totalC;

            tableType = TableUtil.HUILIUXIANG;
        }
Beispiel #16
0
        /// <summary>
        /// 根据协议解析
        /// </summary>
        public static IList <DeviceInfo> analysis(string deviceData)
        {
            //deviceData = "69 69 01 00 C3 00 00 00 01 00 01 00 00 00 02 00 0B 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 E4 B8 AD E5 9B BD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E5 8C 97 E4 BA AC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 34 08 00 00 00 AF 00 00 B1 65 C9";
            IList <DeviceInfo> devices = new List <DeviceInfo>();

            string infoData = deviceData.Substring(4 * 2);
            //解析多个信息体
            //每个设备信息体开始下标
            int startIndex = 0;
            //每个设备信息体结束下标
            int endIndex = 68;

            if (infoData.Length % (88 * 2) == 0)
            {
                endIndex = 88;
            }
            //逐个取出信息体
            string     info;
            DeviceInfo device = null;

            while (infoData.Length > 0)
            {
                device = new DeviceInfo();
                info   = infoData.Substring(startIndex * 2, endIndex * 2);
                //没有数据就退出
                if (string.IsNullOrEmpty(info))
                {
                    return(devices);
                }

                //设备地址
                int address = (int)SystemCode.HexNumberToDenary(info.Substring(0 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');
                device.address = address;

                //设备型号
                int model = (int)SystemCode.HexNumberToDenary(info.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');
                device.typemodel = model;

                //设备名称
                string name = StringUtil.Hex2UTF8(info.Substring(4 * hexbytecharnum, 32 * hexbytecharnum));
                device.name = name;

                //设备厂家      32个字节  UTF-8
                string fac = StringUtil.Hex2UTF8(info.Substring(36 * hexbytecharnum, 32 * hexbytecharnum));
                //device.name = fac;
                if (endIndex == 88)
                {
                    //设备序列号 16个字节 UTF-8
                    string sn = StringUtil.Hex2UTF8(info.Substring(68 * hexbytecharnum, 16 * hexbytecharnum));
                    //device.name = name;

                    //整机版本 4个字节 U8
                    int v1 = (int)SystemCode.HexNumberToDenary(info.Substring(84 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
                    int v2 = (int)SystemCode.HexNumberToDenary(info.Substring(85 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
                    int v3 = (int)SystemCode.HexNumberToDenary(info.Substring(86 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
                    int v4 = (int)SystemCode.HexNumberToDenary(info.Substring(87 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
                    //device.name = name;
                }
                devices.Add(device);

                infoData = infoData.Substring(endIndex * 2);
            }
            return(devices);
        }
Beispiel #17
0
        /// <summary>
        /// 根据环境检测仪sungrow协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //设备型号 此协议中无此数据
            //base.deviceXh = (int)SystemCode.HexNumberToDenary(deviceData.Substring(deviceDataHeadLength * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //按照测点在协议中的顺序依次解析具体测点数据
            //每个数据的高位字节在前,低位字节在后
            /// <summary>
            /// Soi(ED)
            /// </summary>
            int SOI = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(0 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_DETECTOR_SOI] = SOI;
            //Adr
            int ADR = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');

            realMonitorMap[MonitorType.MIC_DETECTOR_ADR] = deviceAddress;
            //日照强度(W/m2
            int SUNLINGHT = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(12 * hexbytecharnum, 4 * hexbytecharnum), false, 32, 'u');

            realMonitorMap[MonitorType.MIC_DETECTOR_SUNLINGHT]                  = SUNLINGHT;
            historyMonitorMap[MonitorType.MIC_DETECTOR_SUNLINGHT]               = SUNLINGHT;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_LINGT_CODE]    = SUNLINGHT;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_LINGT_CODE] = SUNLINGHT;

            //电池板温度
            double PANELTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(19 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');

            PANELTEMPRATURE = Math.Round(PANELTEMPRATURE, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_PANELTEMPRATURE]    = PANELTEMPRATURE;
            historyMonitorMap[MonitorType.MIC_DETECTOR_PANELTEMPRATURE] = PANELTEMPRATURE;

            //环境温度
            double ENRIONMENTTEMPRATURE = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(23 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 's');

            ENRIONMENTTEMPRATURE = Math.Round(ENRIONMENTTEMPRATURE, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATURE]             = ENRIONMENTTEMPRATURE;
            historyMonitorMap[MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATURE]          = ENRIONMENTTEMPRATURE;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_AMBIENTTEMP_CODE]    = ENRIONMENTTEMPRATURE;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_AMBIENTTEMP_CODE] = ENRIONMENTTEMPRATURE;

            //电池板温度(0.1℃)高精度
            double PANELTEMPRATUREHIGH = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            PANELTEMPRATUREHIGH = Math.Round(PANELTEMPRATUREHIGH * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_PANELTEMPRATUREHIGH]    = PANELTEMPRATUREHIGH;
            historyMonitorMap[MonitorType.MIC_DETECTOR_PANELTEMPRATUREHIGH] = PANELTEMPRATUREHIGH;


            //环境温度(0.1℃)高精度
            double NRIONMENTTEMPRATUREHIGH = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(26 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 's');

            NRIONMENTTEMPRATUREHIGH = Math.Round(NRIONMENTTEMPRATUREHIGH * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATUREHIGH]    = NRIONMENTTEMPRATUREHIGH;
            historyMonitorMap[MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATUREHIGH] = NRIONMENTTEMPRATUREHIGH;

            //风速(m/s)
            int WINDSPEED = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(40 * hexbytecharnum, 4 * hexbytecharnum), false, 32, 'u');

            realMonitorMap[MonitorType.MIC_DETECTOR_WINDSPEED]                 = WINDSPEED;
            historyMonitorMap[MonitorType.MIC_DETECTOR_WINDSPEED]              = WINDSPEED;
            message.realMonitorMap[MonitorType.PLANT_MONITORITEM_WINDSPEED]    = WINDSPEED;
            message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_WINDSPEED] = WINDSPEED;

            //风速(0.1m/s)高精度
            double WINDSPEEDHIGH = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(44 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            WINDSPEEDHIGH = Math.Round(WINDSPEEDHIGH * 0.1, 1);
            realMonitorMap[MonitorType.MIC_DETECTOR_WINDSPEEDHIGH]    = WINDSPEEDHIGH;
            historyMonitorMap[MonitorType.MIC_DETECTOR_WINDSPEEDHIGH] = WINDSPEEDHIGH;

            //斜面日照强度(W/m2)
            int XMRZQD = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(46 * hexbytecharnum, 2 * hexbytecharnum), false, 16, 'u');

            realMonitorMap[MonitorType.MIC_DETECTOR_XMRZQD]    = XMRZQD;
            historyMonitorMap[MonitorType.MIC_DETECTOR_XMRZQD] = XMRZQD;

            //风向7 位格雷码是啥意思?
            //int WINDDIRECTION = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(52 * hexbytecharnum, 1 * hexbytecharnum), false, 8, 'u');
            //realMonitorMap[MonitorType.MIC_DETECTOR_WINDDIRECTION] = WINDDIRECTION;
            //historyMonitorMap[MonitorType.MIC_DETECTOR_WINDDIRECTION] = WINDDIRECTION;
            //message.realMonitorMap[MonitorType.PLANT_MONITORITEM_WINDDIRECTION] = WINDDIRECTION;
            //message.historyMonitorMap[MonitorType.PLANT_MONITORITEM_WINDDIRECTION] = WINDDIRECTION;

            deviceType = TableUtil.DETECTOR;
        }
Beispiel #18
0
        int deviceDataHeadLength = 5;//5字节

        /// <summary>
        /// 根据逆变器sungrow协议解析单个设备数据
        /// </summary>
        public void analysis()
        {
            //deviceData
            //地址
            base.deviceAddress = SystemCode.HexNumberToDenary(deviceData.Substring(1 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u').ToString();
            //设备版本
            int largeVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(3 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');
            int smallVersion = (int)SystemCode.HexNumberToDenary(deviceData.Substring(4 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            base.deviceVersion = largeVersion + "." + smallVersion;
            //设备协议类型
            base.protocolType = (int)SystemCode.HexNumberToDenary(deviceData.Substring(2 * hexbytecharnum, 1 * hexbytecharnum), true, 8, 'u');

            //测点数据串去掉设备数据的头部
            string monitorstr = deviceData.Substring(deviceDataHeadLength * hexbytecharnum);
            //按照测点在协议中的顺序依次解析具体测点数据
            //交流电压 0.1
            double av = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(0 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            av = Math.Round(av * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_AV]    = av;
            historyMonitorMap[MonitorType.MIC_INVERTER_AV] = av;
            //交流电流
            double ac = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(2 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            ac = Math.Round(ac * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_AC]    = ac;
            historyMonitorMap[MonitorType.MIC_INVERTER_AC] = ac;
            //直流电压
            double dv = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(4 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            dv = Math.Round(dv * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DV]    = dv;
            historyMonitorMap[MonitorType.MIC_INVERTER_DV] = dv;
            //直流电流
            double dc = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(6 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            dc = Math.Round(dc * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DC]    = dc;
            historyMonitorMap[MonitorType.MIC_INVERTER_DC] = dc;
            //逆变器温度 为补吗是啥意思?
            double invertertemprature = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(8 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            invertertemprature = Math.Round(invertertemprature * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_INVETERTEMPRATURE]    = invertertemprature;
            historyMonitorMap[MonitorType.MIC_INVERTER_INVETERTEMPRATURE] = invertertemprature;

            //日发电量
            double todayEnergy = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(10 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            todayEnergy = Math.Round(todayEnergy * 0.1, 3);
            realMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY]    = todayEnergy;
            historyMonitorMap[MonitorType.MIC_INVERTER_TODAYENERGY] = todayEnergy;
            base.todayEnergy = todayEnergy;

            //交流发电量即总发电量
            string acEnergyStr = SystemCode.ReversionTwo(monitorstr.Substring(12 * hexbytecharnum, 4 * hexbytecharnum));
            long   acEnergy    = SystemCode.HexNumberToDenary(acEnergyStr, false, 32, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_ACENERGY]    = acEnergy;
            historyMonitorMap[MonitorType.MIC_INVERTER_ACENERGY] = acEnergy;
            //状态信息
            int statusinfo = (int)SystemCode.HexNumberToDenary(monitorstr.Substring(16 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            realMonitorMap[MonitorType.MIC_INVERTER_DEVICESTATUS] = statusinfo;
            //电网频率
            double dwpl = (double)SystemCode.HexNumberToDenary(monitorstr.Substring(20 * hexbytecharnum, 2 * hexbytecharnum), true, 16, 'u');

            dwpl = Math.Round(dwpl * 0.1, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_DWPL]    = dwpl;
            historyMonitorMap[MonitorType.MIC_INVERTER_DWPL] = dwpl;

            //总有功功率,协议中无要加工交流电压*交流电流
            double totalygpower = av * ac;

            totalygpower = Math.Round(totalygpower, 1);
            realMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            if (MonitorType.historyMonitorList.Contains(MonitorType.MIC_INVERTER_TOTALYGPOWER))
            {
                historyMonitorMap[MonitorType.MIC_INVERTER_TOTALYGPOWER] = totalygpower;
            }

            //设备型号 25序号的是设备型号,单字节无符号整型
            string xh = monitorstr.Substring(24 * hexbytecharnum, 2 * hexbytecharnum);

            if (!xh.Equals("00") && !xh.Equals("0"))
            {
                base.deviceXh = (int)SystemCode.HexNumberToDenary(xh, true, 8, 'u');
            }

            deviceType = TableUtil.INVERTER_TABLE_NAME;
        }