T O P I C R E V I E W |
toddpie42 |
Posted - 30 Oct 2015 : 16:54:20 When using calculated control limits in a SPCBatchVariableControlChart, every works properly. As soon as I add SpecLimts with script below, the tool tips for all points include the bogus error message "Primary Chart: violation 1 of 1 greater than 3 sigma = 0.00" but the color of the dot does not change.
.PrimaryChart.AddSpecLimit(SPCChartObjects.SPC_LOWER_SPEC_LIMIT, lsl.Value, "LSL", New ChartAttribute(Color.DarkRed, 3.0))
Complete code to show order of events. (I have a chkBox on the form that allows the user to decide if they want USL/LSL included on the chart) I_MR_ChartSimple1.InitSPCBatchVariableControlChart(SPCControlChartData.INDIVIDUAL_RANGE_CHART, 1, QualityData1.ap_PrdCap_Results_Data.Rows.Count)
' Turn off display of table items I_MR_ChartSimple1.EnableCategoryValues = False I_MR_ChartSimple1.EnableCalculatedValues = False I_MR_ChartSimple1.EnableTotalSamplesValues = False I_MR_ChartSimple1.EnableNotes = False I_MR_ChartSimple1.EnableProcessCapabilityValues = False
I_MR_ChartSimple1.ChartData.ResetSPCChartData()
'Setup Default Fonts SPCChartObjects.AxisTitleFont = New Font("Segoe UI", 8, FontStyle.Bold) SPCChartObjects.AxisLabelFont = New Font("Segoe UI", 8, FontStyle.Regular) SPCChartObjects.ControlLimitLabelFont = New Font("Segoe UI", 8, FontStyle.Regular) I_MR_ChartSimple1.PrimaryChart.FrequencyHistogramChart.XAxisLab.TextFont = New Font("Segoe UI", 6, FontStyle.Regular) I_MR_ChartSimple1.SecondaryChart.FrequencyHistogramChart.XAxisLab.TextFont = New Font("Segoe UI", 6, FontStyle.Regular)
'Tooltip information I_MR_ChartSimple1.PrimaryChart.Datatooltip.EnableNotesString = True I_MR_ChartSimple1.AutoLogAlarmsAsNotes = True
'Line and Marker Styles I_MR_ChartSimple1.PrimaryChart.ProcessVariableData.LineMarkerPlot.SymbolAttributes.SymbolSize = 5 I_MR_ChartSimple1.SecondaryChart.ProcessVariableData.LineMarkerPlot.SymbolAttributes.SymbolSize = 5
'Title missing?? TODO: Move up the chart for now I_MR_ChartSimple1.GraphTopTableOffset = 0.05
If QualityData1.ap_PrdCap_Results_Data.Rows.Count = 0 Then Exit Sub End If
'Grab the last row and pull out control and spec limits Dim lastRow As QualityData.ap_PrdCap_Results_DataRow lastRow = CType(QualityData1.ap_PrdCap_Results_Data.Rows.Item(QualityData1.ap_PrdCap_Results_Data.Rows.Count - 1), QualityData.ap_PrdCap_Results_DataRow)
'Get all the limits Dim lcl, ucl, lsl, usl, target As Nullable(Of Double)
If Not lastRow.IsLCLNull Then lcl = CDbl(lastRow.LCL) If Not lastRow.IsUCLNull Then ucl = CDbl(lastRow.UCL) If Not lastRow.IsLSLNull Then lsl = CDbl(lastRow.LSL) If Not lastRow.IsUSLNull Then usl = CDbl(lastRow.USL) If Not lastRow.IsTargetNull And IsNumeric(lastRow.Target) Then target = CDbl(lastRow.Target)
lblLSL.Text = "LSL: " + lsl.Value.ToString("G5") lblTarget.Text = "Target: " + target.Value.ToString("G5") lblUSL.Text = "USL: " + usl.Value.ToString("G5") lblSamples.Text = "Samples: " + QualityData1.ap_PrdCap_Results_Data.Rows.Count.ToString If ucl.HasValue Then lblUCL.Text = "UCL from Prod Spec: " + ucl.Value.ToString("G5") Else lblUCL.Text = "UCL from Prod Spec: null" End If If lcl.HasValue Then lblLCL.Text = "LCL from Prod Spec: " + lcl.Value.ToString("G5") Else lblLCL.Text = "LCL from Prod Spec: null" End If
'Alarms (Order of all setups are important. Add alarms before control limits and specs for example) I_MR_ChartSimple1.ChartAlarmEmphasisMode = SPCChartBase.ALARM_HIGHLIGHT_SYMBOL
I_MR_ChartSimple1.PrimaryChart.EnableDefaultLimits(False, True) I_MR_ChartSimple1.SecondaryChart.EnableDefaultLimits(False, True) I_MR_ChartSimple1.PrimaryChart.AddControlRule(1, 1, 1, -3, False) '1 Point beyond 3 sigmas +/- (out of 3 sigma control) I_MR_ChartSimple1.PrimaryChart.AddControlRule(2, 1, 1, 3, False) '1 Point beyond 3 sigmas +/- (out of 3 sigma control) I_MR_ChartSimple1.PrimaryChart.AddControlRule(1, 2, 3, -2, False) '2 Points out of 3 beyond 2 sigma +/- I_MR_ChartSimple1.PrimaryChart.AddControlRule(2, 2, 3, 2, False) '2 Points out of 3 beyond 2 sigma +/- I_MR_ChartSimple1.PrimaryChart.AddControlRule(1, 7, 7, 0, False) '7 points in a row above center I_MR_ChartSimple1.PrimaryChart.AddControlRule(2, 7, 7, 0, False) '7 points in a row below center I_MR_ChartSimple1.PrimaryChart.AddControlRule(7, 7, 7, 0, False) '7 points in a row trending up or down I_MR_ChartSimple1.ChartData.AlarmStateEventEnable = True
'Alway set the spec limits so Cpk calcuation works. I_MR_ChartSimple1.ChartData.ProcessCapabilityLSLValue = lsl.Value I_MR_ChartSimple1.ChartData.ProcessCapabilityUSLValue = usl.Value
If chkShowSpecLimits.Checked Then I_MR_ChartSimple1.PrimaryChart.AddSpecLimit(SPCChartObjects.SPC_LOWER_SPEC_LIMIT, lsl.Value, "LSL", New ChartAttribute(Color.DarkRed, 3.0)) I_MR_ChartSimple1.PrimaryChart.AddSpecLimit(SPCChartObjects.SPC_UPPER_SPEC_LIMIT, usl.Value, "USL", New ChartAttribute(Color.DarkRed, 3.0)) 'No way to remove them that I can find. 'I_MR_ChartSimple1.PrimaryChart.FrequencyHistogramChart.AddFrequencyHistogramControlLine(lcl, New ChartAttribute(Color.DarkRed, 2)) 'I_MR_ChartSimple1.PrimaryChart.FrequencyHistogramChart.AddFrequencyHistogramControlLine(ucl, New ChartAttribute(Color.DarkRed, 2)) End If
'Calculate capability values I_MR_ChartSimple1.ChartData.AddProcessCapabilityValue(SPCProcessCapabilityRecord.SPC_CPK_CALC) I_MR_ChartSimple1.ChartData.AddProcessCapabilityValue(SPCProcessCapabilityRecord.SPC_PPK_CALC)
If cboControlLimitType.Text = "From Spec" Then If Not lcl.HasValue Or Not lcl.HasValue Then MsgBox("ERROR: Can not show limits. No control limits were specified in the Product Spec", MsgBoxStyle.Critical) cboControlLimitType.Text = "Calculated" Else I_MR_ChartSimple1.PrimaryChart.GetControlLimitData(SPCChartObjects.SPC_LOWER_CONTROL_LIMIT).LimitValue = lcl.Value I_MR_ChartSimple1.PrimaryChart.GetControlLimitData(SPCChartObjects.SPC_UPPER_CONTROL_LIMIT).LimitValue = ucl.Value I_MR_ChartSimple1.PrimaryChart.GetControlLimitData(SPCChartObjects.SPC_CONTROL_TARGET).LimitValue = target.Value I_MR_ChartSimple1.ChartData.UpdateControlLimitsUsingMeanAndSigma(SPCChartObjects.PRIMARY_CHART, target.Value, (ucl.Value - lcl.Value) / 6) End If End If
'Add the data for each sample Dim batchCounter As Integer = 0 For Each row As QualityData.ap_PrdCap_Results_DataRow In QualityData1.ap_PrdCap_Results_Data.Rows batchCounter += 1 Dim timestamp As New ChartCalendar(row.Create_Datetime)
'Write the value/timestamp Dim values As New DoubleArray values.Add(row.Test_Result) I_MR_ChartSimple1.ChartData.AddNewSampleRecord(batchCounter, timestamp, values)
'Add Notes for the tooltip I_MR_ChartSimple1.ChartData.AppendNotesString(vbNewLine + "Date:" + timestamp.ToString("MM/dd/yy HH:mm:ss"), False) If Not row.IsLoad_IdNull Then I_MR_ChartSimple1.ChartData.AppendNotesString(vbNewLine + "Load ID:" + row.Load_Id, True) If Not row.IsRun_NbrNull Then I_MR_ChartSimple1.ChartData.AppendNotesString(vbNewLine + "Run:" + row.Run_Nbr, True) If Not row.IsBatch_NbrNull Then I_MR_ChartSimple1.ChartData.AppendNotesString(" Batch:" + row.Batch_Nbr + vbNewLine, True) If Not row.IsUnit_NbrNull Then I_MR_ChartSimple1.ChartData.AppendNotesString(" Unit:" + row.Unit_Nbr, True) If Not row.IsSampleLocNull Then I_MR_ChartSimple1.ChartData.AppendNotesString(vbNewLine + "Sample Loc:" + row.SampleLoc, True) If Not row.IsCommentNull Then I_MR_ChartSimple1.ChartData.AppendNotesString(vbNewLine + "Comments:" + row.Comment, True) Next
' Calculate the SPC control limits. The secondary chart If cboControlLimitType.Text = "Calculated" Then I_MR_ChartSimple1.AutoCalculatePrimaryControlLimits() End If I_MR_ChartSimple1.AutoCalculateSecondaryControlLimits()
'After calculations, get data to display on main form lblMean.Text = "Mean: " + I_MR_ChartSimple1.ChartData.GetCalculatedValueRecord(0).GetCalculatedValueStatistic(SPCCalculatedValueRecord.SPC_MEAN_CALC).ToString("G5") lblStdDev.Text = "StdDev: " + I_MR_ChartSimple1.ChartData.GetCalculatedValueRecord(0).GetCalculatedValueStatistic(SPCCalculatedValueRecord.SPC_STD_DEVIATION_CALC).ToString("G5")
For i As Integer = 0 To I_MR_ChartSimple1.ChartData.NumProcessCapabilityValues - 1 If I_MR_ChartSimple1.ChartData.GetProcessCapabilityRecord(i).CalculationType = SPCProcessCapabilityRecord.SPC_CPK_CALC Then lblCpk.Text = "Cpk: " + I_MR_ChartSimple1.ChartData.GetProcessCapabilityRecord(i).CurrentValue.ToString("G5") ElseIf I_MR_ChartSimple1.ChartData.GetProcessCapabilityRecord(i).CalculationType = SPCProcessCapabilityRecord.SPC_PPK_CALC Then lblPpk.Text = "Ppk: " + I_MR_ChartSimple1.ChartData.GetProcessCapabilityRecord(i).CurrentValue.ToString("G5") End If Next
' Scale the y-axis of the X-Bar chart to display all data and control limits I_MR_ChartSimple1.AutoScalePrimaryChartYRange() ' Scale the y-axis of the Range chart to display all data and control limits I_MR_ChartSimple1.AutoScaleSecondaryChartYRange() ' Rebuild the chart using the current data and settings I_MR_ChartSimple1.RebuildChartUsingCurrentData()
|
3 L A T E S T R E P L I E S (Newest First) |
quinncurtis |
Posted - 11 Nov 2015 : 18:22:47 We were able to reproduce the problem. The central issue is that you turned on the real-time alarm log (AutoLogAlarmsAsNotes = True) before you had any actual control limits. When you entered the sample interval data, before any control limits were set, it generated alarms (because the sample interval data was being compared to control limits of 0.0) which ended up being logged to the sample interval notes. In most cases we detect this and discard the alarms before they get logged. But when you added spec limits, it interfered with that.
So two solutions are
1. Set the AutoLogAlarmsAsNotes = True flag only after you enter all training data (i.e. data entered before alarm limits are set). Once you calculate the control limits using AutoCalculateControlLimits, all new sample interval data will be check for alarms and logged.
2. OR, you can make sure that the software knows you are in a Training Mode when you initially add the sample interval data, before the control limits are set.
Me.ChartData.TrainingMode = True
Then, when you have set the control limits (using AutoCalculateControlLimits in this case), set it false. Subsequent sample interval updates will then log alarms as expected.
Me.ChartData.TrainingMode = False
|
toddpie42 |
Posted - 02 Nov 2015 : 09:52:09 The values are exactly as expected in the debugger, besides the alarm in the tooltip is the "1 of 1 beyond 3 sigma is exceeded" (nothing about the spec) and it shows the sigma value of 0.00. The code below is the heart of the problem. The first time it runs chkShowSpecLimits.Checked is false, and everything works fine. The next time chkShowSpecLimits.Checked is true, the only extra code that get's executed is the two calls to AddSpecLimit. I know the values are correct because call to set ProcessCapabilityLSLValue is always executed (because I always want Cpk even if the spec lines are not shown) and the displayed Cpk values are the same in each case. Also if I provide the UCL and LCL, everything works fine, but if I allow the chart to calculate those values-- I get the error when the spec limits are shown.
I_MR_ChartSimple1.PrimaryChart.EnableDefaultLimits(False, True) I_MR_ChartSimple1.SecondaryChart.EnableDefaultLimits(False, True) I_MR_ChartSimple1.PrimaryChart.AddControlRule(1, 1, 1, -3, False) '1 Point beyond 3 sigmas +/- (out of 3 sigma control) I_MR_ChartSimple1.PrimaryChart.AddControlRule(2, 1, 1, 3, False) '1 Point beyond 3 sigmas +/- (out of 3 sigma control)
....
'Alway set the spec limits so Cpk calcuation works. I_MR_ChartSimple1.ChartData.ProcessCapabilityLSLValue = lsl.Value I_MR_ChartSimple1.ChartData.ProcessCapabilityUSLValue = usl.Value
If chkShowSpecLimits.Checked Then I_MR_ChartSimple1.PrimaryChart.AddSpecLimit(SPCChartObjects.SPC_LOWER_SPEC_LIMIT, lsl.Value, "LSL", New ChartAttribute(Color.DarkRed, 3.0)) I_MR_ChartSimple1.PrimaryChart.AddSpecLimit(SPCChartObjects.SPC_UPPER_SPEC_LIMIT, usl.Value, "USL", New ChartAttribute(Color.DarkRed, 3.0)) End If |
quinncurtis |
Posted - 30 Oct 2015 : 18:31:44 We cannot reproduce the problem based on what you have described. It may very well depend on exactly what values are being used. The first thing that comes to mind is that you are passing in values of 0.0 for the High and Low Spec limits. That would cause every sample interval to generate a alarm on the spec limit. So look at the exact values you are passing in using the debugger. If you can't solve the problem then create the simplest possible program which reproduces the problem and then send us the complete project as a zip file (support@quinn-curtis.com). |
|
|