/// <summary> /// Моделирование работы скважины с идеальным ЭЦН и подбор реальных ЭЦН соответствующих идеальному. Возвращает список подобранных насосов. /// </summary> /// <param name="eps">Точность с которой будет расчитываться забойное давление (безразмерная)</param> /// <param name="dynamicH">Динамический уровень пластовой жидкости, отсчитывается от входа в насос (м)</param> /// <param name="CatalogEsp">Каталог ЭЦН</param> /// <param name="bottomholePressure">Забойное давление (МПа)</param> /// <param name="gasRate">Дебит газа (тыс.м3/сут)</param> /// <param name="waterRate">Дебит жидкости (м3/сут)</param> /// <param name="nglRate">Дебит газового конденсата (т/сут)</param> /// <returns></returns> public List <SettingForESP> ModelingESP(double eps, double dynamicH, List <ElectricSubmersiblePump> CatalogEsp, out double bottomholePressure, out double gasRate, out double waterRate, out double nglRate) { gasRate = ModelingPump(eps, dynamicH, out bottomholePressure, out waterRate, out nglRate); List <SettingForESP> chosenPumps = new List <SettingForESP>(); double head = Pump.CalcNeededHeadHeight(bottomholePressure, WellheadPressure, Tubing.Depth, WaterFluid); chosenPumps = ElectricSubmersiblePump.ChoseESP(Tubing.TubingDiameter, waterRate, head, CatalogEsp); return(chosenPumps); }
public UpdateESP(MainWindow mainWindow, ElectricSubmersiblePump chosenPump) { InitializeComponent(); ConditionalDimensionComboBox.ItemsSource = ElectricSubmersiblePump.DimensionDiameter.Keys.ToList(); MainWindow = mainWindow; Top = MainWindow.Top + 50; Left = MainWindow.Left + 50; ChosenPump = new ElectricSubmersiblePump(chosenPump); ConditionalDimensionComboBox.SelectedIndex = ElectricSubmersiblePump.DimensionDiameter.Keys.ToList().IndexOf(chosenPump.ConditionalDimension); NameTB.Text = chosenPump.Name; TB_BaseFrequency.Text = chosenPump.BaseFrequency.ToString(); TB_NominalDischarge.Text = chosenPump.NominalRate.ToString(); TB_MinRecomendedDischarge.Text = chosenPump.MinRecomendedRate.ToString(); TB_MaxRecomendedDischarge.Text = chosenPump.MaxRecomendedRate.ToString(); TB_MinAvailableDischarge.Text = chosenPump.MinAvailableRate.ToString(); TB_MaxAvailableDischarge.Text = chosenPump.MaxAvailableRate.ToString(); SetHeadCoefficients(); SetPowerCoefficients(); SetEfficiencyCoefficients(); }
/// <summary> /// Кнопка добавить /// </summary> private void Button_Click_OK(Object sender, RoutedEventArgs e) { ElectricSubmersiblePump pump = new ElectricSubmersiblePump(); pump.HeadCoefficients = new List <HeadCoefficient>(); pump.PowerCoefficients = new List <PowerCoefficient>(); pump.EfficiencyCoefficients = new List <EfficiencyCoefficient>(); TextBox[] HeadTextBoxes = { TB_HeadX0, TB_HeadX1, TB_HeadX2, TB_HeadX3, TB_HeadX4, TB_HeadX5, TB_HeadX6, TB_HeadX7, TB_HeadX8, TB_HeadX9 }; TextBox[] PowerTextBoxes = { TB_Power0, TB_Power1, TB_Power2, TB_Power3, TB_Power4, TB_Power5, TB_Power6, TB_Power7, TB_Power8, TB_Power9 }; TextBox[] EfficiencyTextBoxes = { TB_Efficiency0, TB_Efficiency1, TB_Efficiency2, TB_Efficiency3, TB_Efficiency4, TB_Efficiency5, TB_Efficiency6, TB_Efficiency7, TB_Efficiency8, TB_Efficiency9 }; try { for (int i = 0; i < HeadTextBoxes.Count(); i++) { TextBox box = HeadTextBoxes[i]; pump.HeadCoefficients.Add(new HeadCoefficient(i, double.Parse(box.Text))); } for (int i = 0; i < PowerTextBoxes.Count(); i++) { TextBox box = PowerTextBoxes[i]; pump.PowerCoefficients.Add(new PowerCoefficient(i, double.Parse(box.Text))); } for (int i = 0; i < EfficiencyTextBoxes.Count(); i++) { TextBox box = EfficiencyTextBoxes[i]; pump.EfficiencyCoefficients.Add(new EfficiencyCoefficient(i, double.Parse(box.Text))); } pump.Name = NameTB.Text; pump.BaseFrequency = Convert.ToDouble(TB_BaseFrequency.Text); pump.ConditionalDimension = ConditionalDimensionComboBox.Text; pump.NominalRate = Convert.ToDouble(TB_NominalRate.Text); pump.MinAvailableRate = Convert.ToDouble(TB_MinAvailableRate.Text); pump.MaxAvailableRate = Convert.ToDouble(TB_MaxAvailableRate.Text); pump.MinRecomendedRate = Convert.ToDouble(TB_MinRecomendedRate.Text); pump.MaxRecomendedRate = Convert.ToDouble(TB_MaxRecomendedRate.Text); } catch (Exception ex) { MessageBox.Show("Ошибка Неправильно задано одно из полей."); return; } this.Hide(); MainWindow.Button_Click_UpdateGrafESN(null, null); using (PersistanceContext db = new PersistanceContext()) { db.EspPumps.Add(pump); db.SaveChanges(); //Обновляем каталог MainWindow.CatalogEsp = db.EspPumps.Include("PowerCoefficients") .Include("EfficiencyCoefficients").Include("HeadCoefficients").ToList(); //Отображаем таблицу каталога ЭЦН MainWindow.ShowESPDataBase(); } }
/// <summary> /// Кнопка добавить /// </summary> private void Button_Click_OK(Object sender, RoutedEventArgs e) { TextBox[] HeadTextBoxes = { TB_HeadX0, TB_HeadX1, TB_HeadX2, TB_HeadX3, TB_HeadX4, TB_HeadX5, TB_HeadX6, TB_HeadX7, TB_HeadX8, TB_HeadX9 }; TextBox[] PowerTextBoxes = { TB_Power0, TB_Power1, TB_Power2, TB_Power3, TB_Power4, TB_Power5, TB_Power6, TB_Power7, TB_Power8, TB_Power9 }; TextBox[] EfficiencyTextBoxes = { TB_Efficiency0, TB_Efficiency1, TB_Efficiency2, TB_Efficiency3, TB_Efficiency4, TB_Efficiency5, TB_Efficiency6, TB_Efficiency7, TB_Efficiency8, TB_Efficiency9 }; ChosenPump.HeadCoefficients.Clear(); ChosenPump.PowerCoefficients.Clear(); ChosenPump.EfficiencyCoefficients.Clear(); for (int i = 0; i < HeadTextBoxes.Count(); i++) { TextBox box = HeadTextBoxes[i]; ChosenPump.HeadCoefficients.Add(new HeadCoefficient(i, double.Parse(box.Text))); } for (int i = 0; i < PowerTextBoxes.Count(); i++) { TextBox box = PowerTextBoxes[i]; ChosenPump.PowerCoefficients.Add(new PowerCoefficient(i, double.Parse(box.Text))); } for (int i = 0; i < EfficiencyTextBoxes.Count(); i++) { TextBox box = EfficiencyTextBoxes[i]; ChosenPump.EfficiencyCoefficients.Add(new EfficiencyCoefficient(i, double.Parse(box.Text))); } ChosenPump.Name = NameTB.Text; ChosenPump.BaseFrequency = Convert.ToDouble(TB_BaseFrequency.Text); ChosenPump.ConditionalDimension = ConditionalDimensionComboBox.Text; ChosenPump.NominalRate = Convert.ToDouble(TB_NominalDischarge.Text); ChosenPump.MinAvailableRate = Convert.ToDouble(TB_MinAvailableDischarge.Text); ChosenPump.MaxAvailableRate = Convert.ToDouble(TB_MaxAvailableDischarge.Text); ChosenPump.MinRecomendedRate = Convert.ToDouble(TB_MinRecomendedDischarge.Text); ChosenPump.MaxRecomendedRate = Convert.ToDouble(TB_MaxRecomendedDischarge.Text); this.Hide(); using (PersistanceContext db = new PersistanceContext()) { ElectricSubmersiblePump espForChange = db.EspPumps.Include("PowerCoefficients") .Include("EfficiencyCoefficients").Include("HeadCoefficients").Where(esp => esp.Id == ChosenPump.Id).ToList()[0]; db.EspPumps.Remove(espForChange); espForChange = ChosenPump; db.EspPumps.Add(espForChange); db.SaveChanges(); List <ElectricSubmersiblePump> espList = db.EspPumps.Include("PowerCoefficients") .Include("EfficiencyCoefficients").Include("HeadCoefficients").ToList(); //Обновляем каталог MainWindow.CatalogEsp = espList; //Отображаем таблицу каталога ЭЦН MainWindow.ShowESPDataBase(); } MainWindow.Button_Click_UpdateGrafESN(null, null); }