예제 #1
0
        /// <summary>
        /// 计算Xbar-R图控制线
        /// </summary>
        /// <param name="xTotalAvg">总平均值</param>
        /// <param name="rTotalAvg">平均极差值</param>
        /// <param name="n">平均子组数量</param>
        /// <returns>返回:X管制上线、X管制中线、X管制下线、R管制上线、R管制中线、R管制下线</returns>
        public static IDictionary CalculateXbar_RControlLine(double xTotalAvg, double rTotalAvg, int n)
        {
            double d2 = 0, d3 = 0;

            d2 = new ConstantSPC("D2").GetConstantItem(n).Value;
            d3 = new ConstantSPC("D3").GetConstantItem(n).Value;

            Dictionary <string, double> xbarRCtrlLineDic = new Dictionary <string, double>();
            double xCL = 0, xUCL = 0, xLCL = 0;
            double rCL = 0, rUCL = 0, rLCL = 0;
            //double A2 = 0;
            double D3     = 0;
            double D4     = 0;
            double eValue = 0;


            xCL    = Math.Round(xTotalAvg, 4);
            rCL    = Math.Round(rTotalAvg, 4);
            eValue = rTotalAvg / (Math.Sqrt(n) * d2);
            xUCL   = Math.Round(xTotalAvg + 3 * eValue, 4);
            xLCL   = Math.Round(xTotalAvg - 3 * eValue, 4);

            D3   = 1 - 3 * d3 / d2;
            D4   = 1 + 3 * d3 / d2;
            rUCL = Math.Round(D4 * rTotalAvg, 4);
            rLCL = Math.Round(D3 * rTotalAvg < 0 ? 0 : D3 * rTotalAvg, 4);
            xbarRCtrlLineDic.Add("xCL", xCL);
            xbarRCtrlLineDic.Add("xUCL", xUCL);
            xbarRCtrlLineDic.Add("xLCL", xLCL);
            xbarRCtrlLineDic.Add("rCL", rCL);
            xbarRCtrlLineDic.Add("rUCL", rUCL);
            xbarRCtrlLineDic.Add("rLCL", rLCL);
            xbarRCtrlLineDic.Add("eValue", eValue);
            return(xbarRCtrlLineDic);
        }
예제 #2
0
        /// <summary>
        /// 计算XBAR-S 的管制线
        /// </summary>
        /// <param name="xTotalAvg">样本总平均值</param>
        /// <param name="avgS">样本标准差</param>
        /// <param name="C4"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public static IDictionary CalculateXbar_SControlLine(double xTotalAvg, double avgS, int n)
        {
            double C4 = 0;

            C4 = new ConstantSPC("C4").GetConstantItem(n).Value;

            Dictionary <string, double> xbarSCtrlLineDic = new Dictionary <string, double>();
            double xCL = 0, xUCL = 0, xLCL = 0;
            double sCL = 0, sUCL = 0, sLCL = 0;
            double A3 = 0, B3 = 0, B4 = 0, tempValue = 0;
            double eValue = 0; //sigma

            xCL = Math.Round(xTotalAvg, 4);
            sCL = Math.Round(avgS, 4);

            //eValue = avgS / (Math.Sqrt(Convert.ToDouble(n)) * C4);
            //计算Sigma
            eValue = avgS / C4;

            A3        = 3 / (Math.Sqrt(Convert.ToDouble(n)) * C4);
            tempValue = (Math.Sqrt(1 - Math.Pow(C4, 2))) / C4;
            B3        = 1 - 3 * tempValue;
            B4        = 1 + 3 * tempValue;

            xUCL = Math.Round(xTotalAvg + A3 * avgS, 4);
            xLCL = Math.Round(xTotalAvg - A3 * avgS, 4);

            sUCL = Math.Round(B4 * avgS, 4);
            sLCL = Math.Round(B3 * avgS, 4);
            xbarSCtrlLineDic.Add("xCL", xCL);
            xbarSCtrlLineDic.Add("xUCL", xUCL);
            xbarSCtrlLineDic.Add("xLCL", xLCL);

            xbarSCtrlLineDic.Add("sCL", sCL);
            xbarSCtrlLineDic.Add("sUCL", sUCL);
            xbarSCtrlLineDic.Add("sLCL", sLCL);
            xbarSCtrlLineDic.Add("eValue", eValue);
            return(xbarSCtrlLineDic);
        }