 MES 3.0

# Control Limits

Statistical tables have been developed for various types of distributions that quantify the area under the curve for a given number of standard deviations from the mean. These can be used as probability tables to calculate the odds that a given value (measurement) is part of the same group of data used to construct the histogram.

## Watch the Video

The prominent statistician Walter Shewhart found that control limits placed at three standard deviations from the mean in either direction provided an economical trade off between the risk of reacting to a false signal and the risk of not reacting to a true signal, regardless of the shape of the underlying process distribution.

## What Are Control Limits

Control limits , also known as natural process limits, are horizontal lines drawn on a statistical process control chart, usually at a distance of ±3 standard deviations of the plotted statistic from the statistic's mean. They should not be confused with tolerance limits or specifications, which are completely independent of the distribution of the plotted sample statistic. Control limits describe what a process is capable of producing (sometimes referred to as the 'voice of the process'), while tolerances and specifications describe how the product should perform to meet the customer's expectations

Control limits are Upper Control Limit (UCL) and Lower Control Limit (LCL) values that are calculated from the data that is gathered from a process. They are shown as horizontal lines on the control charts and reflect the past performance of that process. They can be either calculated or entered manually, or through scripting, to act as specification limits. Specification limits are requirements made by the company, not a reflection of the process itself. For the p and u Charts, the control limits can vary for each sample depending on the number of items inspected for each sample.

## Calculating Control Limits

At the start of an SPC implementation all efforts must be aimed at controlling the variation of the dispersion (via a range or sigma control chart). When the dispersion of the process is out of control, the average of the process is likely also out of control. This is because there is a relation between the variation in the dispersion and the variation of the average as shown in this equation: Problems on the dispersion chart should be addressed first. When control limits on the average chart are calculated in the standard way (three sigma from the average), out-of-control variables on the dispersion chart will also lead to out-of-control factors on the average chart. These out-of-control factors on the average chart are not an indication of changes in the process average, however, but are a logical result of changes in the dispersion. When operators without adequate knowledge of SPC see out-of-control variables on both average and dispersion charts they will likely start working on the problem on the average chart because such problems are easier to address – just adjust the process.

The way to avoid this issue is to begin charting without putting the limits of the average chart at three sigma. There are three options:

1. Do not use control limits for the average – only show the target. This is sometimes called a run chart.
2. Fix the limits at a level which will rarely lead to out-of-control variables.
3. When the process average is unstable use modified control limits to minimize the actions, but make sure that process averages that are abnormal are signaled.

When the C p value is high enough, the third method is preferred because the limits are still calculated based on the process variation. This method still gives an early warning when a disturbance of the process average will lead to defective products.

## Control limit Types

There are different control limit types for each type of control chart. For example, the XBar control limit type only supports XBar UCLXBar LCL and XBar Other control limits, and cannot be calculated or shown for any other control chart besides the XBar Control Chart.

## Default Control Limits

The control limits are defined by the enterprise and can be added, edited or deleted on the Enterprise page in the designer under the Quality tab.

When a new Enterprise Production Item is added, the following control limits are added:

KindDescriptionLSLTargetUSLLCLUCL
Chart
CpProcess Capability. A simple and straightforward indicator of process capability*** Process Capability
HistogramHistograms  are used to show distribution of variables

** Histogram
IndividualIndividual Control Charts for time series tracking of a process

** Individual
MRMoving Range used to indicate process variation by calculating the ranges of two or more consecutive samples

** Individual and Range
MedianMedian is the middle point when data points are arranged from high to low

** Median and Range
PpProcess Performance. A simple and straightforward indicator of process performance*** Process Performance
RangeXBar Range used to indicate process variation by calculating the ranges of two or more samples that have multiple measurements

** XBar and R
StdDevStandard Deviation

** XBar and S
XBarXbar represents the sample mean of a number of repeated observations*
*** XBar and S
cCount type data, Total number of non-conformities (defects) per unit or total number of events occurring in a given unit of time

** C-Chart | Vision
u Count type data. Total number of non-conformities (defects) per item or group of items

** U-Chart | Vision
npNon Performing. Number of nonconforming units in a sample

** NP-Chart | Vision
p Proportion Non Performing. proportion of nonconforming units in a sample

