Esempio n. 1
0
        /// <summary>
        ///�����߷�
        /// <param name="GprogUID">
        /// Ϊ�����Ż���ĿID
        /// </param>
        /// <param name="Type">
        /// Ϊ�Ǹ�ʱ�ڵ������Ż���1Ϊ���塢2���ڡ�3���ڡ�4Զ�ڣ�
        /// </param>
        /// </summary>
        public void addlinecheck(string GprogUID,int Type,double ratacapality)
        {
            FileStream dh;
               StreamReader readLine;
               char[] charSplit;
               string strLine;
               string[] array1;

               char[] charSplit2 = new char[] { ' ' };
               string strCon = null;
               linedengdai.Clear();
               if (Type==2)
               {
            strCon = "WHERE Type='05' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and ZTstatus ='��ѡ') ";
               }
               if (Type == 3)
               {
               strCon = "WHERE Type='05' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and JQstatus ='��ѡ') ";
               }
               if (Type ==4)
               {
               strCon = "WHERE Type='05' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and ZQstatus ='��ѡ') ";
               }
               PSPDEV pspdev = new PSPDEV();
               IList list1 = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
               for (int i = 0; i < list1.Count; i++)
               {
               bool flag=false;
               pspdev = list1[i] as PSPDEV;
               foreach (eleclass el in JDlinecol)
               {

                   if (el.suid==pspdev.SUID)
                   {
                       flag = true;
                   }
               }
               if (flag)
               {
                   pspdev.LineStatus = "�ȴ�";
                   linedengdai.Add(pspdev);
                   Services.BaseService.Update<PSPDEV>(pspdev);
               }

               }
               lineyiyou.Clear();            //�����һ�εļ�¼  Ϊ��һ��ʱ�ڵ�Ӧ����׼��

              // linedengdai.Clear();          //�����һ�μ�¼��ѡ��· Ϊ��һ��ʱ�ڵ�Ӧ����׼��

               AA:
               if (!fuhecheck(GprogUID,Type,ratacapality))
               {
               waitlineindex.Clear();
               for (int j = 0; j < linedengdai.Count; j++)
               {
                   if (!Checkadd(GprogUID,Type,ratacapality,linedengdai[j].SUID))
                       return;
                   N1Test.NBcal zl = new N1Test.NBcal();
                   zl.ZLpsp();

                   double yinzi = 0, capability = 0, volt = 0, current = 0, standvolt = 0, Rad_to_Deg = 57.29577951;
                   capability = ratacapality;
                   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, Encoding.Default);
                   charSplit = new char[] { ' ' };
                   strLine = readLine.ReadLine();
                   double sumpij = 0.0;
                   bool lineflag = true;
                   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;
                                   }

                               }
                           }

                       }
                       string con = " WHERE Type='05' AND Name='" + dev[0] + "'AND KSwitchStatus = '0' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
                      // string con = ",PSP_GprogElevice WHERE PSPDEV.Name='" + dev[0] + "' PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'";
                       CR = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition", con);
                       if (CR != null && CR.ReferenceVolt != 0)
                       {
                           volt = CR.ReferenceVolt;
                       }
                       else
                           volt = standvolt;
                       current = capability / (Math.Sqrt(3) * volt);
                       if (CR != null && !CR.Name.Contains("������·"))
                       {

                           double linepij = System.Math.Abs(Convert.ToDouble(dev[1])) * capability;
                           double voltR = CR.RateVolt;
                           double Ichange = (double)CR.Burthen;
                           double linXij = System.Math.Sqrt(3) * voltR * Ichange / 1000;

                           if (linepij >= linXij)
                           {
                               lineflag = false;

                           }
                           for (int k = 0; k < fuheline.Count; k++)
                           {
                               if (CR.SUID == fuheline[k].Suid)
                               {
                                   sumpij += System.Math.Abs(fuheline[k].linepij - linepij);
                               }
                           }

                       }
                       strLine = readLine.ReadLine();
                   }
                   readLine.Close();
                  //if (lineflag)              //���û�г��ֹ��������� ��ֹͣ���м���
                  // {
                  // //    PSPDEV pspb = (PSPDEV)linedengdai[j];
                  // //    pspb.LineStatus = "����";
                  // //    Services.BaseService.Update<PSPDEV>(pspb);
                  // //    lineyiyou.Add(pspb);
                  // //    for (int i = 0; i < linedengdai.Count; i++)
                  // //    {
                  // //        if (linedengdai[i].SUID == pspb.SUID)
                  // //        {
                  // //            linedengdai.RemoveAt(j);
                  // //        }
                  // //    }
                  //    return;
                  //  }
                   double linevalue = 0;
                   if (linedengdai[j].HuganTQ1!=0)
                   {
                       linevalue =linedengdai[j].HuganTQ1;
                   }
                   else
                       linevalue = 1;
                   linedaixuan linedai = new linedaixuan(linedengdai[j].Number, linedengdai[j].SUID, linedengdai[j].Name);
                   linedai.linepij = sumpij;
                   linedai.linevalue = linevalue;
                   linedai.linetouzilv = sumpij / linevalue;

                   waitlineindex.Add(linedai);
                   //}

               }
               waitlineindex.Sort();
               //�ڴ˴����ָ��������· ������·��״̬��Ϊ ���в��������еļ��������¼ �ڵȴ��ļ����ォ����·ȥ�� ���½�����һ�ֵIJ���
               PSPDEV pspbianhua = new PSPDEV();
               if (waitlineindex.Count > 0)
               {
                   pspbianhua.SUID = waitlineindex[waitlineindex.Count - 1].Suid;
               }
               else
               {
                   //MessageBox.Show("û�г��ֹ����ɵ���·������鿴һ����·�����Ƿ��趨��ȷ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                   return;
               }

               pspbianhua = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", pspbianhua);
               pspbianhua.LineStatus = "����";
               Services.BaseService.Update<PSPDEV>(pspbianhua);
               lineyiyou.Add(pspbianhua);
               for (int i = 0; i < linedengdai.Count; i++)
               {
                   if (linedengdai[i].SUID == pspbianhua.SUID)
                   {
                       linedengdai.RemoveAt(i);
                   }
               }

               goto AA;
               }
        }
