コード例 #1
0
ファイル: czart.xaml.cs プロジェクト: tomaszkubrycht/styx34
 public czart(List <Favad1.favadresults> data, WaterNetwork waterNetwork, BurstCoeffs burst, Favad1.favadcoefficients favadcoeff, Favad1.difference diff)
 {
     this.InitializeComponent();
     //this.Model = CreateNormalDistributionModel();
     this.DataContext  = this;
     this.rekord       = data;
     this.waterNetwork = waterNetwork;
     this.bust         = burst;
     this.diff         = diff;
     this.Model        = CreateNormalDistributionModel(data, waterNetwork, favadcoeff, burst);
     this.ShowResults(data, burst, diff);
 }
コード例 #2
0
        public int GenFAVADOutput(WaterNetwork waternetwork_tk, EFavorTest efavor, BurstCoeffs burstCoeffs)
        {
            try
            {
                Favad                    favad2         = new Favad();
                double                   demand         = favad2.Get_minDemand(waternetwork_tk);
                Logger                   representative = favad2.FFind_repr_logger(efavor, waternetwork_tk);
                List <FlowMeter>         inlets         = favad2.FInlet(efavor);
                List <pair_values_favad> records        = new List <pair_values_favad>();
                for (int n = 0; n < representative.measured_pressure.Count(); n++)
                {
                    pair_values_favad pair = new pair_values_favad();
                    pair.flow     = inlets[0].measured_flow[n];
                    pair.pressure = representative.measured_pressure[n];
                    records.Add(pair);
                }
                //calibration process
                var    last     = records.Last();
                var    previous = records.AsEnumerable().Reverse().Skip(1).FirstOrDefault();
                double anzp0    = previous.pressure;
                double anzp1    = last.pressure;
                double L0       = previous.flow;;
                double L1       = last.flow;

                N1 = (Math.Log(L1 / L0)) / (Math.Log(anzp1 / anzp0));
                var B = ((L0 - demand) / Math.Pow(anzp0, 0.5) - (L1 - demand) / Math.Pow(anzp1, 0.5)) / (anzp0 - anzp1);
                var A = ((L0 - demand) / Math.Pow(anzp0, 0.5)) - B * anzp0;
                favadcoeff.A = A;
                favadcoeff.B = B;
                var text = String.Format("N1 Coefficient: {0}", N1.ToString());
                //MessageBox.Show(text);
                LeakEstimation(N1, records, demand, waternetwork_tk, burstCoeffs, favadcoeff);
                return(0);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(-1);

                throw;
            }
        }
コード例 #3
0
ファイル: czart.xaml.cs プロジェクト: tomaszkubrycht/styx34
        private int ShowResults(List <Favad1.favadresults> data1, BurstCoeffs burst, Favad1.difference diff)
        {
            var hig = 40;

            data1.Reverse();
            ColumnDefinition colDef1 = new ColumnDefinition();
            ColumnDefinition colDef2 = new ColumnDefinition();
            ColumnDefinition colDef3 = new ColumnDefinition();
            ColumnDefinition colDef4 = new ColumnDefinition();
            ColumnDefinition colDef5 = new ColumnDefinition();
            ColumnDefinition colDef6 = new ColumnDefinition();

            FavadResultsGrid.ColumnDefinitions.Add(colDef1);
            FavadResultsGrid.ColumnDefinitions.Add(colDef2);
            FavadResultsGrid.ColumnDefinitions.Add(colDef3);
            FavadResultsGrid.ColumnDefinitions.Add(colDef4);
            FavadResultsGrid.ColumnDefinitions.Add(colDef5);
            FavadResultsGrid.ColumnDefinitions.Add(colDef6);
            for (int i = 0; i < data1.Count; i++)
            {
                FavadResultsGrid.RowDefinitions.Add(new RowDefinition());
            }
            //create headers
            TextBlock column0Header = new TextBlock();

            column0Header.Text                = "PRV Step No.";
            column0Header.Height              = hig;
            column0Header.Width               = 150;
            column0Header.TextWrapping        = TextWrapping.Wrap;
            column0Header.TextAlignment       = TextAlignment.Left;
            column0Header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            column0Header.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            Grid.SetColumn(column0Header, 0);
            Grid.SetRow(column0Header, 0);
            FavadResultsGrid.Children.Add(column0Header);

            TextBlock column1Header = new TextBlock();

            column1Header.Text                = "Burst flow FAVAD N1 Update";
            column1Header.Height              = hig;
            column1Header.Width               = 150;
            column1Header.TextWrapping        = TextWrapping.Wrap;
            column1Header.TextAlignment       = TextAlignment.Left;
            column1Header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            column1Header.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            Grid.SetColumn(column1Header, 1);
            Grid.SetRow(column1Header, 0);

            FavadResultsGrid.Children.Add(column1Header);

            TextBlock column2Header = new TextBlock();

            column2Header.Text                = "AZNP";
            column2Header.Height              = hig;
            column2Header.Width               = 50;
            column2Header.TextWrapping        = TextWrapping.Wrap;
            column2Header.TextAlignment       = TextAlignment.Left;
            column2Header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            column2Header.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            Grid.SetColumn(column2Header, 2);
            Grid.SetRow(column2Header, 0);

            FavadResultsGrid.Children.Add(column2Header);

            TextBlock column3Header = new TextBlock();

            column3Header.Text                = "Flow from Burst Detectror";
            column3Header.Height              = hig;
            column3Header.Width               = 200;
            column0Header.TextWrapping        = TextWrapping.Wrap;
            column3Header.TextAlignment       = TextAlignment.Left;
            column3Header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            column3Header.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            Grid.SetColumn(column3Header, 3);
            Grid.SetRow(column3Header, 0);

            FavadResultsGrid.Children.Add(column3Header);

            TextBlock column4Header = new TextBlock();

            column4Header.Text                = "Mean difference Favad";
            column4Header.Height              = hig;
            column4Header.Width               = 150;
            column4Header.TextWrapping        = TextWrapping.Wrap;
            column4Header.TextAlignment       = TextAlignment.Left;
            column4Header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            column4Header.VerticalAlignment   = System.Windows.VerticalAlignment.Center; / 09
コード例 #4
0
        public int LeakEstimation(double N1, List <pair_values_favad> para, double demand, WaterNetwork network, BurstCoeffs burstCoeffs, favadcoefficients favadcoeff)
        {
            try
            {
                //favad_res.N1 = N1;
                para.Reverse();
                for (int jx = 0; jx < para.Count() - 1; jx++)
                {
                    favadresults favad_res = new favadresults();
                    favad_res.N1    = N1;
                    favad_res.Flow0 = para[jx].flow - demand;
                    favad_res.AZNP0 = para[jx].pressure;
                    favad_res.AZNP1 = para[jx + 1].pressure;
                    favad_res.Flow1 = favad_res.Flow0 * Math.Pow((favad_res.AZNP1 / favad_res.AZNP0), favad_res.N1);
                    favadres.Add(favad_res);
                }
                var nodes              = network.listOfNodes;
                var emmiter            = nodes.Where(s => s.emmitterCoefficient != 0).First();
                var result_comparation = ComparativeRres(favadcoeff.A, favadcoeff.B, N1, emmiter.emmitterCoefficient, network.emitterExponent, burstCoeffs.est_burst_coeff, burstCoeffs.est_burst_exponent);

                czart czart1 = new czart(favadres, network, burstCoeffs, favadcoeff, result_comparation);
                czart1.Show();



                return(0);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(-1);
            }
        }