** P-Chart | Vision

## Adding and Editing Control Limits

The SPC module provides incredible flexibility in how control limits are applied to sample data. The SPC module provides pre-defined standard control limits, created in Python so that users can view and modify them as required.

Users can also create custom control limits.  Control limits are available in the MES Equipment Manager at the Enterprise level of the Production Model.

To add a new control limit, in the MES Equipment Manager, click on Control Limits on the Enterprise level of the Production Model and click New ( ). A window will appear with several fields to be completed, including the name and kind of the control limit, as well as the scripting necessary to use the control limit.

To edit an existing control limit, click on Control Limits on the Enterprise level of the Production Model and click Edit ( ) next to the control limit to modify. Click Save when done making edits.   ## Deleting a Control Limit

To delete a control limit, right-click on the control limit select Delete from the menu.  A window will appear confirming that you permanently want to delete the control limit.  ### Control Limit Properties

Property

Description

#### Name

This is the required unique name of the control limit as it will appear in selection lists and control charts. It is better to keep this short in length so that it will fit better on the control charts.

#### Kind

Each type of control chart has control limit kinds that it works with. If a control limit will be used with an Individual control chart, then either the Individual LCL (Lower Control Limit), Individual UCL (Upper Control Limit) must be used.

Note

Each control limit kind has Other as an option. This kind is there for legacy support and has deprecated. Do not use this kind.

#### Calculation Script

The SPC module uses python scripts to calculate control limits. This allows the user to override the default calculation of a control limit or add new control limits that are not provided by default. Additionally, they can be removed, cleaning up selection lists of control limits that may never be used. When a user or script function is used to initiate a control limit to be calculated, the script in the associated control limit is executed.

An event object is passed into the script that contains the information and data used to calculate the new control limit value. See  Control Limit Event  object for more information.

#### Group

A group name can optionally be added to each control limit. control limits that share the same group name will then have their value set automatically when any control limit in that group is set.

Example: An np Chart and a p Chart both show UCL spec limits. The  np UCL and the p UCL control limits have the same Group name - PRODUCT_UCL_GRP. When a change is made to the UCL limit on the np chart, the UCL value for the p UCL will also be changed.

This section refers to how to create control limits to be used to monitor sample values. Actual control limit values can be set through the control charts by right clicking on the LCL and UCL or through scripting. Refer to the knowledge base article on Setting Up Control Limits by Product Code for more info.  ## Importing and Exporting Control Limits

### Export

To export control limit entries, right-click anywhere on the table containing control limit entries and select the Export menu item. A dialog box will appear to allow selection of an existing file or the entry of a name for the new file to save the control limits to. If a file extension is not entered, then the default .csv will be used. The first line of the file must contain at least the property names separated by commas. If additional names exist, they will be ignored. The property names can be in any order.