Esempio n. 2
0
        /// <summary>
        /// ���߷�
        /// <param name="GprogUID">
        /// Ϊ�����Ż���ĿID
        /// </param>
        /// <param name="Type">
        /// Ϊ�Ǹ�ʱ�ڵ������Ż���1Ϊ���塢2���ڡ�3���ڡ�4Զ�ڣ�
        /// </param>
        /// </summary>
        public void jianxiancheck(string GprogUID,int Type,double ratedCapacity)
        {
            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(GprogUID,Type,ratedCapacity))
            {
                return ;
            }
            N1Test.NBcal zl = new N1Test.NBcal();
            zl.ZLpsp();

            double capability = 0, volt = 0, current = 0, standvolt = 0, Rad_to_Deg = 57.29577951;
            capability = ratedCapacity;
            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, Encoding.Default);
            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;
                            }

                        }
                    }

                }
               string con=" WHERE Type='05' AND Name='"+dev[0]+"' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') " ;
                //string con = ",PSP_GprogElevice WHERE PSPDEV.Name='"+dev[0]+"'AND PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.Type='05'AND PSPDEV.KSwitchStatus = '0'";
                CR =(PSPDEV) Services.BaseService.GetObject("SelectPSPDEVByCondition", con);

                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 (CR.HuganTQ1 != 0)
                                {
                                    linevalue = CR.HuganTQ1;
                                }
                                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);
                //kk.Show_ZLKMPSP(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, Encoding.Default);
                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;

                            string con = " WHERE Type='05' AND Name='" + dev[0] + "' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
                            //string con = ",PSP_GprogElevice WHERE PSPDEV.Name='" + dev[j * 2 + 1] + "' PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'";
                            PSPDEV pspline = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition", con);
                            double voltR = pspline.RateVolt;
                            double Ichange = (double)pspline.Burthen;
                            //double linXij = System.Math.Sqrt(3) * voltR * Ichange;
                            //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();           //�رն�ȡ���ļ�

                        string con = " WHERE Type='05' AND Name='" + dev[0] + "' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
                       // string con = ",PSP_GprogElevice WHERE PSPDEV.Name='" + dev[0] + "' PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'";
                        PSPDEV pspline = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition", con);
                        pspline.LineStatus = "�ȴ�";
                        Services.BaseService.Update<PSPDEV>(pspline);
                        jianxiancheck(GprogUID,Type,ratedCapacity);       //������һ�ֵļ��ߴ���
                        return ;
                    }
                    /*
                          else
                                                 break;*/
                    else
                    strLine2 = readLine2.ReadLine();
                }
                readLine2.Close();

            }
        }
