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);
        }
Beispiel #2
0
        public static void Main()
        {
            ResIndexClass ResIndex = new ResIndexClass();
            NetworkOp     RunSim   = new NetworkOp();

            RunSim.StartSimulation();  // Networkü perform eder

            //Console.WriteLine("Resilience Index: ");//Kullanıcıdan Resilience index alınır
            //ResIndex.SetResindex(Convert.ToDouble(Console.ReadLine()));
            //double UserDefinedResindex=ResIndex.GetResindex();      //UserDefinedResindex Resilience indexi veriyor
            //PipeOp.Get_Flow(PipeOp.Get_numofPipe());

            PipeOp.Get_Flow();
            NetworkOp.SaveAndRun();

            //Console.WriteLine(PipeOp.PipeCost_Dia(1));
            //ReservoirOp.Get_ResElevation();

            //BU REZERVUAR YÜKSEKLİKLERİNİ ALABİLDİĞİM KISIM
            //float[] resyukseklikleri = ReservoirOp.Get_ResElevations();
            //foreach (float i in resyukseklikleri)
            //{
            //Console.WriteLine( "{0}", i);
            //}
            //BU REZERVUAR YÜKSEKLİKLERİNİ ALABİLDİĞİM KISIM

            //ReservoirOp.Calculate_TotalPowerofSystem();
            //PipeOp.Set_PipeDia(550);
            NetworkOp.SaveAndRun();


            //float[] Diameter1 = new float[PipeOp.Get_numofPipe()];
            //float[] Diameter2 = new float[PipeOp.Get_numofPipe()];

            //for (int j = 0; j < PipeOp.Get_numofPipe(); j++)
            //{
            //    Diameter1[j] = 550;
            //    Diameter2[j] = 500;

            //}

            // PipeOp.Calculate_PowerDissipation(Diameter1, Diameter2);
            PipeOp.Set_PipeDia(550);



            ////////////////////////////////////////DÖNGÜ/////////////////////////////////////////////////////////////////////////////////////////////
            for (int i = 0; i < PipeOp.Get_numofPipe(); i++)
            {
                PublicListeler.ANALISTE.Add(i, Sabitler.Pipe_Diameters[Sabitler.Pipe_Diameters.Length - 1]);//yani 550
            }

            Console.WriteLine(1 + ". Döngü Başlangıcı");
            PublicListeler.DonguListesi = Iterations.Iteration_ILK(PublicListeler.ANALISTE).ToDictionary(entry => entry.Key, entry => entry.Value);
            PublicListeler.AraList_kontrolSonrasi.Clear();
            PublicListeler.SabitListe.Add(-1, 0);

            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);
                PublicListeler.AraList_kontrolSonrasi.Clear();
            } while (PublicListeler.SabitListe.Count < PublicListeler.ANALISTE.Count);
            //
            ////////////////////////////////////////DÖNGÜ/////////////////////////////////////////////////////////////////////////////////////////////



            Console.WriteLine(" ");
            Console.WriteLine("-----------SON DURUM-------------------------");
            foreach (KeyValuePair <int, float> kvp in PublicListeler.SabitListe)
            {
                Console.WriteLine("Sabit Liste > Boru = {0}, Çap = {1}", kvp.Key, kvp.Value);
            }



            Console.ReadLine();
        }