Exemplo n.º 1
0
 /// <summary>
 /// Пытается создать объект сети, если его не существует, иначе возвращает существующий объект.
 /// </summary>
 /// <param name="vacuumLine">Всасывающая линия.</param>
 /// <param name="forcingLine">Нагнетающая линия.</param>
 /// <returns>Возвращает новый или существующий объект сети.</returns>
 public static Network Create(LiquidInPipeline vacuumLine, LiquidInPipeline forcingLine)
 {
     if (_isExist)
         return _network;
     var network = new Network {VacuumLine = vacuumLine, ForcingLine = forcingLine};
     _network = network;
     _isExist = true;
     return network;
 }
Exemplo n.º 2
0
        public ResistanceOut(EasyPACT.LiquidInPipeline lip_In, EasyPACT.LiquidInPipeline lip_Out, double Temperature_Out, double NK_dou, double VP)
        {
            this.lip_In = lip_In;
            this.lip_Out = lip_Out;
            this.Temperature_Out = Temperature_Out;
            this.NK_dou = NK_dou;
            this.VP = VP;

            Grid Grid_Add_Resistance = new MyGrid();
            Grid_Add_Resistance.Name = "Grid_Add_Resistance";

            MyLabel Pipe_Resist_In = new MyLabel("Pipe_Resist_In", 30, 100, 0, 0, "Нагнетательный трубопровод", 14);
            Pipe_Resist_In.FontWeight = FontWeights.Bold;

            MyLabel Local_Resistance_In_lbl = new MyLabel("Local_Resistance_In_lbl", 30, 140, 0, 0, "Местное сопротивление:");

            MyComboBox Local_Resistance_In = new MyComboBox("Local_Resistance_In_1", 200, 200, 142, 0, 0);
            Local_Resistance_In.Items.Add("Выберите сопротивление");
            Local_Resistance_In.Items.Add("Вход в трубу");
            Local_Resistance_In.Items.Add("Выход и трубы");
            Local_Resistance_In.Items.Add("Диафрагма");
            Local_Resistance_In.Items.Add("Отвод");
            Local_Resistance_In.Items.Add("Колено");
            Local_Resistance_In.Items.Add("Вентиль нормальный");
            //Local_Resistance_In.Items.Add("Вентиль прямоточный");
            //Local_Resistance_In.Items.Add("Кран пробочный");
            //Local_Resistance_In.Items.Add("Задвижка");
            Local_Resistance_In.SelectedIndex = 0;
            Local_Resistance_In.SelectionChanged += Local_Resistance_In_SelectionChanged;

            // Комбобоксы для сопротивлений

            MyComboBox First = new MyComboBox("First_1", 200, 410, 142, 0, 0);
            First.Visibility = Visibility.Hidden;

            MyComboBox Second = new MyComboBox("Second_1", 200, 620, 142, 0, 0);
            Second.Visibility = Visibility.Hidden;

            MyTextBox Third = new MyTextBox("Third_1", 200, 410, 142, 0, 0);
            Third.Visibility = Visibility.Hidden;
            /*
            MyLabel Number_Local_Resistance_In_lbl = new MyLabel("Number_Local_Resistance_In_lbl", 334, 100, 0, 0, "Количество:");

            MyTextBox Number_Local_Resistance_In = new MyTextBox("Number_Local_Resistance_In", 60, 425, 100, 0, 0);

            MyLabel Shtyk = new MyLabel("Shtyk", 489, 100, 0, 0, "штук.");

            MyLabel Size = new MyLabel("Size_1", 556, 100, 0, 0, "Размеры");

            MyComboBox Size_Choose = new MyComboBox("", 100, 620, 102, 0, 0);
            */
            MyButton Add_New_Local_Resistance = new MyButton("Add_New_Local_Resistance", 100, 100, 170, 0, 0, "Добавить");
            Add_New_Local_Resistance.Click += Add_New_Local_Resistance_Click;

            ScrollBar hSBar = new ScrollBar();
            hSBar.Orientation = Orientation.Vertical;
            hSBar.HorizontalAlignment = HorizontalAlignment.Right;
            hSBar.Width = 10;
            hSBar.Height = 200;
            hSBar.Minimum = 0;
            hSBar.Value = 0;
            hSBar.Scroll += scroll;
            hSBar.Visibility = Visibility.Hidden;

            MyButton Next_3 = new MyButton("Next_3", 150, 0, 0, 20, 7, "Далее");
            Next_3.HorizontalAlignment = HorizontalAlignment.Right;
            Next_3.VerticalAlignment = VerticalAlignment.Bottom;
            Next_3.Background = Brushes.DarkGreen;
            Next_3.FontSize = 12;
            Next_3.Foreground = Brushes.LightGray;
            Next_3.Click += Next_3_Click;

            MyButton Help_Add_Resistance = new MyButton("Help_Add_Resistance", 70, 18, 0, 0, 7, "Справка");
            Help_Add_Resistance.VerticalAlignment = VerticalAlignment.Bottom;
            Help_Add_Resistance.Background = Brushes.DarkGreen;
            Help_Add_Resistance.FontSize = 12;
            Help_Add_Resistance.Foreground = Brushes.LightGray;
            Help_Add_Resistance.Click += Help_Add_Resistance_Click;

            Image Resistance_Img_Top = new Image()
            {
                Width = 900,
                Height = 90,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                Name = "Resistance_Img_Top",
                Margin = new Thickness(0, 0, 0, 0)
            };

            var Resistance_Img_Top_bi = new BitmapImage();
            Resistance_Img_Top_bi.BeginInit();
            Resistance_Img_Top_bi.UriSource = new Uri(@"C:\EasyPACT\EasyPACT_Graphic\EasyPACT_Resists.jpg");

            Resistance_Img_Top_bi.EndInit();
            Resistance_Img_Top.Source = Resistance_Img_Top_bi;

            Image Resistance_Img_Bottom = new Image()
            {
                Width = 900,
                Height = 50,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                Name = "Resistance_Img_Bottom",
                Margin = new Thickness(0, 366, 0, 0)
            };

            BitmapImage Resistance_Img_Bottom_bi = new BitmapImage();
            Resistance_Img_Bottom_bi.BeginInit();
            Resistance_Img_Bottom_bi.UriSource = new Uri(@"C:\EasyPACT\EasyPACT_Graphic\EasyPACT_Bottom_First.jpg");
            Resistance_Img_Bottom_bi.EndInit();
            Resistance_Img_Bottom.Source = Resistance_Img_Bottom_bi;

            Grid_Add_Resistance.Children.Add(Local_Resistance_In_lbl);//0
            Grid_Add_Resistance.Children.Add(Local_Resistance_In);//1
            Grid_Add_Resistance.Children.Add(Add_New_Local_Resistance);//2
            Grid_Add_Resistance.Children.Add(hSBar);//3
            Grid_Add_Resistance.Children.Add(First);//4
            Grid_Add_Resistance.Children.Add(Second);//5
            Grid_Add_Resistance.Children.Add(Third);//6
            Grid_Add_Resistance.Children.Add(Resistance_Img_Bottom);//7
            Grid_Add_Resistance.Children.Add(Next_3);//8
            Grid_Add_Resistance.Children.Add(Help_Add_Resistance);//9
            Grid_Add_Resistance.Children.Add(Resistance_Img_Top);//10
            Grid_Add_Resistance.Children.Add(Pipe_Resist_In);//11

            this.Content = Grid_Add_Resistance;
            Uri iconUri = new Uri("C://EasyPACT/EasyPACT_Graphic/EasyPACT_Icon.jpg", UriKind.RelativeOrAbsolute);
            this.Icon = BitmapFrame.Create(iconUri);
            this.MinHeight = 450;
            this.MinWidth = 900;
            this.MaxHeight = 450;
            this.MaxWidth = 900;
            this.Title = "Местные сопротивления - Нагнетательный трубопровод - EasyPACT";
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // Разделитель - точка
            var inf = new CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
            System.Threading.Thread.CurrentThread.CurrentCulture = inf;
            inf.NumberFormat.NumberDecimalSeparator = ".";
            // Вывод курсовой
            //var ans = Database.Query("insert into liquid_list(name,formula,molar_mass) values('Бутан','C4H10',58.1)");
            //var ans = Database.Query("select * from liquid_list");
            /*string ConnectionString = "Data Source=|DataDirectory|\\EasyPACT.sdf";
            SqlCeConnection Connect = new SqlCeConnection(ConnectionString);
            Connect.Open();
            var command = Connect.CreateCommand();
            command.CommandTimeout = Connect.ConnectionTimeout;
            command.Connection = Connect;
            command.CommandType = CommandType.Text;
            command.CommandText = "select * from liquid_list";
            var table = new DataTable();
            var adapter = new SqlCeDataAdapter(command);
            adapter.Fill(table);
            command.CommandText = "insert into liquid_list ([name],[formula],molar_mass) values('Бутан','C4H10',58.01)";
            adapter.UpdateCommand = command;
            var row = table.NewRow();
            row.BeginEdit();
            row.SetField("name", "Бутан");
            row.SetField("formula", "C4H10");
            row.SetField("molar_mass", Convert.ToSingle(58.01));
            row.EndEdit();
            table.Rows.Add(row);
            table.AcceptChanges();
            adapter.Update(table);
            table.AcceptChanges();
            //table.AcceptChanges();

            Connect.Close();*/
            //var ht = new HeatExchangerPipe(14);
            var liq = new LiquidMix("11,12", 0.28, 20, 760);
            var pip = new PipelineRound(33, 1, 0.069, 0.0025, 52);
            pip.AddLocalResistance(1);
            pip.AddLocalResistance(12);
            pip.AddLocalResistance(65.5);
            pip.AddLocalResistance(2.1);
            pip.AddLocalResistance(7);
            var lip = new LiquidInPipeline(liq, pip);
            pip = new PipelineRound(33, 1, 0.092, 0.0025, 6);
            pip.AddLocalResistance("1 1");
            for (var i = 0; i < 7; i++)
                pip.AddLocalResistance("4 90 1");
            var lip2 = new LiquidInPipeline(liq, pip);
            var net = Network.Create(lip2, lip);
            net.SetProductivity(30000/3600.0);
            Network.Get().ChooseHeatExchanger(liq.BoilingPoint, liq.BoilingPoint + 20);
            net.ChooseCentrifugalPump(5.6);
            Console.WriteLine("Смесь: {0}", liq.Name);
            Console.WriteLine("\tТемпература: {0} град.", liq.Temperature);
            Console.WriteLine("\tДавление: {0} мм рт. ст.", liq.Pressure);
            Console.WriteLine("\tТемпература кипения: {0} град.", liq.BoilingPoint);
            Console.WriteLine("\tВязкость: {0} Па*с", liq.ViscosityDynamic);
            Console.WriteLine("\tТеплоемкость: {0} Дж/кг К", liq.ThermalCapacity);
            Console.WriteLine("\t: {0} Дж/кг К", liq.ThermalCapacity);
            Console.WriteLine("Трубопровод всасывающий");
            Console.WriteLine("\tРазмеры: {0}x{1} м", net.VacuumLine.Pipeline.ExternalDiameter,
                              net.VacuumLine.Pipeline.ExternalDiameter - net.VacuumLine.Pipeline.Diameter);
            Console.WriteLine("\tДлина: {0} м",net.VacuumLine.Pipeline.Length);
            Console.WriteLine("\tКоэффициент м.с.: {0}",net.VacuumLine.Pipeline.FactorOfLocalResistance);
            Console.WriteLine("Трубопровод нагнетательный");
            Console.WriteLine("\tРазмеры: {0}x{1} м", net.ForcingLine.Pipeline.ExternalDiameter,
                              net.ForcingLine.Pipeline.ExternalDiameter - net.ForcingLine.Pipeline.Diameter);
            Console.WriteLine("\tДлина: {0} м", net.ForcingLine.Pipeline.Length);
            Console.WriteLine("\tКоэффициент м.с.: {0}", net.ForcingLine.Pipeline.FactorOfLocalResistance);
            Console.WriteLine("Смесь во всасывающем ТП");
            Console.WriteLine("\tСкорость: {0} м/с",net.VacuumLine.Speed);
            Console.WriteLine("\tКритерий Рейнольдса: {0}",net.VacuumLine.Re);
            Console.WriteLine("\tКоэффициент трения: {0}", net.VacuumLine.FactorOfAFriction);
            Console.WriteLine("\tПотеря давления на трение: {0} Па",net.VacuumLine.LossOfPressureUponAFriction());
            Console.WriteLine("\tПотеря давления на м.с.: {0} Па",net.VacuumLine.LossOfPressureUponLocalResistances());
            Console.WriteLine("\tПотеря давления: {0} Па", net.VacuumLine.LossOfPressureUponLocalResistances() + net.VacuumLine.LossOfPressureUponAFriction());
            Console.WriteLine("\tПотеря напора: {0} м",
                              (net.VacuumLine.LossOfPressureUponLocalResistances() +
                               net.VacuumLine.LossOfPressureUponAFriction())/net.VacuumLine.Liquid.Density/9.81);
            Console.WriteLine("Смесь в нагнетательном ТП");
            Console.WriteLine("\tСкорость: {0} м/с", net.ForcingLine.Speed);
            Console.WriteLine("\tКритерий Рейнольдса: {0}", net.ForcingLine.Re);
            Console.WriteLine("\tКоэффициент трения: {0}", net.ForcingLine.FactorOfAFriction);
            Console.WriteLine("\tПотеря давления на трение: {0} Па", net.ForcingLine.LossOfPressureUponAFriction());
            Console.WriteLine("\tПотеря давления на м.с.: {0} Па", net.ForcingLine.LossOfPressureUponLocalResistances());
            Console.WriteLine("\tПотеря давления: {0} Па", net.ForcingLine.LossOfPressureUponLocalResistances() + net.ForcingLine.LossOfPressureUponAFriction());
            Console.WriteLine("\tПотеря напора: {0} м",
                              (net.ForcingLine.LossOfPressureUponLocalResistances() +
                               net.ForcingLine.LossOfPressureUponAFriction()) / net.ForcingLine.Liquid.Density / 9.81);
            Console.WriteLine("Смесь в трубном пространстве ТО");
            Console.WriteLine("\tСкорость: {0} м/с", net.HeatExchanger.LiquidInPipeline.Speed);
            Console.WriteLine("\tКритерий Рейнольдса: {0}", net.HeatExchanger.LiquidInPipeline.Re);
            Console.WriteLine("\tКоэффициент трения: {0}", net.HeatExchanger.LiquidInPipeline.FactorOfAFriction);
            Console.WriteLine("\tПотеря давления на трение: {0} Па", net.HeatExchanger.LiquidInPipeline.LossOfPressureUponAFriction());
            Console.WriteLine("\tПотеря давления на м.с.: {0} Па", net.HeatExchanger.LiquidInPipeline.LossOfPressureUponLocalResistances());
            Console.WriteLine("\tПотеря давления: {0} Па", net.HeatExchanger.LiquidInPipeline.LossOfPressureUponLocalResistances() + net.HeatExchanger.LiquidInPipeline.LossOfPressureUponAFriction());
            Console.WriteLine("\tПотеря напора: {0} м",
                              (net.HeatExchanger.LiquidInPipeline.LossOfPressureUponLocalResistances() +
                               net.HeatExchanger.LiquidInPipeline.LossOfPressureUponAFriction()) / net.HeatExchanger.LiquidInPipeline.Liquid.Density / 9.81);
            Console.WriteLine("Затраты на создание скорости потока: {0} Па", net.ForcingLine.LossOfPressureUponCreationOfSpeed());
            Console.WriteLine("Затраты на подъем жидкости: {0} Па", net.ForcingLine.LossOfPressureUponLifting(5.6));
            Console.WriteLine("Полный напор: {0} м", (net.VacuumLine.LossOfPressureUponLocalResistances() +
                                                 net.VacuumLine.LossOfPressureUponAFriction())/
                                                net.VacuumLine.Liquid.Density/9.81 +
                                                (net.ForcingLine.LossOfPressureUponLocalResistances() +
                                                 net.ForcingLine.LossOfPressureUponAFriction())/
                                                net.ForcingLine.Liquid.Density/9.81 +
                                                (net.HeatExchanger.LiquidInPipeline.LossOfPressureUponLocalResistances() +
                                                 net.HeatExchanger.LiquidInPipeline.LossOfPressureUponAFriction())/
                                                net.HeatExchanger.LiquidInPipeline.Liquid.Density/9.81 +
                                                net.ForcingLine.LossOfPressureUponLifting(5.6) / 9.81 / net.ForcingLine.Liquid.Density);
            Console.WriteLine("Для смеси {0} с параметрами t={1} и p={2} подходит ТО {3}, чтобы ее вскипятить.", liq.Id,
                              liq.Temperature, liq.Pressure, net.HeatExchanger.Id);
            Console.WriteLine("Выбранный насос: {0}.",net.Pump.Brand);
            var liq2 = new LiquidPure("6", 20, 760);
            Console.WriteLine("Коэффициент теплопроводности ацетона: {0}",liq2.ThermalConductivity / 1.163);
            Console.ReadKey();
        }
