Exemple #1
0
        public static Oltcdiffer GetOltcNum(OltcUpandata oltc)
        {
            Oltcdiffer od = new Oltcdiffer();

            od.Function      = 6;
            od.windingconfig = GetWindkind(oltc.Windkind);
            od.windingtype   = 0;
            od.TapLabel      = oltc.windposition;
            return(od);
        }
        private static OltcUpandata[] ReadOltc(string DciPath)
        {
            try
            {
                string[]       filenum = Directory.GetFiles(DciPath);
                OltcUpandata[] DciData = new OltcUpandata[filenum.Length];
                for (int i = 1; i <= filenum.Length; i++)
                {
                    if (File.Exists(DciPath + "\\" + NumCorrection.KeepNum(i.ToString(), 2, HeadOrTail.Head) + ".ini"))
                    {
                        INIFiLE myini = new INIFiLE(DciPath + "\\" + NumCorrection.KeepNum(i.ToString(), 2, HeadOrTail.Head) + ".ini");
                        DciData[i - 1].Data              = myini.ReadString("result", "Date", "");
                        DciData[i - 1].Time              = myini.ReadString("result", "Time", "");
                        DciData[i - 1].Windkind          = myini.ReadString("result", "绕组类型", "");
                        DciData[i - 1].windposition      = myini.ReadString("result", "分接位置", "");
                        DciData[i - 1].Current           = myini.ReadString("result", "试验电流", "");
                        DciData[i - 1].Protectresistance = myini.ReadString("result", "触发电阻", "");
                        DciData[i - 1].Starttime         = myini.ReadString("result", "触发时间", "");

                        for (int j = 1; j < 25; j++)
                        {
                            DciData[i - 1].Awaveform += myini.ReadString("result", "A" +
                                                                         NumCorrection.KeepNum(j.ToString(), 2, HeadOrTail.Head), "");
                        }
                        DciData[i - 1].Awaveform += myini.ReadString("result", "AED", "");
                        for (int j = 1; j < 25; j++)
                        {
                            DciData[i - 1].Bwaveform += myini.ReadString("result", "B" +
                                                                         NumCorrection.KeepNum(j.ToString(), 2, HeadOrTail.Head), "");
                        }
                        DciData[i - 1].Bwaveform += myini.ReadString("result", "BED", "");
                        for (int j = 1; j < 25; j++)
                        {
                            DciData[i - 1].Cwaveform += myini.ReadString("result", "C" +
                                                                         NumCorrection.KeepNum(j.ToString(), 2, HeadOrTail.Head), "");
                        }
                        DciData[i - 1].Cwaveform += myini.ReadString("result", "CED", "");
                        for (int j = 1; j < 25; j++)
                        {
                            DciData[i - 1].Dwaveform += myini.ReadString("result", "D" +
                                                                         NumCorrection.KeepNum(j.ToString(), 2, HeadOrTail.Head), "");
                        }
                        DciData[i - 1].Dwaveform += myini.ReadString("result", "DED", "");
                        DciData[i - 1].Error      = myini.ReadString("result", "Error", "");
                    }
                }
                return(DciData);
            }
            catch { throw new Exception("有载分接地址错误"); }
        }
        private DataRow UsbToRow(OltcUpandata oltc)
        {
            System.Data.DataRow row = WorkingSets.local.TestResults.NewRow();

            try { row["testname"] = jobInfo.Information.testingName; } catch { }
            try { row["testid"] = jobInfo.Information.GetHashCode(); } catch { }
            try { row["transformerid"] = jobInfo.Transformer.ID; } catch { }
            try { row["mj_id"] = jobInfo.id; } catch { }

            try { row["function"] = GetIniFileData.GetOltcNum(oltc).Function; } catch { }
            try { row["windingtype"] = GetIniFileData.GetOltcNum(oltc).windingtype; } catch { }
            try { row["windingconfig"] = GetIniFileData.GetOltcNum(oltc).windingconfig; } catch { }
            try { row["failed"] = 0; } catch { }
            try { row["completed"] = 1; } catch { }
            try { row["recordtime"] = oltc.Data; } catch { }
            string waves = oltc.Awaveform + oltc.Bwaveform + oltc.Cwaveform + oltc.Dwaveform;

            byte[] byteArray = Encoding.Default.GetBytes(waves);
            try { row["waves"] = Convert.ToBase64String(byteArray); } catch { }
            return(row);
        }