Пример #1
0
        public void createPumpRunChart(ChartZedControl chart, PumpTypeEnum type, bool split, int splitPower)
        {
            int             ind    = 0;
            PumpDiagnostics report = new PumpDiagnostics(clndFrom.SelectedDate.Value, clndTo.SelectedDate.Value);
            SortedList <DateTime, PumpDataRecord> Data = new SortedList <DateTime, PumpDataRecord>();

            chart.init();

            List <int> powers = new List <int>();

            if (split)
            {
                powers.Add(-1);
                int power = 35;
                while (power <= 115)
                {
                    powers.Add(power);
                    power += splitPower;
                }
            }
            else
            {
                splitPower = 200;
                powers.Add(-1);
            }
            SortedList <DateTime, double> dataLStart = new SortedList <DateTime, double>();
            SortedList <DateTime, double> dataLStop  = new SortedList <DateTime, double>();

            foreach (int p in powers)
            {
                string header = "";
                if (!split)
                {
                    Data   = report.ReadDataPump(type, -1, 200);
                    header = "Время работы насосов";
                }
                else
                {
                    if (p == -1)
                    {
                        Data   = report.ReadDataPump(type, -1, 0);
                        header = "Простой";
                    }
                    else
                    {
                        Data   = report.ReadDataPump(type, p, p + splitPower);
                        header = String.Format("Работа при P {0}-{1}", p, p + splitPower);
                    }
                }


                if (Data.Count > 1)
                {
                    System.Drawing.Color color = ChartZedSerie.NextColor();

                    SortedList <DateTime, double> data = new SortedList <DateTime, double>();

                    foreach (KeyValuePair <DateTime, PumpDataRecord> de in Data)
                    {
                        data.Add(de.Key, de.Value.RunTime);
                        dataLStart.Add(de.Key, de.Value.LevelStart);
                        dataLStop.Add(de.Key, de.Value.LevelStop);
                    }

                    chart.AddSerie(header, data, color, false, true);

                    SortedList <DateTime, double> appr = report.Approx(data);

                    ChartZedSerie ser = chart.AddSerie(header, appr, color, true, false, -1, false);
                }
            }
            chart.AddSerie("LStart", dataLStart, ChartZedSerie.NextColor(), true, false, 0);
            chart.AddSerie("LStop", dataLStop, ChartZedSerie.NextColor(), true, false, 0);
        }
Пример #2
0
        public void createOilChart(ChartZedControl chart, bool gp, bool splitHot, bool splitCold, double step, bool isOhl)
        {
            int             ind    = 0;
            PumpDiagnostics report = new PumpDiagnostics(clndFrom.SelectedDate.Value, clndTo.SelectedDate.Value);
            Dictionary <DateTime, SvodDataRecord> Data = new Dictionary <DateTime, SvodDataRecord>();

            chart.init();

            string obj  = gp ? "GP_" : "PP_";
            string temp = splitHot ? "Hot" : "Cold";

            obj = obj + temp;
            string isUstGroup = gp ? "IsUstGP" : "IsUstPP";

            if (isOhl)
            {
                isUstGroup += "Ohl";
            }
            bool split = splitHot || splitCold;

            if (isOhl)
            {
                split = false;
            }


            List <double> AllTemps = new List <double>();

            if (split)
            {
                double t = 10;
                while (t <= 50)
                {
                    AllTemps.Add(t);
                    t += step;
                }
            }
            else
            {
                step = 50;
                AllTemps.Add(10);
            }
            foreach (double t in AllTemps)
            {
                string headerRun  = "";
                string headerStop = "";

                if (!split)
                {
                    if (!isOhl)
                    {
                        headerRun  = "Уровень масла (ГГ в работе)";
                        headerStop = "Уровень масла (ГГ стоит)";
                    }
                    else
                    {
                        headerRun  = "Расход (ГГ в работе)";
                        headerStop = "Расход (ГГ стоит)";
                    }
                }
                else
                {
                    headerRun  = String.Format("Уровень при t {0:0.0}-{1:0.0} (ГГ в работе)", t, t + step);
                    headerStop = String.Format("Уровень при t {0:0.0}-{1:0.0} (стоит)", t, t + step);
                }


                SortedList <DateTime, double> RunForApprox  = new SortedList <DateTime, double>();
                SortedList <DateTime, double> StopForApprox = new SortedList <DateTime, double>();



                Data = report.ReadSvod(obj, t, t + step, isUstGroup);
                foreach (KeyValuePair <DateTime, SvodDataRecord> de in Data)
                {
                    if (de.Value.PAvg == 0)
                    {
                        if (gp)
                        {
                            StopForApprox.Add(de.Key, isOhl ? de.Value.GPOhlRashod : de.Value.GPLevel);
                        }
                        else
                        {
                            StopForApprox.Add(de.Key, isOhl ? de.Value.PPOhlRashod : de.Value.PPLevel);
                        }
                    }
                    else
                    {
                        if (gp)
                        {
                            RunForApprox.Add(de.Key, isOhl ? de.Value.GPOhlRashod : de.Value.GPLevel);
                        }
                        else
                        {
                            RunForApprox.Add(de.Key, isOhl ? de.Value.PPOhlRashod : de.Value.PPLevel);
                        }
                    }
                }
                System.Drawing.Color color = ChartZedSerie.NextColor();
                if (RunForApprox.Count > 1)
                {
                    chart.AddSerie(headerRun, RunForApprox, color, false, true);

                    SortedList <DateTime, double> appr = report.Approx(RunForApprox);
                    ChartZedSerie ser = chart.AddSerie(headerRun, appr, color, true, false, -1, false);
                }
                //line.Line.IsVisible = false;
                if (StopForApprox.Count > 1 && !isOhl)
                {
                    chart.AddSerie(headerStop, StopForApprox, color, false, true);

                    SortedList <DateTime, double> appr = report.Approx(StopForApprox);
                    ChartZedSerie ser = chart.AddSerie(headerStop, appr, color, true, false, -1, false);
                }



                //line.Line.IsVisible = false;
            }
            if (!isOhl)
            {
                SortedList <DateTime, double> DataHot  = new SortedList <DateTime, double>();
                SortedList <DateTime, double> DataCold = new SortedList <DateTime, double>();
                Data = report.ReadSvod(obj, -200, 200, isUstGroup);
                foreach (KeyValuePair <DateTime, SvodDataRecord> de in Data)
                {
                    if (gp)
                    {
                        DataHot.Add(de.Key, de.Value.GPHot);
                        DataCold.Add(de.Key, de.Value.GPCold);
                    }
                    else
                    {
                        DataHot.Add(de.Key, de.Value.PPHot);
                        DataCold.Add(de.Key, de.Value.PPCold);
                    }
                }
                chart.AddSerie("T_Hot", DataHot, ChartZedSerie.NextColor(), true, false, 0);
                chart.AddSerie("T_Cold", DataCold, ChartZedSerie.NextColor(), true, false, 0);
            }
        }