コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PeriodTime periodtime = db.periodTime.Find(id);

            db.periodTime.Remove(periodtime);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public PeriodTime Add(AddPeriodTimeInput input)
        {
            PeriodTime entity = this.CreateEntity <PeriodTime>();

            entity.SeveraWeeks = input.SeveraWeeks;
            entity.StratTime   = input.StratTime;
            entity.EndTime     = input.EndTime;
            return(this.DbContext.Insert(entity));
        }
コード例 #3
0
        //
        // GET: /PeriodTime/Delete/5

        public ActionResult Delete(int id = 0)
        {
            PeriodTime periodtime = db.periodTime.Find(id);

            if (periodtime == null)
            {
                return(HttpNotFound());
            }
            return(View(periodtime));
        }
コード例 #4
0
 public ActionResult Edit(PeriodTime periodtime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(periodtime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(periodtime));
 }
コード例 #5
0
        public override double calcErrorTEmpOutPredicted(PeriodTime periodTime)
        {
            var    bemts     = getListByPeriod(periodTime);
            double SumEiPow2 = 0.0;

            foreach (var bemt in bemts)
            {
                SumEiPow2 += Math.Pow(bemt.temperatureReal - bemt.tempOutPredicted, 2);
            }
            return(Math.Sqrt(SumEiPow2 / bemts.Count));
        }
コード例 #6
0
        public ActionResult Create(PeriodTime periodtime)
        {
            if (ModelState.IsValid)
            {
                db.periodTime.Add(periodtime);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(periodtime));
        }
コード例 #7
0
        public override double calcErrorTEmpOutPredicted(PeriodTime periodTime)
        {
            var    bemts   = getListByPeriod(periodTime);
            double P_i     = 0;
            double Sum_P_i = 0;

            foreach (var bemt in bemts)
            {
                P_i     += Math.Abs(bemt.temperatureReal - bemt.tempOutPredicted) / bemt.temperatureReal;
                Sum_P_i += 100 * Math.Abs(P_i);
            }
            return(1.0 / bemts.Count * Sum_P_i);
        }
コード例 #8
0
        public override double calcErrorPrevious(PeriodTime periodTime)
        {
            var    bemts          = getListByPeriod(periodTime);
            double SumEiPow2      = 0.0;
            double SumAbsRealTime = 0.0;

            foreach (var bemt in bemts)
            {
                SumAbsRealTime += Math.Abs(bemt.temperatureReal);
                SumEiPow2      += Math.Pow(bemt.temperatureReal - bemt.asPrevious, 2);
            }

            return(1.0 / bemts.Count * SumAbsRealTime * Math.Sqrt(SumEiPow2));
        }
コード例 #9
0
        public override double calcErrorPrevious(PeriodTime periodTime)
        {
            var bemts = getListByPeriod(periodTime);

            //Console.WriteLine(bemts.Count);
            double P_i     = 0;
            double Sum_P_i = 0;

            foreach (var bemt in bemts)
            {
                P_i     += Math.Abs(bemt.temperatureReal - bemt.asPrevious) / bemt.temperatureReal;
                Sum_P_i += 100 * Math.Abs(P_i);
            }
            return(1.0 / bemts.Count * Sum_P_i);
        }
コード例 #10
0
        public override double calcErrorPredicted(PeriodTime periodTime)
        {
            var bemts = getListByPeriod(periodTime);
            //Console.WriteLine(bemts.Count);
            double SumEiPow2      = 0.0;
            double SumAbsRealTime = 0.0;

            foreach (var bemt in bemts)
            {
                SumAbsRealTime += Math.Abs(bemt.temperatureReal);
                SumEiPow2      += Math.Pow(bemt.temperatureReal - bemt.temperaturePredicted, 2);
            }

            return(1.0 / bemts.Count * SumAbsRealTime * Math.Sqrt(SumEiPow2));
        }
コード例 #11
0
        public ErrorList(IEnumerable <List <BEMT> > bemts, PeriodTime periodTime, int countInPeriod)
        {
            ListMapeError   = bemts.Select(q => new ErrorMAPE(q, ErrorType.MAPE, PeriodTime.HOUR));
            ListInRSEError  = bemts.Select(q => new ErrorInRSE(q, ErrorType.IN_RSE, PeriodTime.HOUR));
            ListInRMSEError = bemts.Select(q => new ErrorInRMSE(q, ErrorType.RMSE, PeriodTime.HOUR));

            PeriodTime    = periodTime;
            CountInPeriod = countInPeriod;

            summErrorMapePrevious     = CalcAverageErrorPrevious(ListMapeError, countInPeriod);
            summErrorMapePredicted    = CalcAverageErrorPredicted(ListMapeError, countInPeriod);
            summErrorMapeOutPredicted = CalcAverageErrorOutPredicted(ListMapeError, countInPeriod);

            summErrorInRSEPrevious     = CalcAverageErrorPrevious(ListInRSEError, countInPeriod);
            summErrorInRSEPredicted    = CalcAverageErrorPredicted(ListInRSEError, countInPeriod);
            summErrorInRSEOutPredicted = CalcAverageErrorOutPredicted(ListInRSEError, countInPeriod);

            summErrorInRMSEPrevious     = CalcAverageErrorPrevious(ListInRMSEError, countInPeriod);
            summErrorInRMSEPredicted    = CalcAverageErrorPredicted(ListInRMSEError, countInPeriod);
            summErrorInRMSEOutPredicted = CalcAverageErrorOutPredicted(ListInRMSEError, countInPeriod);
        }
コード例 #12
0
        public List <BEMT> getListByPeriod(PeriodTime periodTime)
        {
            List <BEMT> recuaredList = new List <BEMT>();

            switch (periodTime)
            {
            case PeriodTime.HOUR:
                return(Bemts);

            case PeriodTime.DAY:
                foreach (var bemt in Bemts)
                {
                    if (bemt.dateTime.Hour == 0 && bemt.dateTime.Minute == 0)
                    {
                        recuaredList.Add(bemt);
                    }
                }
                return(recuaredList);

            case PeriodTime.WEEK:

                break;

            case PeriodTime.MONTH:
                foreach (var bemt in Bemts)
                {
                    if (bemt.dateTime.Month == 8 && bemt.dateTime.Hour == 0 && bemt.dateTime.Minute == 0)                     //8 = augast
                    {
                        recuaredList.Add(bemt);
                    }
                }
                return(recuaredList);

            case PeriodTime.YEAR:
                return(recuaredList);

            default: return(recuaredList);
            }
            return(recuaredList);
        }
コード例 #13
0
 public ErrorInRMSE(List <BEMT> bemts, ErrorType errorType, PeriodTime periodTime) : base(bemts, errorType)
 {
     ErrorValuePredicted        = calcErrorPredicted(periodTime);
     ErrorValuePrevious         = calcErrorPrevious(periodTime);
     ErrorValueTempOutPredicted = calcErrorTEmpOutPredicted(periodTime);
 }
コード例 #14
0
 public abstract double calcErrorTEmpOutPredicted(PeriodTime periodTime);
コード例 #15
0
 public abstract double calcErrorPrevious(PeriodTime periodTime);
コード例 #16
0
 public static void PrintAverageError(PeriodTime periodTime, double summErrors,
                                      string message)
 {
     Console.WriteLine("{0} {1:#.##} by {2}", message,
                       summErrors, periodTime);
 }