private void jianxiancheck() { FileStream dh; StreamReader readLine; char[] charSplit; string strLine; string[] array1; string output = null; string[] array2; string strLine2; char[] charSplit2 = new char[] { ' ' }; FileStream op; StreamWriter str1; FileStream dh2; StreamReader readLine2; if (!Check()) { return; } //NIULA pspniula = new NIULA(); //pspniula.CurrentCal(); N1Test.NBcal zl = new NBcal(); //zl.Show_KmRelia(1); zl.ZLpsp(); double yinzi = 0, capability = 0, volt = 0, current = 0, standvolt = 0, Rad_to_Deg = 57.29577951; PSPDEV benchmark = new PSPDEV(); benchmark.Type = "power"; benchmark.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; IList list3 = Services.BaseService.GetList("SelectPSPDEVBySvgUIDAndType", benchmark); if (list3 == null) { MessageBox.Show("请设置基准后再进行计算!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } foreach (PSPDEV dev in list3) { yinzi = Convert.ToDouble(dev.PowerFactor); capability = Convert.ToDouble(dev.StandardCurrent); volt = Convert.ToDouble(dev.StandardVolt); if (dev.PowerFactor == 0) { yinzi = 1; } if (dev.StandardCurrent == 0) { capability = 1; } if (dev.StandardVolt == 0) { volt = 1; } standvolt = volt; current = capability / (Math.Sqrt(3) * volt); } capability = 100; if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\DH1.txt")) { } else { return; } dh = new FileStream(System.Windows.Forms.Application.StartupPath + "\\DH1.txt", FileMode.Open); readLine = new StreamReader(dh); charSplit = new char[] { ' ' }; strLine = readLine.ReadLine(); output = null; while (!string.IsNullOrEmpty(strLine)) { array1 = strLine.Split(charSplit); string[] dev = new string[2]; dev.Initialize(); int i = 0; PSPDEV CR = new PSPDEV(); CR.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID; foreach (string str in array1) { if (str != "") { if (i == 0) { dev[i++] = str.ToString(); } else { if (str != "NaN") { dev[i++] = Convert.ToDouble(str).ToString(); } else { dev[i++] = str; } } } } CR.Name = dev[0]; CR.Type = "Polyline"; CR = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByName", CR); if (CR != null && CR.ReferenceVolt != 0) { volt = CR.ReferenceVolt; } else volt = standvolt; current = capability / (Math.Sqrt(3) * volt); if (CR != null) { if (CR.LineStatus == "待选") { for (int n = 0; n < waitlinecoll.Count; n++) //加入线路功率 { if (waitlinecoll[n].linename == CR.Name) { double linepij = System.Math.Abs(Convert.ToDouble(dev[1])) * capability; XmlNode el = tlVectorControl1.SVGDocument.SelectSingleNode("svg/polyline[@layer='" + tlVectorControl1.SVGDocument.CurrentLayer.ID + "' and @id='" + CR.EleID + "']"); double linevalue = 0; if (!string.IsNullOrEmpty(((XmlElement)el).GetAttribute("linevalue"))) { linevalue = Convert.ToDouble(((XmlElement)el).GetAttribute("linevalue")); } else linevalue = 1; waitlinecoll[n].Suid = CR.SUID; waitlinecoll[n].linepij = linepij; waitlinecoll[n].linevalue = linevalue; waitlinecoll[n].linetouzilv = linepij / linevalue; } } } //output += "'" + CR.Name.ToString() + "," + (Convert.ToDouble(dev[3]) * capability).ToString() + "," + (Convert.ToDouble(dev[4]) * capability).ToString() + "," + (Convert.ToDouble(dev[5]) * capability).ToString() + "," + (Convert.ToDouble(dev[6]) * capability).ToString() + "," + (Convert.ToDouble(dev[7]) * current).ToString() + "," + (Convert.ToDouble(dev[8]) * Rad_to_Deg).ToString() + "," + dev[11] + "," + "\r\n"; } strLine = readLine.ReadLine(); } readLine.Close(); waitlinecoll.Sort(); //进行大小排序 然后进行直流方法的检验 bool lineflag = true; //只要有一个不合格则就为不合格 bool jielieflag = true; //判断有没有线路解裂 for (int i = 0; i < waitlinecoll.Count; i++) { N1Test.NBcal kk = new N1Test.NBcal(); kk.Show_KmRelia(waitlinecoll[i].linenum); if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\ZL.txt")) { } else { return; } dh2 = new FileStream(System.Windows.Forms.Application.StartupPath + "\\ZL.txt", FileMode.Open); readLine2 = new StreamReader(dh2); charSplit2 = new char[] { ' ' }; strLine2 = readLine2.ReadLine(); output = null; while (!string.IsNullOrEmpty(strLine2)) { array2 = strLine2.Split(charSplit2); string[] dev = new string[2 * brchcount + 1]; dev.Initialize(); PSPDEV CR = new PSPDEV(); CR.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID; int m = 0; foreach (string str in array2) { if (str != "") { dev[m++] = str.ToString(); } } //进行解裂和负荷判断 if (dev[1] != "-1") { for (int j = 0; j < brchcount; j++) { double pij = System.Math.Abs(Convert.ToDouble(dev[j * 2 + 2])) * capability; PSPDEV psp = new PSPDEV(); psp.Name = dev[j * 2 + 1]; psp.Type = "Polyline"; psp.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID; IList listName = Services.BaseService.GetList("SelectPSPDEVByName", psp); PSPDEV pspline = (PSPDEV)listName[0]; double voltR = pspline.VoltR; WireCategory wirewire = new WireCategory(); wirewire.WireType = pspline.LineType; if (string.IsNullOrEmpty(pspline.LineType)) { MessageBox.Show(pspline.Name + "的线路类型没有输入,无法进行可靠性检验", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } WireCategory listware = (WireCategory)Services.BaseService.GetObject("SelectWireCategoryByKey", wirewire); double Ichange = (double)listware.WireChange; double linXij = System.Math.Sqrt(3) * voltR * Ichange / 1000; if (pij >= linXij) { lineflag = false; //lineclass _line = new lineclass(n, j); //Overlinp.Add(_line); // OverPhege[n] = j; } } } else { jielieflag = false; } if (jielieflag && lineflag) { readLine2.Close(); //关闭读取的文件 PSPDEV psp = new PSPDEV(); psp.Name = dev[0]; psp.Type = "Polyline"; psp.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID; IList listName = Services.BaseService.GetList("SelectPSPDEVByName", psp); PSPDEV pspline = (PSPDEV)listName[0]; pspline.LineStatus = "等待"; Services.BaseService.Update<PSPDEV>(pspline); jianxiancheck(); //进行下一轮的减线处理 return; } /* else break;*/ strLine2 = readLine2.ReadLine(); } readLine2.Close(); } // readLine2.Close(); }