Exemple #1
0
        public static GraphVyrabRGEAnswer getAnswer(DateTime date, bool calcTables = true, bool steppedPBR=true)
        {
            DateTime dateStart=date.Date;
            DateTime dateEnd=date.Date.AddHours(24);
            date = calcTables ? date : dateEnd;

            GraphVyrabRGEAnswer answer=new GraphVyrabRGEAnswer();

            PBRData rge1=new PBRData(dateStart, dateEnd, date, GTPEnum.rge1);
            PBRData rge2=new PBRData(dateStart, dateEnd, date, GTPEnum.rge2);
            PBRData rge3=new PBRData(dateStart, dateEnd, date, GTPEnum.rge3);
            PBRData rge4=new PBRData(dateStart, dateEnd, date, GTPEnum.rge4);
            rge1.IsSteppedPBR = steppedPBR;
            rge2.IsSteppedPBR = steppedPBR;
            rge3.IsSteppedPBR = steppedPBR;
            rge4.IsSteppedPBR = steppedPBR;

            answer.ChartRGE1 = new ChartAnswer();
            answer.ChartRGE1.Properties = getChartProperties(220, steppedPBR);
            answer.ChartRGE1.Data = new ChartData();

            answer.ChartRGE2 = new ChartAnswer();
            answer.ChartRGE2.Properties = getChartProperties(200, steppedPBR);
            answer.ChartRGE2.Data = new ChartData();

            answer.ChartRGE3 = new ChartAnswer();
            answer.ChartRGE3.Properties = getChartProperties(200, steppedPBR);
            answer.ChartRGE3.Data = new ChartData();

            answer.ChartRGE4 = new ChartAnswer();
            answer.ChartRGE4.Properties = getChartProperties(400, steppedPBR);
            answer.ChartRGE4.Data = new ChartData();

            rge1.InitData();
            rge2.InitData();
            rge3.InitData();
            rge4.InitData();

            DateTime[] dates=new DateTime[] { rge1.Date, rge2.Date, rge3.Date, rge4.Date };
            answer.ActualDate = dates.ToList().Min(); ;

            DateTime lastDate=answer.ActualDate;

            if (calcTables) {
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P план", Math.Round(rge1.MinutesPBR[lastDate]), Math.Round(rge2.MinutesPBR[lastDate]), Math.Round(rge3.MinutesPBR[lastDate]), Math.Round(rge4.MinutesPBR[lastDate])));
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P факт", Math.Round(rge1.RealP[lastDate]), Math.Round(rge2.RealP[lastDate]), Math.Round(rge3.RealP[lastDate]), Math.Round(rge4.RealP[lastDate])));
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P откл", rge1.getDiff(lastDate), rge2.getDiff(lastDate), rge3.getDiff(lastDate), rge4.getDiff(lastDate)));
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P откл %", rge1.getDiffProc(lastDate), rge2.getDiffProc(lastDate), rge3.getDiffProc(lastDate), rge4.getDiffProc(lastDate)));

                SortedList<string,double> rge1Hour=rge1.getHourVals(lastDate);
                SortedList<string,double> rge2Hour=rge2.getHourVals(lastDate);
                SortedList<string,double> rge3Hour=rge3.getHourVals(lastDate);
                SortedList<string,double> rge4Hour=rge4.getHourVals(lastDate);

                answer.TableHour.Add(new GraphVyrabRGETableRow("P план", Math.Round(rge1Hour["plan"]), Math.Round(rge2Hour["plan"]), Math.Round(rge3Hour["plan"]), Math.Round(rge4Hour["plan"])));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P факт", Math.Round(rge1Hour["fakt"]), Math.Round(rge2Hour["fakt"]), Math.Round(rge3Hour["fakt"]), Math.Round(rge4Hour["fakt"])));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P откл", rge1Hour["diff"], rge2Hour["diff"], rge3Hour["diff"], rge4Hour["diff"]));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P откл %", rge1Hour["diffProc"], rge2Hour["diffProc"], rge3Hour["diffProc"], rge4Hour["diffProc"]));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P рек", Math.Round(rge1Hour["recP"]), Math.Round(rge2Hour["recP"]), Math.Round(rge3Hour["recP"]), Math.Round(rge4Hour["recP"])));

            }

            answer.ChartRGE1.Data.addSerie(getDataSerie("Fakt", rge1.RealP, -1));
            answer.ChartRGE1.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge1.SteppedPBR : rge1.RealPBR, 0));

            answer.ChartRGE2.Data.addSerie(getDataSerie("Fakt", rge2.RealP, -1));
            answer.ChartRGE2.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge2.SteppedPBR : rge2.RealPBR, 0));

            answer.ChartRGE3.Data.addSerie(getDataSerie("Fakt", rge3.RealP, -1));
            answer.ChartRGE3.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge3.SteppedPBR : rge3.RealPBR, 0));

            answer.ChartRGE4.Data.addSerie(getDataSerie("Fakt", rge4.RealP, -1));
            answer.ChartRGE4.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge4.SteppedPBR : rge4.RealPBR, 0));

            answer.ChartRGE1.processAxes();
            answer.ChartRGE2.processAxes();
            answer.ChartRGE3.processAxes();
            answer.ChartRGE4.processAxes();

            return answer;
        }
Exemple #2
0
partial         void OnRGEChanging(GraphVyrabRGEAnswer value);