예제 #1
0
 private void d2HistToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (matrLL.Length != 2)
         {
             return;
         }
         double[] arrLX = (double[])matrLL[0].Clone(), arrLY = (double[])matrLL[1].Clone();
         double[,] matrZ = new double[arrLX.Length, arrLY.Length];
         int[,] matrC    = new int[arrLX.Length, arrLY.Length];
         for (int i = 0; i < arrLX.Length; i++)
         {
             for (int j = 0; j < arrLY.Length; j++)
             {
                 matrZ[i, j] = arrP[i * arrLY.Length + j];
                 matrC[i, j] = Color.LemonChiffon.ToArgb();
             }
         }
         H2DForm hf = new H2DForm(arrLX, arrLY, matrZ, matrC, 1);
         hf.InitializeGraphics();
         hf.Show();
     }
     catch
     {
         MessageBox.Show("Ошибка построения гистограммы");
     }
 }
예제 #2
0
 private void d2HistZoneToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (matrLL.Length != 2)
         {
             return;
         }
         H2DPropForm hpf = new H2DPropForm();
         if (hpf.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         int      iMin = int.Parse(hpf.tbY1Min.Text), iMax = int.Parse(hpf.tbY1Max.Text);
         int      jMin = int.Parse(hpf.tbY2Min.Text), jMax = int.Parse(hpf.tbY2Max.Text);
         double[] arrLX = (double[])matrLL[0].Clone(), arrLY = (double[])matrLL[1].Clone();
         double[,] matrZ = new double[arrLX.Length, arrLY.Length];
         int[,] matrC    = new int[arrLX.Length, arrLY.Length];
         for (int i = 0; i < arrLX.Length; i++)
         {
             for (int j = 0; j < arrLY.Length; j++)
             {
                 matrZ[i, j] = arrP[i * arrLY.Length + j];
                 if (i >= iMin && i <= iMax && j >= jMin && j <= jMax)
                 {
                     matrC[i, j] = Color.Red.ToArgb();
                 }
                 else
                 {
                     matrC[i, j] = Color.LemonChiffon.ToArgb();
                 }
             }
         }
         H2DForm hf = new H2DForm(arrLX, arrLY, matrZ, matrC, 1);
         hf.InitializeGraphics();
         hf.Show();
     }
     catch
     {
         MessageBox.Show("Ошибка построения гистограммы");
     }
 }