Esempio n. 3
0
        /// <summary>
        ///�Ҳ���߷� �������һ����·ȷ�������ֹ�����
        /// <param name="GprogUID">
        /// Ϊ�����Ż���ĿID
        /// </param>
        /// <param name="Type">
        /// Ϊ�Ǹ�ʱ�ڵ������Ż���1Ϊ���塢2���ڡ�3���ڡ�4Զ�ڣ�
        /// </param>
        /// </summary>
        public void addrightcheck(string GprogUID,int Type,double ratacapality)
        {
            FileStream dh;
            StreamReader readLine;
            char[] charSplit;
            string strLine;
            string[] array1;
            string[] array2;

            string strLine2;

            char[] charSplit2 = new char[] { ' ' };
            FileStream dh2;
            StreamReader readLine2;
            string strCon2 = null;
            //List<PSPDEV> linedengdai = new List<PSPDEV>();          //��¼���д�ѡ����·��һ�������Ժ�ͻᷢ���仯��
            if (!Check(GprogUID,Type,ratacapality))
            {
                return;
            }
            if (Type == 2)
            {
                //strCon = "WHERE Type='01' AND SvgUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and Type in ('���վ','��Դ') and L1 in('����','����')) ";
                strCon2 = "WHERE Type='05'AND LineStatus='����' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and ZTstatus in('����','��ѡ')) ";

            }
            if (Type == 3)
            {
               // strCon = "WHERE Type='01' AND SvgUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and Type in ('���վ','��Դ') and L1 in('����','����','����')) ";
                strCon2 = "WHERE Type='05'AND LineStatus='����' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and JQstatus in('����','��ѡ','Ͷ��')) ";
                //strCon3 = "WHERE ProjectID='" + Itop.Client.MIS.ProgUID + "'";

            }
            if (Type == 4)
            {
                //strCon = "WHERE Type='01' AND SvgUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and Type in ('���վ','��Դ')) ";
                strCon2 = "WHERE Type='05'AND LineStatus='����' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and ZQstatus in('����','��ѡ','Ͷ��')) ";
                // strCon3 = "WHERE ProjectID='" + Itop.Client.MIS.ProgUID + "'";

            }
            IList list1 = Services.BaseService.GetList("SelectPSPDEVByCondition",strCon2);
             double yinzi = 0, capability = 0, volt = 0, current = 0, standvolt = 0, Rad_to_Deg = 57.29577951;
            capability = ratacapality;
            ercilinedengdai.Clear();//���֮ǰ�ļ�¼
            waitlineindex.Clear();

            for (int i = 0; i < list1.Count; i++)
            {
                N1Test.NBcal kk = new N1Test.NBcal();
                kk.Show_KmRelia(i + 1);
                //kk.Show_ZLKMPSP(i+1);
                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, Encoding.Default);
                charSplit2 = new char[] { ' ' };
                strLine2 = readLine2.ReadLine();

                bool lineflag = true;
                string tiaochuname = "";
                bool jielieflag = true;
                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])) * ratacapality;

                            string con = " WHERE Type='05' AND Name='" + dev[0] + "'AND KSwitchStatus = '0' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
                            //string con = ",PSP_GprogElevice WHERE PSPDEV.Name='" + dev[j * 2 + 1] + "' PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'";

                            PSPDEV pspline = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition", con);
                            if (pspline != null && !pspline.Name.Contains("������·"))
                            {
                                double voltR = pspline.RateVolt;
                                double Ichange = (double)pspline.Burthen;

                                double linXij = System.Math.Sqrt(3) * voltR * Ichange / 1000;
                                if (pij >= linXij)
                                {
                                    lineflag = false;
                                    tiaochuname = dev[0];
                                    //lineclass _line = new lineclass(n, j);
                                    //Overlinp.Add(_line);
                                    // OverPhege[n] = j;
                                }
                            }

                        }

                    }

                    else
                    {
                        jielieflag = false;
                    }

                    strLine2 = readLine2.ReadLine();
                }
                readLine2.Close();
                if (!lineflag)
                {
                    PSPDEV psperci = new PSPDEV();
                    string con = " WHERE Type='05' AND Name='" + tiaochuname + "'AND KSwitchStatus = '0' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
                    psperci= (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition", con );
                    psperci.LineStatus = "�ȴ�";
                    Services.BaseService.Update<PSPDEV>(psperci);
                    ercilinedengdai.Add(psperci);
                    break;
                }
                else                  //û�г��ֹ�����
                    continue;
            }
            //����ӵ� �����¼���εȴ�����·û����ֹͣ��������� ��ʾ�Ͽ�����һ��Ҳû�г��ֹ�����
            if (ercilinedengdai.Count == 0)
            {
                return;
            }
            //�˹��������һ����·ʹ�䲻���ֹ�����

            fuhecheck(GprogUID,Type,ratacapality);
            for (int j = 0; j < linedengdai.Count; j++)
            {
                if (!Checkadd(GprogUID, Type, ratacapality,linedengdai[j].SUID))
                    return;
                N1Test.NBcal zl = new N1Test.NBcal();
                //zl.Show_KmRelia(1);
                zl.ZLpsp();

                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, Encoding.Default);
                charSplit = new char[] { ' ' };
                strLine = readLine.ReadLine();

                double sumpij = 0.0;
                bool lineflag = true;
                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;
                                }

                            }
                        }

                    }
                    string con = " WHERE Type='05' AND Name='" + dev[0] + "'AND KSwitchStatus = '0' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
                    //string con = ",PSP_GprogElevice WHERE PSPDEV.Name='" + dev[0] + "' PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'";
                    CR = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition",con);
                    if (CR != null && CR.ReferenceVolt != 0)
                    {
                        volt = CR.ReferenceVolt;
                    }
                    else
                        volt = standvolt;
                    current = capability / (Math.Sqrt(3) * volt);
                    if (CR != null && !CR.Name.Contains("������·"))
                    {

                        double linepij = Convert.ToDouble(dev[1]) * capability;
                        double voltR = CR.RateVolt;
                        double Ichange = (double)CR.Burthen;
                        double linXij = System.Math.Sqrt(3) * voltR * Ichange / 1000;
                        if (linepij >= linXij)
                        {
                            lineflag = false;

                            //sumpij += linepij;
                        }
                        for (int k = 0; k < fuheline.Count; k++)
                        {
                            if (CR.SUID == fuheline[k].Suid)
                            {
                                sumpij += System.Math.Abs(fuheline[k].linepij - linepij);
                            }
                        }
                        //
                        //    //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();
                //if (lineflag)              //���û�г��ֹ��������� ��ֹͣ���м���
                //{
                //    PSPDEV pspb = (PSPDEV)linedengdai[j];
                //    pspb.LineStatus = "����";
                //    Services.BaseService.Update<PSPDEV>(pspb);
                //    lineyiyou.Add(pspb);
                //    for (int i = 0; i < linedengdai.Count; i++)
                //    {
                //        if (linedengdai[i].SUID == pspb.SUID)
                //        {
                //            linedengdai.RemoveAt(j);
                //        }
                //    }
                //    return;
                //}
                //else
                //{
                //XmlNode el = tlVectorControl1.SVGDocument.SelectSingleNode("svg/polyline[@layer='" + tlVectorControl1.SVGDocument.CurrentLayer.ID + "' and @id='" + linedengdai[j].EleID + "']");
                double linevalue = 0;
                if (linedengdai[j].HuganTQ1!=0)
                {
                    linevalue = linedengdai[j].HuganTQ1;
                }
                else
                    linevalue = 1;
                linedaixuan linedai = new linedaixuan(linedengdai[j].Number, linedengdai[j].SUID, linedengdai[j].Name);
                linedai.linepij = sumpij;
                linedai.linevalue = linevalue;
                linedai.linetouzilv = sumpij / linevalue;

                waitlineindex.Add(linedai);
                //}

            }
            waitlineindex.Sort();
            //�ڴ˴����ָ��������· ������·��״̬��Ϊ ���в��������еļ��������¼ �ڵȴ��ļ����ォ����·ȥ�� ���½�����һ�ֵIJ���
            PSPDEV pspbianhua = new PSPDEV();
            if (waitlineindex.Count > 0)
            {
                pspbianhua.SUID = waitlineindex[waitlineindex.Count - 1].Suid;
            }
            else
            {
                //MessageBox.Show("û�г��ֹ����ɵ���·������鿴һ����·�����Ƿ��趨��ȷ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            pspbianhua = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", pspbianhua);
            pspbianhua.LineStatus = "����";
            Services.BaseService.Update<PSPDEV>(pspbianhua);
            lineyiyou.Add(pspbianhua);
            for (int i = 0; i < linedengdai.Count; i++)
            {
                if (linedengdai[i].SUID == pspbianhua.SUID)
                {
                    linedengdai.RemoveAt(i);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        ///���ɼ�� �ҵ����ֹ����ɵ���·��
        /// <param name="GprogUID">
        /// Ϊ�����Ż���ĿID
        /// </param>
        /// <param name="Type">
        /// Ϊ�Ǹ�ʱ�ڵ������Ż���1Ϊ���塢2���ڡ�3���ڡ�4Զ�ڣ�
        /// </param>
        /// </summary>
        public bool fuhecheck(string GprogUID,int Type,double ratacapality)
        {
            FileStream dh;
            StreamReader readLine;
            char[] charSplit;
            string strLine;
            string[] array1;
            char[] charSplit2 = new char[] { ' ' };

            fuheline.Clear();            //�����һ�εļ�¼  Ϊ��һ��ʱ�ڵ�Ӧ����׼��

            // linedengdai.Clear();          //�����һ�μ�¼��ѡ��· Ϊ��һ��ʱ�ڵ�Ӧ����׼��

            if (!Checkfuhe(GprogUID,Type,ratacapality))
                return true;
            N1Test.NBcal zl = new N1Test.NBcal();
            //zl.Show_KmRelia(1);
            zl.ZLpsp();

            double capability = 0, volt = 0, current = 0, standvolt = 0;
            capability = ratacapality;
            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\DH1.txt"))
            {
            }
            else
            {
                return true;
            }
            dh = new FileStream(System.Windows.Forms.Application.StartupPath + "\\DH1.txt", FileMode.Open);

            readLine = new StreamReader(dh, Encoding.Default);
            charSplit = new char[] { ' ' };
            strLine = readLine.ReadLine();
            //output = null;
            //double sumpij = 0.0;
            bool lineflag = true;
            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;
                            }

                        }
                    }

                }
                string con = " WHERE Type='05' AND Name='" + dev[0] + "'AND KSwitchStatus = '0' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·') ";
               // string con = ",PSP_GprogElevice WHERE PSPDEV.Name='" + dev[0] + "' PSPDEV.SUID = PSP_GprogElevice.DeviceSUID AND PSP_GprogElevice.GprogUID = '" + GprogUID + "'AND PSPDEV.type='05'AND PSPDEV.KSwitchStatus = '0'";
                CR = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByCondition", con);

                if (CR != null && CR.ReferenceVolt != 0)
                {
                    volt = CR.ReferenceVolt;
                }
                else
                    volt = standvolt;
                current = capability / (Math.Sqrt(3) * volt);
                if (CR != null && !CR.Name.Contains("������·"))
                {

                    double linepij = System.Math.Abs(Convert.ToDouble(dev[1])) * ratacapality;
                    double voltR = CR.RateVolt;
                    double Ichange = (double)CR.Burthen;

                    double linXij = System.Math.Sqrt(3) * voltR * Ichange / 1000;
                    if (linepij >= linXij)
                    {
                        lineflag = false;
                        linedaixuan ld = new linedaixuan(CR.Number, CR.SUID, CR.Name);
                        ld.linepij = linepij;
                        fuheline.Add(ld);

                    }

                    //
                    //    //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();
            return lineflag;
        }