Exemplo n.º 1
0
 public void CreateLinkedSectors(List <Station> stations)
 {
     foreach (var st in stations)
     {
         var sector = new SectorFromNPStoNPS(_pipeLine, st);
         _stationNodes.AppendFirst(sector);
     }
 }
Exemplo n.º 2
0
        static void IterationAlgorithm(SectorFromNPStoNPS NPS_Pipe, Oil oil, List <double> HeadArray,
                                       double speed, ref double EndPressure, out string TextMessage)
        {
            TextMessage = "";
            double Q         = (PI * speed * Math.Pow(NPS_Pipe.pipe.Diameter, 2) / 4);
            var    Reyn      = NumberReynolds(Q, NPS_Pipe.pipe.Diameter, oil.Viscosity);
            var    HydroRes  = HydroResist(NPS_Pipe.pipe.Roughness, Reyn);
            var    HydroLoss = HydroLosses(HydroRes, Q, NPS_Pipe.pipe.Diameter) * 1000; // multiply by 1000 to get losses per one km!

            double Head = EndPressure;                                                  // Переменная напора. Изначально равна конечному напору в ТП.

            for (int i = NPS_Pipe.X_SpotsSector.Count - 1; i > 0; i--)
            {
                Head = Head + HydroLoss * (NPS_Pipe.X_SpotsSector[i] - NPS_Pipe.X_SpotsSector[i - 1]);

                // Если начало самотечного участка
                if (Head < NPS_Pipe.Z_SpotsSector[i - 1] + oil.VapourPressure)
                {
                    Head = NPS_Pipe.Z_SpotsSector[i - 1] + oil.VapourPressure;
                }

                // Если напор выше максимального для трубы
                if (Head > NPS_Pipe.pipe.MaxPressure)
                {
                    TextMessage += $"Pressure on {NPS_Pipe.X_SpotsSector[i]} kilometer is exceeded\n";
                }
                HeadArray.Add(Head);
            }
            if (Head > NPS_Pipe.pipe.MaxPressure)
            {
                TextMessage += $"Outlet pressure on station {NPS_Pipe.station.Name} is exceeded\n";
            }
            Head = Head - NPS_Pipe.station.GetDiffPresure(Q);
            if (Head < NPS_Pipe.station.PositionStation.High_mark + NPS_Pipe.station.CavitationPressure)
            {
                TextMessage += $"Inlet pressure on station {NPS_Pipe.station.Name} is too small\n";
            }
            HeadArray.Append(Head);
            EndPressure = Head;
        }