Exemplo n.º 4
0
        private void Next_2_Click(object sender, RoutedEventArgs e)
        {
            bool g = true;
            double result = 0;
            var Grid_Add_Pipeline = this.Content as MyGrid;
            var Material_In = Grid_Add_Pipeline.Children[6] as MyComboBox;
            var Pipeline_Type = Grid_Add_Pipeline.Children[4] as MyComboBox;
            var Diameter_In = Grid_Add_Pipeline.Children[12] as MyTextBox;
            var Wall_Width_In = Grid_Add_Pipeline.Children[16] as MyTextBox;
            var Length_In = Grid_Add_Pipeline.Children[8] as MyTextBox;

            var Material_Out = Grid_Add_Pipeline.Children[23] as MyComboBox;
            var Pipeline_Out_Type = Grid_Add_Pipeline.Children[21] as MyComboBox;
            var Diameter_Out = Grid_Add_Pipeline.Children[29] as MyTextBox;
            var Wall_Width_Out = Grid_Add_Pipeline.Children[33] as MyTextBox;
            var Length_Out = Grid_Add_Pipeline.Children[25] as MyTextBox;

            var Diameter_In_Measure_Choose = Grid_Add_Pipeline.Children[13] as MyComboBox;
            var Wall_Width_In_Measure_Choose = Grid_Add_Pipeline.Children[17] as MyComboBox;
            var Length_In_Measure_Choose = Grid_Add_Pipeline.Children[9] as MyComboBox;

            var Diameter_Out_Measure_Choose = Grid_Add_Pipeline.Children[30] as MyComboBox;
            var Wall_Width_Out_Measure_Choose = Grid_Add_Pipeline.Children[34] as MyComboBox;
            var Length_Out_Measure_Choose = Grid_Add_Pipeline.Children[26] as MyComboBox;

            if ((double.TryParse(Diameter_In.Text, out result) == false) || (double.TryParse(Wall_Width_In.Text, out result) == false) ||
                (double.TryParse(Length_In.Text, out result) == false) || (double.TryParse(Diameter_Out.Text, out result) == false) ||
                (double.TryParse(Wall_Width_Out.Text, out result) == false) || (double.TryParse(Length_Out.Text, out result) == false))
                g = false;

            if (g == false)
            {
                MessageBox.Show("Некоторые данные введены неправильно");
            }

            if (g == true)
            {
                //MessageBox.Show("Все отлично!");

                double DiaInNew = double.Parse(Diameter_In.Text);
                if (Diameter_In_Measure_Choose.SelectedIndex == 1)
                {
                    DiaInNew /= 100;
                }
                if (Diameter_In_Measure_Choose.SelectedIndex == 2)
                {
                    DiaInNew /= 1000;
                }

                double WallWidthInNew = double.Parse(Wall_Width_In.Text);
                if (Wall_Width_In_Measure_Choose.SelectedIndex == 1)
                {
                    WallWidthInNew /= 100;
                }
                if (Wall_Width_In_Measure_Choose.SelectedIndex == 2)
                {
                    WallWidthInNew /= 1000;
                }

                double LengthInNew = double.Parse(Length_In.Text);
                if (Length_In_Measure_Choose.SelectedIndex == 1)
                {
                    LengthInNew /= 100;
                }
                if (Length_In_Measure_Choose.SelectedIndex == 2)
                {
                    LengthInNew /= 1000;
                }

                double DiaOutNew = double.Parse(Diameter_Out.Text);
                if (Diameter_Out_Measure_Choose.SelectedIndex == 1)
                {
                    DiaOutNew /= 100;
                }
                if (Diameter_Out_Measure_Choose.SelectedIndex == 2)
                {
                    DiaOutNew /= 1000;
                }

                double WallWidthOutNew = double.Parse(Wall_Width_Out.Text);
                if (Wall_Width_Out_Measure_Choose.SelectedIndex == 1)
                {
                    WallWidthOutNew /= 100;
                }
                if (Wall_Width_Out_Measure_Choose.SelectedIndex == 2)
                {
                    WallWidthOutNew /= 1000;
                }

                double LengthOutNew = double.Parse(Length_Out.Text);
                if (Length_Out_Measure_Choose.SelectedIndex == 1)
                {
                    LengthOutNew /= 100;
                }
                if (Length_Out_Measure_Choose.SelectedIndex == 2)
                {
                    LengthOutNew /= 1000;
                }

                var Pip = new PipelineRound(Material_In.SelectedIndex + 1, Pipeline_Type.SelectedIndex + 1, DiaInNew, WallWidthInNew, LengthInNew);
                var lip_In = new LiquidInPipeline(liq, Pip);
                var Pip2 = new PipelineRound(Material_Out.SelectedIndex + 1, Pipeline_Out_Type.SelectedIndex + 1, DiaOutNew, WallWidthOutNew, LengthOutNew);
                var lip_Out = new LiquidInPipeline(liq, Pip2);

                Network.Create(lip_In, lip_Out);

                Resistance rst = new Resistance(lip_In, lip_Out, Temperature_Out,NK_dou,VP);
                rst.Show();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Разность давлений в пространстве всасывания и нагнетания, Па.
 /// </summary>
 /// <param name="lip">Жидкость во всасывающем трубопроводе.</param>
 /// <returns>Возвращает разность давлений в пространстве всасывания и нагнетания, Па.</returns>
 public double LossOfPressureUponLifting(LiquidInPipeline lip)
 {
     return this.Liquid.Pressure - lip.Liquid.Pressure;
 }