Exemplo n.º 1
0
        public static KPI Calculate(DateTime sd, DateTime ed, string client, string line, List<string> dtNoses, List<string> nonDtNoses, KPI kpi = null)
        {
            QueryDowntimeData(sd, ed, client, dtNoses, nonDtNoses);

            return KPI.Calculate(sd, ed, DowntimeData.Where(o => o.Line == line).ToList(), NonDowntimeData.Where(o => o.Line == line).ToList(), kpi);
        }
Exemplo n.º 2
0
        public static KPI Calculate(DateTime sd, DateTime ed, List<DowntimeData> downtimeData, List<DowntimeData> nondowntimeData, KPI kpi = null)
        {
            if (kpi == null)
                kpi = new KPI();

            decimal RF = 0.0m;
            decimal MTBF = 0.0m;
            decimal UF = 0.0m;

            decimal totalQueryMinutes = 0.00m;
            //decimal totalMinutes = 0.00m;
            decimal uptime = 0.00m;
            decimal downtime = 0.00m;
            decimal nonDowntime = 0.00m;
            decimal downtimeOccurrences = 0.00m;
            decimal nonDowntimeOccurrences = 0.00m;
            decimal totalOccurrences = 0.00m;

            if (downtimeData.Count > 0)
                downtimeData = downtimeData.Where(o => o.EventStart >= sd || o.EventStop >= sd).Where(o => o.EventStart <= ed || o.EventStop <= ed).ToList();

            if (nondowntimeData.Count > 0)
                nondowntimeData = nondowntimeData.Where(o => o.EventStart >= sd || o.EventStop >= sd).Where(o => o.EventStart <= ed || o.EventStop <= ed).ToList();

            if (downtimeData.Count > 0)
            {
                totalQueryMinutes = Convert.ToDecimal(ed.Subtract(sd).TotalMinutes);
                uptime = 0.00m;
                downtime = calculateDowntime(sd, ed, downtimeData);
                nonDowntime = 0.00m;
                downtimeOccurrences = 0.00m;

                DateTime firstStart = downtimeData.Where(o => o.EventStart.HasValue).Min(o => o.EventStart).Value;
                DateTime lastStart = downtimeData.Where(o => o.EventStart.HasValue).Max(o => o.EventStart).Value;

                if (nondowntimeData.Count > 0)
                    nonDowntime = calculateDowntime(sd, ed, nondowntimeData);

                uptime = totalQueryMinutes - downtime - nonDowntime;

                downtimeOccurrences = downtimeData.Count;
                nonDowntimeOccurrences = nondowntimeData.Count;

                totalOccurrences = downtimeOccurrences + nonDowntimeOccurrences;

                decimal rfDenominator = uptime + downtime;

                if (rfDenominator > 0)
                    RF = uptime / rfDenominator;

                // 1. 2. Mean Time Between Failure (MTBF) = Uptime(not downtime) / Downtime Occurrences
                MTBF = uptime / downtimeOccurrences;

                //2. 3. Utilization Factor (UF) = Uptime(not downtime) / The total of the time selected.

                UF = uptime / totalQueryMinutes;
            }

            kpi.TotalQueryMinutes = totalQueryMinutes;
            kpi.TotalMinutes = totalQueryMinutes;
            kpi.Uptime = uptime;
            kpi.Downtime = downtime;
            kpi.NonDowntime = nonDowntime;
            kpi.DowntimeOccurrences = downtimeOccurrences;
            kpi.NonDowntimeOccurrences = nonDowntimeOccurrences;
            kpi.TotalOccurrences = totalOccurrences;
            kpi.RF = RF;
            kpi.MTBF = MTBF;
            kpi.UF = UF;

            return kpi;
        }
Exemplo n.º 3
0
        public static KPI CalculateKPI(DateTime sd, DateTime ed, string client, string line)
        {
            List<string> dtNoses = new List<string>();
            List<string> nonDtNoses = new List<string>();

            if (client.ToLower() == "txi")
            {
                dtNoses.Add("Breakdown");
                nonDtNoses.Add("Circumstantial");
                nonDtNoses.Add("Planned");
            }
            else
            {

                List<Options> opts = DCSDashboardDemoHelper.GetOptions(true);

                dtNoses = opts.Select(o => o.Name).ToList();

            }

            KPI kpi = new KPI(sd, ed, client, line, dtNoses, nonDtNoses);

            return kpi;
        }