Name,Kind,CL Color,Script,Group
"Box and Whisker LCL","44","java.awt.Color[r=255,g=200,b=0]","",""
"Box and Whisker UCL","43","java.awt.Color[r=255,g=200,b=0]","",""
"Cp LSL","38","java.awt.Color[r=255,g=200,b=0]","",""
"Cp Target","39","java.awt.Color[r=255,g=200,b=0]","",""
"Cp USL","37","java.awt.Color[r=255,g=200,b=0]","",""
"CpPp LSL","47","java.awt.Color[r=255,g=200,b=0]","",""
"CpPp Target","48","java.awt.Color[r=255,g=200,b=0]","",""
"CpPp USL","46","java.awt.Color[r=255,g=200,b=0]","",""
"Histogram LCL","29","java.awt.Color[r=255,g=200,b=0]","",""
"Histogram UCL","28","java.awt.Color[r=255,g=200,b=0]","",""
"Individual LCL","11","java.awt.Color[r=255,g=200,b=0]","#Individual LCL Calculation\n#Get the SPC data that the Individual LCL will be calculated for\nds = event.getData()\n\n#Get the columnn index within the SPC data\nxBarColNdx = ds.getColumnIndex(\"XBar\")\nmrColNdx = ds.getColumnIndex(\"MR\")\n\n#Initialize XBar and moving range sums that are need to calculate average Xbar and moving range.\nxBarSum = 0.0\nmrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\tmrVal = ds.getValueAt(row, mrColNdx)\n\tif mrVal <> None:\n\t\tmrSum = mrSum + mrVal\n\n#Calculate the average XBar and moving range\nxDBar = xBarSum / ds.rowCount\t\t\nmrBar = mrSum / (ds.rowCount - 1)\n\t\n#Calculate the Individual LCL\nlcl = xDBar - 2.66 * mrBar\n\n#Return the new Individual LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Individual UCL","10","java.awt.Color[r=255,g=200,b=0]","#Individual UCL Calculation\n#Get the SPC data that the Individual UCL will be calculated for\nds = event.getData()\n\n#Get the columnn index within the SPC data\nxBarColNdx = ds.getColumnIndex(\"XBar\")\nmrColNdx = ds.getColumnIndex(\"MR\")\n\n#Initialize XBar and moving range sums that are need to calculate average Xbar and moving range.\nxBarSum = 0.0\nmrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\tmrVal = ds.getValueAt(row, mrColNdx)\n\tif mrVal <> None:\n\t\tmrSum = mrSum + mrVal\n\n#Calculate the average XBar and moving range\nxDBar = xBarSum / ds.rowCount\t\t\nmrBar = mrSum / (ds.rowCount - 1)\n\t\n#Calculate the Individual UCL\nucl = xDBar + 2.66 * mrBar\n\n#Return the new Individual UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"MR LCL","35","java.awt.Color[r=255,g=200,b=0]","#Moving Range LCL Calculation\n#The LCL for Moving Range is always 0\nlcl = 0.0\n\n#Return the new Moving Range LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"MR UCL","34","java.awt.Color[r=255,g=200,b=0]","#Moving Range UCL Calculation\n#Get the SPC data that the Moving Range UCL will be calculated for\nds = event.getData()\n\n#Get the columnn index within the SPC data\nmrColNdx = ds.getColumnIndex(\"MR\")\n\n#Initialize moving range sums that are need to calculate average moving range.\nmrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\tmrSum = mrSum + ds.getValueAt(row, mrColNdx)\n\n#Calculate the average moving range\nmrBar = mrSum / (ds.rowCount - 1)\n\t\n#Calculate the Moving Range UCL\nucl = 3.267 * mrBar\n\n#Return the new Moving Range UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"Median LCL","14","java.awt.Color[r=255,g=200,b=0]","#XBar LCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#THis is why element 0 and 1 of the array are 0.\na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the Median LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nmedianColNdx = ds.getColumnIndex(\"Median\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nmedianSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tmedianSum = medianSum + ds.getValueAt(row, medianColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\n#Calculate the average xBar and range\t\nmedianBar = medianSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the Median LCL\nlcl = medianBar - a2Value * rBar\n\n#Return the new Median LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Median UCL","13","java.awt.Color[r=255,g=200,b=0]","#XBar UCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#THis is why element 0 and 1 of the array are 0.\na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the Median UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nmedianColNdx = ds.getColumnIndex(\"Median\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nmedianSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tmedianSum = medianSum + ds.getValueAt(row, medianColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\n#Calculate the average xBar and range\t\nmedianBar = medianSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the Median UCL\nlcl = medianBar + a2Value * rBar\n\n#Return the new Median UCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Pp LSL","41","java.awt.Color[r=255,g=200,b=0]","",""
"Pp Target","42","java.awt.Color[r=255,g=200,b=0]","",""
"Pp USL","40","java.awt.Color[r=255,g=200,b=0]","",""
"Range LCL","5","java.awt.Color[r=255,g=200,b=0]","#Range UCL Calculation\n#Define the D3 factors array.\n#The D3 factors correspond to the sample size which starts at 7 for Range LCL.\n#This is why element 0 through 6 of the array are 0.\nd3 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.076, 0.136, 0.184, 0.223, 0.256, 0.283, 0.307, 0.328, 0.347, 0.363, 0.378, 0.391, 0.403, 0.415, 0.425, 0.434, 0.443, 0.451, 0.459]\n\n#Get the SPC data that the Range LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexe within the SPC data\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize range sum that are need to calculate average range.\nrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\tr = ds.getValueAt(row, rangeColNdx)\n\trSum = rSum + r\n\n#Calculate the average range\t\t\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the D3 value\nif sampleSize < len(d3):\n\td3Value = d3[sampleSize]\nelse:\n\td3Value = d3[len(d3) - 1]\n\t\n#Calculate the Range LCL\nlcl = d3Value * rBar\n\n#Return the new Range LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Range UCL","4","java.awt.Color[r=255,g=200,b=0]","#Range UCL Calculation\n#Define the D4 factors array.\n#The D4 factors correspond to the sample size which starts at 2.\n#This is why element 0 and 1 of the array are 0. \nd4 = [0.0, 0.0, 3.267, 2.574, 2.282, 2.114, 2.004, 1.924]\n\n#Get the SPC data that the Range UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexe within the SPC data\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize range sum that are need to calculate average range.\nrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\tr = ds.getValueAt(row, rangeColNdx)\n\trSum = rSum + r\n\n#Calculate the average range\t\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the D3 value\nif sampleSize < len(d4):\n\td4Value = d4[sampleSize]\nelse:\n\td4Value = d4[len(d4) - 1]\n\t\n#Calculate the Range UCL\nucl = d4Value * rBar\n\n#Return the new Range UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"StdDev LCL","8","java.awt.Color[r=255,g=200,b=0]","#Standard Deviation LCL Calculation\n#Define the B3 factors array.\n#The B3 factors correspond to the sample size which starts at 6.\n#This is why element 0 through 5 of the array are 0.\nb3 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.030, 0.118, 0.185, 0.239, 0.284, 0.321, 0.354, 0.382, 0.406, 0.428, 0.448, 0.466, 0.482, 0.497, 0.510, 0.523, 0.534, 0.545, 0.555, 0.565]\n\n#Get the SPC data that the StdDev LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nsBarColNdx = ds.getColumnIndex(\"SBar\")\n\n#Initialize StdDev sum that are need to calculate average StdDev. \nsSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tsSum = sSum + ds.getValueAt(0, sBarColNdx)\n\n#Calculate the average StdDev\t\nsBar = sSum / ds.rowCount\n\t\t\n#Get the sample size.\t\nsampleSize = event.getSampleSize()\n\n#Lookup the B3 value\nif sampleSize < len(b3):\n\tb3Value = b3[sampleSize]\nelse:\n\tb3Value = b3[len(b3) - 1]\n\n#Calculate the StdDev LCL\t\nlcl = sBar * b3Value\n\n#Return the new StdDev LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"StdDev UCL","7","java.awt.Color[r=255,g=200,b=0]","#Standard Deviation UCL Calculation\n#Define the B4 factors array.\n#The B4 factors correspond to the sample size which starts at 6.\n#This is why element 0 through 5 of the array are 0.\nb4 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.970, 1.882, 1.815, 1.761, 1.716, 1.679, 1.646, 1.618, 1.594, 1.572, 1.552, 1.534, 1.518, 1.503, 1.490, 1.477, 1.466, 1.455, 1.445, 1.435]\n\n#Get the SPC data that the StdDev UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nsBarColNdx = ds.getColumnIndex(\"SBar\")\n\n#Initialize StdDev sum that are need to calculate average StdDev. \nsSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tsSum = sSum + ds.getValueAt(0, sBarColNdx)\n\n#Calculate the average StdDev\t\nsBar = sSum / ds.rowCount\n\t\t\n#Get the sample size.\t\nsampleSize = event.getSampleSize()\n\n#Lookup the B4 value\nif sampleSize < len(b4):\n\tb4Value = b4[sampleSize]\nelse:\n\tb4Value = b4[len(b4) - 1]\n\n#Calculate the StdDev UCL\t\nucl = sBar * b4Value\n\n#Return the new StdDev UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"XBar LCL","2","java.awt.Color[r=255,g=200,b=0]","#XBar LCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#This is why element 0 and 1 of the array are 0.\na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the XBar LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nxBarColNdx = ds.getColumnIndex(\"XBar\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nxBarSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\n#Calculate the average xBar and range\t\nxDBar = xBarSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the xBar LCL\nlcl = xDBar - a2Value * rBar\n\n#Return the new xBar LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"XBar LSL","3","java.awt.Color[r=255,g=200,b=0]","",""
"XBar UCL","1","java.awt.Color[r=255,g=200,b=0]","#XBar UCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#This is why element 0 and 1 of the array are 0. \na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the XBar UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nxBarColNdx = ds.getColumnIndex(\"XBar\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nxBarSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\t\n#Calculate the average xBar and range\nxDBar = xBarSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the xBar UCL\nucl = xDBar + a2Value * rBar\n\n#Return the new xBar UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"XBar USL","3","java.awt.Color[r=255,g=200,b=0]","",""
"c LCL","23","java.awt.Color[r=255,g=200,b=0]","#c LCL Calculation\nimport math\n\n#Get the SPC data that the c LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformitiesSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\t\t\n#Calculate the average np\ncBar = nonconformitiesSum / ds.rowCount\n\n#Calculate 3 sigma value\nsigma3 = 3 * math.sqrt(cBar)\n\n#Calculate the c LCL\nlcl = cBar - sigma3\nif lcl < 0:\n\tlcl = 0\n#Return the new c LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"c UCL","22","java.awt.Color[r=255,g=200,b=0]","#c UCL Calculation\nimport math\n\n#Get the SPC data that the c UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformitiesSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\t\t\n#Calculate the average np\ncBar = nonconformitiesSum / ds.rowCount\n\n#Calculate 3 sigma value\nsigma3 = 3 * math.sqrt(cBar)\n\n#Calculate the c UCL\nucl = cBar + sigma3\n#Return the new c UCL back to the SPC module\nevent.setControlLimitValue(ucl)\n",""
"np LCL","20","java.awt.Color[r=255,g=200,b=0]","#np LCL Calculation\nimport system\nimport math\n\n#Get the SPC data that the np LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformingSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\t\t\n#Calculate the average np\nnpBar = nonconformingSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = ds.getValueAt(row, \"InspectedCount\")\n\n#Calculate 3 sigma value\npBar = npBar / sampleSize\nsigma3 = 3 * math.sqrt(npBar * (1 - pBar))\n\n#Calculate the np LCL\nlcl = npBar - sigma3\nif lcl < 0:\n\tlcl = 0\n\t\n#Return the new np LCL back to the SPC module\nevent.setControlLimitValue(lcl)\n",""
"np UCL","19","java.awt.Color[r=255,g=200,b=0]","#np UCL Calculation\nimport math\n\n#Get the SPC data that the np UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformingSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\t\t\n#Calculate the average np\nnpBar = nonconformingSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = ds.getValueAt(row, \"InspectedCount\")\n\n#Calculate 3 sigma value\npBar = npBar / sampleSize\nsigma3 = 3 * math.sqrt(npBar * (1 - pBar))\n\n#Calculate the np UCL\nucl = npBar + sigma3\n#Return the new np UCL back to the SPC module\nevent.setControlLimitValue(ucl)\n",""
"p LCL","17","java.awt.Color[r=255,g=200,b=0]","#p LCL Calculation\nimport system\nimport math\n\n#Get the SPC data that the p LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize inspected and nonconforming sums that are need to calculate p. \ninspectedSum = 0.0\nnonconformingSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average p\npBar = nonconformingSum / inspectedSum\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(pBar * (1 - pBar) / avgSampleSize)\n\t#Calculate the p LCL\n\tlcl = pBar - sigma3\n\t#Return the new p LCL back to the SPC module\n\tevent.setControlLimitValue(lcl)\nelse:\n\t#Calculate Outer LCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(pBar * (1 - pBar) / minSampleSize)\n\touterLCL = pBar - outerSigma3\n\t\n\t#Calculate Inner LCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(pBar * (1 - pBar) / maxSampleSize)\n\tinnerLCL = pBar - innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tpColNdx = ds.getColumnIndex(\"p\")\n\tpLCLColNdx = ds.getColumnIndex(\"p LCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tp = ds.getValueAt(row, pColNdx)\n\t\tif p > innerLCL and p < outerLCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tpLCL = p - 3 * math.sqrt(p * (1 - p) / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, pLCLColNdx, pLCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, pLCLColNdx, outerLCL)\n\t\t\t\t\t\t\n\t#Return the new p LCL back to the SPC module\n\tevent.setControlLimitValue(outerLCL)\t\t\t\n",""
"p UCL","16","java.awt.Color[r=255,g=200,b=0]","#p UCL Calculation\nimport math\n\n#Get the SPC data that the p UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize inspected and nonconforming sums that are need to calculate p. \ninspectedSum = 0.0\nnonconformingSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average p\npBar = nonconformingSum / inspectedSum * 100.0\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(pBar * (100.0 - pBar) / avgSampleSize)\n\t#Calculate the p UCL\n\tucl = pBar + sigma3\n\t#Return the new p UCL back to the SPC module\n\tevent.setControlLimitValue(ucl)\nelse:\n\t#Calculate Outer UCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(pBar * (100.0 - pBar) / minSampleSize)\n\touterUCL = pBar + outerSigma3\n\t\n\t#Calculate Inner UCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(pBar * (100.0 - pBar) / maxSampleSize)\n\tinnerUCL = pBar + innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tpColNdx = ds.getColumnIndex(\"p\")\n\tpUCLColNdx = ds.getColumnIndex(\"p UCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tp = ds.getValueAt(row, pColNdx)\n\t\tif p > innerUCL and p < outerUCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tpUCL = p + 3 * math.sqrt(p * (1 - p) / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, pUCLColNdx, pUCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, pUCLColNdx, outerUCL)\n\t\t\t\n\t#Return the new p LCL back to the SPC module\n\tevent.setControlLimitValue(outerUCL)\n",""
"u LCL","26","java.awt.Color[r=255,g=200,b=0]","#u LCL Calculation\nimport math\n\n#Get the SPC data that the u LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize inspected and nonconforming sums that are need to calculate u. \ninspectedSum = 0.0\nnonconformitiesSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average u\nuBar = nonconformitiesSum / inspectedSum * 100.0\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(uBar / avgSampleSize)\n\t#Calculate the u LCL\n\tlcl = uBar - sigma3\n\t#Return the new u LCL back to the SPC module\n\tevent.setControlLimitValue(lcl)\nelse:\n\t#Calculate Outer LCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(uBar / minSampleSize)\n\touterLCL = uBar - outerSigma3\n\t\n\t#Calculate Inner LCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(uBar / maxSampleSize)\n\tinnerLCL = uBar - innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tuColNdx = ds.getColumnIndex(\"uBar\")\n\tuLCLColNdx = ds.getColumnIndex(\"u LCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tu = ds.getValueAt(row, uColNdx)\n\t\tif u > innerLCL and u < outerLCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tuLCL = u - 3 * math.sqrt(u / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, uLCLColNdx, uLCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, uLCLColNdx, outerLCL)\n\t\t\t\n\t#Return the new u LCL back to the SPC module\n\tevent.setControlLimitValue(outerLCL)\n",""
"u UCL","25","java.awt.Color[r=255,g=200,b=0]","#u UCL Calculation\nimport math\n\n#Get the SPC data that the u UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize inspected and nonconforming sums that are need to calculate u. \ninspectedSum = 0.0\nnonconformitiesSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average u\nuBar = nonconformitiesSum / inspectedSum * 100.0\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(uBar / avgSampleSize)\n\t#Calculate the u UCL\n\tucl = uBar + sigma3\n\t#Return the new u UCL back to the SPC module\n\tevent.setControlLimitValue(ucl)\nelse:\n\t#Calculate Outer UCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(uBar / minSampleSize)\n\touterUCL = uBar + outerSigma3\n\t\n\t#Calculate Inner UCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(uBar / maxSampleSize)\n\tinnerUCL = uBar + innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tuColNdx = ds.getColumnIndex(\"uBar\")\n\tuUCLColNdx = ds.getColumnIndex(\"u UCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tu = ds.getValueAt(row, uColNdx)\n\t\tif u > innerUCL and u < outerUCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tuUCL = u + 3 * math.sqrt(u / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, uUCLColNdx, uUCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, uUCLColNdx, outerUCL)\n\t\t\t\n\t#Return the new u UCL back to the SPC module\n\tevent.setControlLimitValue(outerUCL)\n",""

### Import

To import downtime entries, right-click anywhere on the control limit table and select the Import menu item. A dialog box as shown below will appear to allow selection of a comma separated values (csv) formatted file.

• No labels