public static void DonguCalistir()
        {
            int sayac = 0;

            ////////////////////////////////////////LOOP//////////////////////////////////////////////////////////////////////////////////////////
            for (int i = 0; i < PipeOp.Get_numofPipe(); i++)
            {
                PublicListeler.ANALISTE.Add(i, Sabitler.Pipe_Diameters[Sabitler.Pipe_Diameters.Length - 1]);//yani 558,8
                UnsafeNativeMethods.ENsetlinkvalue(i + 1, LinkValue.InitSetting, 130);
            }
            Console.WriteLine(1 + ". Döngü Başlangıcı");
            PublicListeler.DonguListesi = Iterations.Iteration_ILK(PublicListeler.ANALISTE).ToDictionary(entry => entry.Key, entry => entry.Value);
            Console.WriteLine("-------1. iterasyon sonucu Reilience index: " + ResIndexClass.Calculate_Resindex());
            Console.WriteLine("-------1. iterasyon sonucu head difference: " + FailureIndexClass.Calculate_Failureindex());
            Console.WriteLine("Hizlar ");
            var hizlar = PipeOp.Get_Velocity();

            for (int i = 0; i < PipeOp.Get_numofPipe(); i++)
            {
                Console.WriteLine(hizlar[i]);
            }
            PublicListeler.AraList_kontrolSonrasi.Clear();
            do
            {
                sayac = sayac + 1;
                Console.WriteLine("------------------------------------");
                Console.WriteLine(sayac + 1 + ". Döngü Başlangıcı");
                PublicListeler.DonguListesi = Iterations.Iteration(PublicListeler.DonguListesi).ToDictionary(entry => entry.Key, entry => entry.Value);
                int say = sayac + 1;
                Console.WriteLine("-------" + say + ". iterasyon sonucu Reilience index: " + ResIndexClass.Calculate_Resindex());
                Console.WriteLine("-------" + say + ". iterasyon sonucu head difference: " + FailureIndexClass.Calculate_Failureindex());
                Console.WriteLine("Hizlar ");
                var hizlar2 = PipeOp.Get_Velocity();
                for (int i = 0; i < PipeOp.Get_numofPipe(); i++)
                {
                    Console.WriteLine(hizlar2[i]);
                }
                PublicListeler.AraList_kontrolSonrasi.Clear();
            } while (PublicListeler.SabitListe.Count < PublicListeler.ANALISTE.Count);
            ////////////////////////////////////////LOOP/////////////////////////////////////////////////////////////////////////////////////////////
            Console.WriteLine(" ");
            var sonhal = PublicListeler.SabitListe.OrderBy(x => x.Key).ToList();

            Console.WriteLine(" ");
            Console.WriteLine("-----------SON DURUMDA ÇAPLAR---------------");
            foreach (KeyValuePair <int, float> kvp in sonhal)
            {
                UnsafeNativeMethods.ENsetlinkvalue(kvp.Key + 1, LinkValue.Diameter, kvp.Value);
                Console.WriteLine("Son hal > Boru = {0}, Çap = {1}", kvp.Key + 1, kvp.Value);
            }
            Console.WriteLine(" ");
            float min = FailureIndexClass.Calculate_Failureindex();
            float rez = ResIndexClass.Calculate_Resindex();

            PipeOp.CostCalculation(PublicListeler.SabitListe);
            Console.WriteLine("Pressure-30m= " + min);
            Console.WriteLine("Resilience index: " + rez);
        }
        private void btn_Pareto_Click(object sender, EventArgs e)
        {
            //SAYAC

            ind.Text        = Convert.ToString(sayi);
            timer1.Interval = 1000;
            timer1.Start();


            //SAYAC


            //dataGridView2.Rows.Clear();
            for (int i = 10; i < 98; i += 3)
            {
                //PublicListeler.ANALISTE.Clear();
                Console.Clear();

                double res = i / 100.0;

                ResIndexClass.Kullanıcı_ResilienceIndex = (float)res;
                Sabitler.MinHead = float.Parse(txt_minPressure.Text);
                DonguClass.DonguGiris();
                DonguClass.DonguCalistir();

                string a = FailureIndexClass.Calculate_Failureindex().ToString();
                string b = ResIndexClass.Calculate_Resindex().ToString();
                float  c = PipeOp.CostCalculation(PublicListeler.SabitListe);

                dataGridView2.Rows.Add(i, res, a, b, c);



                PublicListeler.resres.Clear();
                PublicListeler.ANALISTE.Clear();
                PublicListeler.IterListesi.Clear();
                PublicListeler.ANALISTE.Clear();
                PublicListeler.Powdis_Dict.Clear();
                PublicListeler.Powdis_Dict_ILK.Clear();
                PublicListeler.AraList.Clear();
                PublicListeler.GuncelBoruListesi.Clear();
                PublicListeler.List_BoruvCap.Clear();
                PublicListeler.AraList_kontrolSonrasi.Clear();
                PublicListeler.dongu.Clear();
                PublicListeler.SabitListe.Clear();
                PublicListeler.DonguListesi.Clear();
                PublicListeler.Node_Demand_list.Clear();
                PublicListeler.Node_HGL_list_CAP1.Clear();
                PublicListeler.Node_HGL_list_CAP2.Clear();
            }
            timer1.Stop();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            Console.Clear();
            lbl_res.Text  = "";
            lbl_cost.Text = " ";
            lbl_pressuredifference.Text = "";

            ResIndexClass.Kullanıcı_ResilienceIndex = float.Parse(txt_resindex.Text);
            Sabitler.MinHead = float.Parse(txt_minPressure.Text);
            DonguClass.DonguGiris();



            //DonguClass.DonguCalistir();

            lbl_pressuredifference.Text = FailureIndexClass.Calculate_Failureindex().ToString();
            lbl_res.Text = ResIndexClass.Calculate_Resindex().ToString();
            float a = PipeOp.CostCalculation(PublicListeler.SabitListe);

            lbl_cost.Text = a.ToString();


            for (int i = 0; i < PublicListeler.SabitListe.Count; i++)
            {
                UnsafeNativeMethods.ENgetlinkvalue(i + 1, LinkValue.Diameter, out float dia);

                dataGridView1.Rows.Add("Pipe " + (i + 1) + ":", dia);
            }



            PublicListeler.resres.Clear();
            PublicListeler.ANALISTE.Clear();
            PublicListeler.IterListesi.Clear();
            PublicListeler.ANALISTE.Clear();
            PublicListeler.Powdis_Dict.Clear();
            PublicListeler.Powdis_Dict_ILK.Clear();
            PublicListeler.AraList.Clear();
            PublicListeler.GuncelBoruListesi.Clear();
            PublicListeler.List_BoruvCap.Clear();
            PublicListeler.AraList_kontrolSonrasi.Clear();
            PublicListeler.dongu.Clear();
            PublicListeler.SabitListe.Clear();
            PublicListeler.DonguListesi.Clear();
            PublicListeler.Node_Demand_list.Clear();
            PublicListeler.Node_HGL_list_CAP1.Clear();
            PublicListeler.Node_HGL_list_CAP2.Clear();
        }