Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Experts,
MTBF(Mean Time Between Failure)
tool number date quantity mtbf Entry type

t1 02-12-2013 500 Production
t1 02-12-2013 400 900 Breakdown
t1 02-13-2013 300 Production
t1 02-14-2013 700 Production
t1 02-15-2013 600 Production
t1 02-16-2013 600 2200 Breakdown
t1 02-17-2013 600 Production

Now let me define, what is MTBF and how it is calculated...
MTBF is the sum of quantity produced between two breakdown.
I have given an example above that i have a tool named t1 which produced some quantity datewise. MTBF will be introduced only when breakdown entry occurs which is display in entry type.

Now, my question is how i can calculate it in asp.net C#.
I need to calculate MTBF between two breakdown entry.
It's very urgen, plz help
any help will be appreciated..


Regads Sunil
Posted
Comments
Sunil Dhanerwal1 3-Jul-13 4:07am    
plz help experts

1 solution

I have solved this using C# console application.You can see the logic and modify in asp.net or any function in c#

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MTBF
{
    class Program
    {
        static void Main(string[] args)
        {
            int quantity, quantity_sum = 0;
            int i=1;
            string ch="";
            while (i <= 10)
            {
                Console.WriteLine();
                Console.Write("\nEnter Quantity = ");
                quantity = int.Parse(Console.ReadLine());
                quantity_sum = quantity_sum + quantity;
                Console.Write("\nIs there a breakdown(y or n) = ");
                ch = Console.ReadLine();
                if (ch.Equals("y"))
                {
                    Console.Write("\nBreakdown = " + quantity_sum);
                    quantity_sum = 0;
                }
                else
                {
                //loop will go again to take quantity and add production
                }
                i++;

            }
        }
    }
}



Output



Enter Quantity = 500

Is there a breakdown(y or n) = n


Enter Quantity = 400

Is there a breakdown(y or n) = y

Breakdown = 900

Enter Quantity = 300

Is there a breakdown(y or n) = n


Enter Quantity = 700

Is there a breakdown(y or n) = n


Enter Quantity = 600

Is there a breakdown(y or n) = n


Enter Quantity = 600

Is there a breakdown(y or n) = y

Breakdown = 2200

Enter Quantity =
 
Share this answer
 
v3
Comments
Sunil Dhanerwal1 12-Jul-13 2:38am    
thanks for reply but not this way.. I need to take date into account because date is the main factor where MTBF will be checked between two date. We can not take it sequentially because back date entry are also allowed
Rajan Maheshwari 12-Jul-13 3:08am    
so it can also be possible..take the date into string aur datetype and compare it..if it matches according to your condition fire the function..
Sunil Dhanerwal1 12-Jul-13 3:41am    
it's gonna be down to top approach... suppose breakdown occurs on 12 july then we need to find out last breakdown entry. how can we find that entry??
Rajan Maheshwari 12-Jul-13 3:44am    
maintain a database record with a flag value of breakdown.if it occurs on 12 july then flag value if breakdown equal to yes...then search and apply query in ypur database where the breakdown flag is yes.and till there apply a select sum query by using the BETWEEN keyword to find the date of your breakdown (last breadown) and then other one

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900