Exemplo n.º 1
0
        //
        private void InfoIni()
        {
            DigitalGaugeControl5.SetUserControlInfo("0"); //温度

            lbBatteryVol.SetUserControlInfo("0");         //电池电压

            lgPVpower.SetUserControlInfo("0");            //PV功率

            lbDayEnergy.SetUserControlInfo("0");          //日发电量

            lgTotalEnergy.SetUserControlInfo("0");        //总发电量
        }
Exemplo n.º 2
0
        //设置模拟量
        private int SetAnalogData(List <AnalogModel> AnalogArray)
        {
            if (AnalogArray.Count < AnalogLen)
            {
                return(0);
            }

            //版本号
            VersionNumberText = VersionNumberName + float.Parse(AnalogArray[0].Value.ToString());

            devRt1.RefreshData(AnalogArray);

            try
            {
                //温度
                string[] tempStr = null;
                string   temp    = AnalogArray[5].Value.ToString();
                if (temp.LastIndexOf(".") > 0)
                {
                    tempStr = temp.Split(new char[1] {
                        '.'
                    });
                    temp = tempStr[0] + " " + "." + tempStr[1];
                }
                DigitalGaugeControl5.SetUserControlInfo(temp);//温度

                //电池电压
                temp = AnalogArray[8].Value.ToString();
                if (temp.LastIndexOf(".") > 0)
                {
                    tempStr = temp.Split(new char[1] {
                        '.'
                    });
                    temp = tempStr[0] + " " + "." + tempStr[1];
                }
                lbBatteryVol.SetUserControlInfo(temp);//电池电压

                //PV功率
                temp = AnalogArray[10].Value.ToString();
                if (temp.LastIndexOf(".") > 0)
                {
                    tempStr = temp.Split(new char[1] {
                        '.'
                    });
                    temp = tempStr[0] + " " + "." + tempStr[1];
                }
                lgPVpower.SetUserControlInfo(temp);//PV功率

                //日发电量
                temp = AnalogArray[11].Value.ToString();
                if (temp.LastIndexOf(".") > 0)
                {
                    tempStr = temp.Split(new char[1] {
                        '.'
                    });
                    temp = tempStr[0] + " " + "." + tempStr[1];
                }
                lbDayEnergy.SetUserControlInfo(temp);//日发电量

                //总发电量
                temp = AnalogArray[12].Value.ToString();
                if (temp.LastIndexOf(".") > 0)
                {
                    tempStr = temp.Split(new char[1] {
                        '.'
                    });
                    temp = tempStr[0] + " " + "." + tempStr[1];
                }
                lgTotalEnergy.SetUserControlInfo(temp);//总发电量
            }
            catch (Exception ex)
            {
                throw ex;
            }

            #region 设备当前时间

            string str1 = AnalogArray[22].Value.ToString();
            string str2 = AnalogArray[23].Value.ToString();
            string str3 = AnalogArray[24].Value.ToString();
            if (str1 != "0000" && str2 != "0000" && str3 != "0000")
            {
                string   str_YM = "20" + str1.Substring(0, 2) + "-" + str1.Substring(2, 2) + "-";
                string   str_DH = str2.Substring(0, 2) + " " + str2.Substring(2, 2) + ":";
                string   str_MS = str3.Substring(0, 2) + ":" + str3.Substring(2, 2);
                DateTime dt2;
                if (DateTime.TryParse(str_YM + str_DH + str_MS, out dt2))
                {
                    systemControlPage.ShowMachineTime(dt2);
                }
            }
            #endregion

            return(0);
        }