• 大小: 177KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: C#
  • 标签: C#  SPC  

资源简介

In this article we can see in detail about how to create a simple SPC (Statistical Process Control) Cp,CPk Chart. I have been working on several automation projects. Nowadays automobile industry is interested in automated measuring machines to ensure quality and to compete in the global industry. The main part of any automation software is to get the accurate result with Quality check, for this purpose we use the SPC (Statistical Process Control) to find the quality result.

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//Author  : Syed Shanu
//Date    : 2015-02-09
//Description : SPC CPCPk CHART
namespace ShanuSPCCpCPK_Demo
{
    public partial class Form1 : Form
    {
        #region Local Vairables
        DataTable dt = new DataTable();
        private static readonly Random random = new Random();
        Double gridMinvalue = 1.2;
        Double gridMaxvalue = 2.4;
        int totalColumntoDisplay = 20;
        Double USLs = 2.27;
        Double LSLs = 1.26;
        Double CpkPpkAcceptanceValue = 1.33;

        #endregion

        #region Form Load
        public Form1()
        {
            InitializeComponent();
        }
        
      
        private void Form1_Load(object sender EventArgs e)
        {
            loadGridColums();
            loadgrid();
            USLs = Convert.ToDouble(txtusl.Text);
            LSLs = Convert.ToDouble(txtLSL.Text);
            CpkPpkAcceptanceValue = Convert.ToDouble(txtData.Text);
            shanuCPCPKChart.ChartWaterMarkText = txtWaterMark.Text.Trim();
            shanuCPCPKChart.USL = USLs;
            shanuCPCPKChart.LSL = LSLs;
            shanuCPCPKChart.CpkPpKAcceptanceValue = CpkPpkAcceptanceValue;
            shanuCPCPKChart.Bindgrid(dt);   
        }
        #endregion

        #region Methods
        //Create Datatable  Colums.
        public void loadGridColums()
        {
            dt.Columns.Add(“No“);
            for (int jval = 1; jval <= totalColumntoDisplay; jval++)
            {
                dt.Columns.Add(jval.ToString());
            }
          
        }


        private static double RandomNumberBetween(double minValue double maxValue)
        {
            var next = random.NextDouble();

            return Math.Round(minValue + (next * (maxValue - minValue)) 3);
        }
        public void loadgrid()
        {
            dt.Clear();
            dt.Rows.Clear();
            for (int i = 1; i <= 5; i++)
            {
                DataRow row = dt.NewRow();
                row[“NO“] = i.ToString();
                for (int jval = 1; jval <= totalColumntoDisplay; jval++)
                {
                    row[jval.ToString()] = RandomNumberBetween(gridMinvalue gridMaxvalue);
                }
                
                dt.Rows.Add(row);
            }
            dataGridView1.AutoResizeColumns();
            dataGridView1.DataSource = dt;
            // dataGridView1.DataBindings();
            dataGridView1.AutoResizeColumns();
        }
        #endregion


        #region Events
        private void button1_Click(object sender EventArgs e)
        {
            gridMinvalue = 2.7;
            gridMaxvalue = 8.4;
            loadgrid();
            USLs = Convert.ToDouble(txtusl.Text);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       20480  2015-03-24 11:36  ShanuSPCCpCPK_Demo\bin\Debug\ShanuCPCPKChart.dll
     文件       34304  2015-03-24 11:36  ShanuSPCCpCPK_Demo\bin\Debug\ShanuCPCPKChart.pdb
     文件       47616  2015-03-24 11:48  ShanuSPCCpCPK_Demo\bin\Debug\ShanuSPCCpCPK_Demo.exe
     文件       30208  2015-03-24 11:48  ShanuSPCCpCPK_Demo\bin\Debug\ShanuSPCCpCPK_Demo.pdb
     文件       11600  2015-03-24 11:49  ShanuSPCCpCPK_Demo\bin\Debug\ShanuSPCCpCPK_Demo.vshost.exe
     文件         490  2010-03-17 22:39  ShanuSPCCpCPK_Demo\bin\Debug\ShanuSPCCpCPK_Demo.vshost.exe.manifest
     文件       49755  2015-02-09 15:47  ShanuSPCCpCPK_Demo\bin\Debug\ShanuSpcSavedImage.jpeg
     文件        4682  2015-03-24 11:50  ShanuSPCCpCPK_Demo\Form1.cs
     文件       13745  2015-03-24 11:42  ShanuSPCCpCPK_Demo\Form1.Designer.cs
     文件       30646  2015-03-24 11:42  ShanuSPCCpCPK_Demo\Form1.resx
     文件       10465  2015-03-24 11:37  ShanuSPCCpCPK_Demo\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6683  2015-03-24 11:48  ShanuSPCCpCPK_Demo\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件        1356  2015-03-24 11:49  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.csproj.FileListAbsolute.txt
     文件         975  2015-03-24 11:43  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.csproj.GenerateResource.Cache
     文件       13661  2015-03-24 11:40  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.csprojResolveAssemblyReference.cache
     文件       47616  2015-03-24 11:48  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.exe
     文件       16858  2015-03-24 11:43  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.Form1.resources
     文件       30208  2015-03-24 11:48  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.pdb
     文件         180  2015-03-24 11:40  ShanuSPCCpCPK_Demo\obj\x86\Debug\ShanuSPCCpCPK_Demo.Properties.Resources.resources
     目录           0  2015-02-09 11:43  ShanuSPCCpCPK_Demo\obj\x86\Debug\TempPE\
     文件         522  2015-02-09 11:43  ShanuSPCCpCPK_Demo\Program.cs
     文件        1541  2015-02-09 11:43  ShanuSPCCpCPK_Demo\Properties\AssemblyInfo.cs
     文件        3139  2015-02-09 11:43  ShanuSPCCpCPK_Demo\Properties\Resources.Designer.cs
     文件        5612  2015-02-09 11:43  ShanuSPCCpCPK_Demo\Properties\Resources.resx
     文件        1105  2015-02-09 11:43  ShanuSPCCpCPK_Demo\Properties\Settings.Designer.cs
     文件         249  2015-02-09 11:43  ShanuSPCCpCPK_Demo\Properties\Settings.settings
     文件       15086  2015-02-09 11:44  ShanuSPCCpCPK_Demo\Shanu.ico
     文件        4009  2015-02-09 11:47  ShanuSPCCpCPK_Demo\ShanuSPCCpCPK_Demo.csproj
     文件         896  2015-02-09 11:43  ShanuSPCCpCPK_Demo.sln
     文件       22528  2015-03-24 11:58  ShanuSPCCpCPK_Demo.suo

评论

共有 条评论