Exemplo n.º 1
0
        public static Dictionary <int, float> Iteration_ILK(Dictionary <int, float> icListem)
        {
            PipeOp.Calculate_PowDis_ILK(icListem);
            var RankedList = PublicListeler.Powdis_Dict_ILK.OrderByDescending(x => x.Value).ToList();

            foreach (var itemq in RankedList.ToList())
            {
                UnsafeNativeMethods.ENgetlinkvalue(itemq.Key + 1, LinkValue.Diameter, out float valueDiam);
                PublicListeler.List_BoruvCap.Add(itemq.Key, valueDiam);
            }
            RankedList.Clear(); // RANKEDLIST ICINI TEMIZLIYORUM BURDA1
            NetworkOp.SaveAndRun();
            foreach (var FLitemler in PublicListeler.List_BoruvCap)
            {
                int   a = (Array.FindIndex(Sabitler.Pipe_Diameters, x => x.Equals(FLitemler.Value)));
                float b = Sabitler.Pipe_Diameters[a - 1];
                UnsafeNativeMethods.ENsetlinkvalue(FLitemler.Key + 1, LinkValue.Diameter, b);  //Diameter Reduction


                if (Iterations.Kontroller(FLitemler.Key) == true)
                {
                    Console.WriteLine(FLitemler.Key + 1 + ". pipe will be Reduced.....");
                    UnsafeNativeMethods.ENgetlinkvalue(FLitemler.Key + 1, LinkValue.Diameter, out float valueDiaa);
                    PublicListeler.AraList_kontrolSonrasi.Add(FLitemler.Key, valueDiaa);
                }
                else
                {
                    int   d = (Array.FindIndex(Sabitler.Pipe_Diameters, x => x.Equals(FLitemler.Value)));
                    float e = Sabitler.Pipe_Diameters[d];
                    UnsafeNativeMethods.ENsetlinkvalue(FLitemler.Key + 1, LinkValue.Diameter, e);
                    UnsafeNativeMethods.ENgetlinkvalue(FLitemler.Key + 1, LinkValue.Diameter, out float valueDiaa2);
                    Console.WriteLine(FLitemler.Key + 1 + ". pipe will be remained SAME");
                    PublicListeler.AraList_kontrolSonrasi.Add(FLitemler.Key, valueDiaa2);
                    NetworkOp.SaveAndRun();
                    PublicListeler.SabitListe.Add(FLitemler.Key, valueDiaa2);       //boru çapı azalmayacağı için Sabit listeye atanıyor.
                }
            }
            NetworkOp.OnlySave();
            Console.WriteLine("_____________________________");
            var yazdirilk = PublicListeler.List_BoruvCap.OrderBy(x => x.Key);

            foreach (KeyValuePair <int, float> kvp in yazdirilk)
            {
                UnsafeNativeMethods.ENsetlinkvalue(kvp.Key + 1, LinkValue.Diameter, kvp.Value);
                Console.WriteLine("iterasyon sonucunda > Boru = {0} = {1}", kvp.Key + 1, kvp.Value);
            }
            PublicListeler.List_BoruvCap.Clear();// List_BoruvCap LISTESINI TEMIZLIYORUM BURDA
            return(PublicListeler.AraList_kontrolSonrasi);
        }