예제 #3
0
        void identToolStripMenuItem_Click(object sender, EventArgs e)
        {
            double[] arrUMin, arrUMax;
            double   Q0, Q;
            IdForm   idf;

            try
            {
                idf = new IdForm(arrXName, arrYName, matrX, arrXAv);
                if (idf.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                double[] arrYMin2 = new double[arrYName.Length], arrYMax2 = new double[arrYName.Length];
                for (int i = 0; i < arrYName.Length; i++)
                {
                    if (idf.arrYMinNum[i] == 0)
                    {
                        arrYMin2[i] = arrYMin[i];
                    }
                    else
                    {
                        arrYMin2[i] = matrL[i][idf.arrYMinNum[i] - 1];
                    }
                    arrYMax2[i] = matrL[i][idf.arrYMaxNum[i]];
                }
                arrReport[13] = Quality.Ident(matrX, matrY, arrYMin2, arrYMax2,
                                              idf.arrU0Min, idf.arrU0Max, idf.arrDU, idf.maxIter, idf.DQ,
                                              out arrUMin, out arrUMax, out Q0, out Q);
                string[,] matr = new string[arrUMin.Length, 3];
                for (int i = 0; i < arrUMin.Length; i++)
                {
                    matr[i, 0] = arrXName[i];
                    matr[i, 1] = string.Format("{0:g4}", arrUMin[i]);
                    matr[i, 2] = string.Format("{0:g4}", arrUMax[i]);
                }
                arrReport[13] += "Результат идентификации" +
                                 Quality.Table2(matr, new string[] { "Технологический фактор", "Min", "Max" });
                for (int i = 0; i < arrUMin.Length; i++)
                {
                    matr[i, 0] = arrXName[i];
                    matr[i, 1] = string.Format("{0:g4}", arrUMin[i] * arrXAv[i]);
                    matr[i, 2] = string.Format("{0:g4}", arrUMax[i] * arrXAv[i]);
                }
                arrReport[13] += "Результат идентификации (ненормированные значения)" +
                                 Quality.Table2(matr, new string[] { "Технологический фактор", "Min", "Max" });
            }
            catch
            {
                MessageBox.Show("Ошибка идентификации");
                return;
            }

            try
            {
                if (matrLL.Length == 2)
                {
                    List <int> lInd = new List <int>();
                    for (int i = 0; i < matrX.GetLength(0); i++)
                    {
                        int j;
                        for (j = 0; j < arrUMin.Length; j++)
                        {
                            if (matrX[i, j] < arrUMin[j] ||
                                matrX[i, j] > arrUMax[j])
                            {
                                break;
                            }
                        }
                        if (j == arrUMin.Length)
                        {
                            lInd.Add(i);
                        }
                    }
                    double[,] matrYU = new double[lInd.Count, arrYMin.Length];
                    for (int i = 0; i < lInd.Count; i++)
                    {
                        for (int j = 0; j < arrYMin.Length; j++)
                        {
                            matrYU[i, j] = matrY[lInd[i], j];
                        }
                    }
                    int        N;
                    int[]      arrF;
                    double[]   arrP;
                    double[][] matrL;
                    Quality.Clust(matrYU, matrLL, arrYMin, arrYMax,
                                  out matrL, out arrF, out arrP, out N);
                    int      iMin = idf.arrYMinNum[0], iMax = idf.arrYMaxNum[0];
                    int      jMin = idf.arrYMinNum[1], jMax = idf.arrYMaxNum[1];
                    double[] arrLX = (double[])matrLL[0].Clone(), arrLY = (double[])matrLL[1].Clone();
                    double[,] matrZ = new double[arrLX.Length, arrLY.Length];
                    int[,] matrC    = new int[arrLX.Length, arrLY.Length];
                    for (int i = 0; i < arrLX.Length; i++)
                    {
                        for (int j = 0; j < arrLY.Length; j++)
                        {
                            matrZ[i, j] = arrP[i * arrLY.Length + j];
                            if (i >= iMin && i <= iMax && j >= jMin && j <= jMax)
                            {
                                matrC[i, j] = Color.Red.ToArgb();
                            }
                            else
                            {
                                matrC[i, j] = Color.LemonChiffon.ToArgb();
                            }
                        }
                    }
                    H2DForm hf = new H2DForm(arrLX, arrLY, matrZ, matrC, 1);
                    hf.InitializeGraphics();
                    hf.Show();
                }
                if (matrLL.Length == 3)
                {
                    List <int> lInd = new List <int>();
                    for (int i = 0; i < matrX.GetLength(0); i++)
                    {
                        int j;
                        for (j = 0; j < arrUMin.Length; j++)
                        {
                            if (matrX[i, j] < arrUMin[j] ||
                                matrX[i, j] > arrUMax[j])
                            {
                                break;
                            }
                        }
                        if (j == arrUMin.Length)
                        {
                            lInd.Add(i);
                        }
                    }
                    double[,] matrYU = new double[lInd.Count, arrYMin.Length];
                    for (int i = 0; i < lInd.Count; i++)
                    {
                        for (int j = 0; j < arrYMin.Length; j++)
                        {
                            matrYU[i, j] = matrY[lInd[i], j];
                        }
                    }
                    int        N;
                    int[]      arrF;
                    double[]   arrP;
                    double[][] matrL;
                    Quality.Clust(matrYU, matrLL, arrYMin, arrYMax,
                                  out matrL, out arrF, out arrP, out N);
                    int      iMin = idf.arrYMinNum[0], iMax = idf.arrYMaxNum[0];
                    int      jMin = idf.arrYMinNum[1], jMax = idf.arrYMaxNum[1];
                    int      kMin = idf.arrYMinNum[2], kMax = idf.arrYMaxNum[2];
                    double[] arrLX = (double[])matrLL[0].Clone(), arrLY = (double[])matrLL[1].Clone(),
                    arrLZ            = (double[])matrLL[2].Clone();
                    double[,] matrXY = new double[arrLX.Length, arrLY.Length],
                    matrXZ           = new double[arrLX.Length, arrLZ.Length],
                    matrYZ           = new double[arrLY.Length, arrLZ.Length];
                    bool[,] matrTXY  = new bool[arrLX.Length, arrLY.Length],
                    matrTXZ          = new bool[arrLX.Length, arrLZ.Length],
                    matrTYZ          = new bool[arrLY.Length, arrLZ.Length];
                    for (int i = 0; i < arrLX.Length; i++)
                    {
                        for (int j = 0; j < arrLY.Length; j++)
                        {
                            for (int k = 0; k < arrLZ.Length; k++)
                            {
                                matrXY[i, j] += arrP[i * arrLY.Length * arrLZ.Length + j * arrLZ.Length + k];
                            }
                            if (i >= iMin && i <= iMax && j >= jMin && j <= jMax)
                            {
                                matrTXY[i, j] = true;
                            }
                            else
                            {
                                matrTXY[i, j] = false;
                            }
                        }
                    }
                    for (int i = 0; i < arrLX.Length; i++)
                    {
                        for (int k = 0; k < arrLZ.Length; k++)
                        {
                            for (int j = 0; j < arrLY.Length; j++)
                            {
                                matrXZ[i, k] += arrP[i * arrLY.Length * arrLZ.Length + j * arrLZ.Length + k];
                            }
                            if (i >= iMin && i <= iMax && k >= kMin && k <= kMax)
                            {
                                matrTXZ[i, k] = true;
                            }
                            else
                            {
                                matrTXZ[i, k] = false;
                            }
                        }
                    }
                    for (int j = 0; j < arrLY.Length; j++)
                    {
                        for (int k = 0; k < arrLZ.Length; k++)
                        {
                            for (int i = 0; i < arrLX.Length; i++)
                            {
                                matrYZ[j, k] += arrP[i * arrLY.Length * arrLZ.Length + j * arrLZ.Length + k];
                            }
                            if (j >= jMin && j <= jMax && k >= kMin && k <= kMax)
                            {
                                matrTYZ[j, k] = true;
                            }
                            else
                            {
                                matrTYZ[j, k] = false;
                            }
                        }
                    }
                    H3DForm hf = new H3DForm(arrLX, arrLY, arrLZ, matrXY, matrXZ, matrYZ, matrTXY, matrTXZ, matrTYZ, 1);
                    hf.InitializeGraphics();
                    hf.Show();
                }
            }
            catch
            {
                MessageBox.Show("Ошибка построения гистограммы");
            }
        }