Showing posts with label SPC. Show all posts
Showing posts with label SPC. Show all posts

Monday, August 5, 2013

[SPC] SPC Demo

Here is a SPC System Demo Video that is related with the previous article: [SPC] A simple SPC system introduction

Check it out:
http://www.youtube.com/watch?v=XLRKj2mgnEA

[SPC] A simple SPC system introduction

SPC System
Introduction
  • Statistic Process Control (SPC) has adopted and widely used in many industries, such as, IC foundry, automobile, and so on. It provides the function to monitor the process(manufacturing) capacity and check if the monitor data violates SPC Rules. The following content explains how we build up the system architecture and what the basic items are inside this system.
SPC Chart Setting
  • Table: t1twsql1.mistw.dbo.SPC_CHART_SETTING
  • This table contains all the SPC Chart Setting Data and is critical for message sending and receiving.
  • Column definition:
    • 5 categories(Category1, Category2, Category3, Category4, Category5) are combined with comma, for instance, "T3,37XX,LINEA,N/A,N/A".
    • u_spec_limit: Upper SPEC Limit
    • l_spec_limit: Lower SPEC Limit
    • spc_rules: How many SPC Rules are adopted? For example => 20 + 21 + 2 2 + 23 = 1 + 2 + 4 + 8 = 15 = Rule1 + Rule2 + Rule3 + Rule4
    • sampling_rule: Only support SamplingRuleAvg?
    • sample_number: How many data will become a point value
    • data_type: Double or String
    • is_enabled: Y/N
    • need_to_reset: Y/N
    • xbar: Default X Bar.
    • dev: Default Std. Dev.
    • owner
    • memo
    • last_alarm_time
    • last_updated_time
SPC Rules
  • One point beyond the 3σ control limit
  • 2 out of 3 consecutive points plot outside of the 2σ control limit
  • 4 out of 5 consecutive points plot outside of the 1σ control limit
  • 9 consecutive points on the same side of the centerline
  • 6 consecutive points increase or decrease
  • consecutive points oscillate up and down
  • consecutive points inside of the 1σ control limit
So, when there is any applied SPC Rule that is violated, the SPC Server will send SPC Alarm Email to specific user directly. The following is the example of the email:

SPC Server
  • The main purpose of SPC Server is to monitor the process data and check the SPC Rules. Once it violates rules, the alarm email will send to related persons directly. But, before sending alarm email, there are a bunch of things that need to do. The following content will introduce the detail information about SPC Server.
  • What does the SPC Chart look like in our SPC system?
    • Our SPC Chart will display the latest 24 points data, 3σ control limit lines, and 2 SPEC limit lines as follows:

  • Multi-threading in SPC Server
    • For the purpose of showing dynamic SPC Chart image and updating the SPC info into database, there are several threads doing their jobs to keep SPC Server work well as follows:
      • GUI: This is the main thread. It controls the GUI drawing and event handling with JFrame application.
      • JMS Receiver: We adopt ActiveMQ as JMS Provider and its API to achieving the message receiving and sending. When SPC Server starts, it will generate a JMS Receiver that we have implemented for SPC purpose and this Receiver will listen and watch out if there is any message coming.
      • SPC Chart Drawer: This heavy loading job to draw SPC Chart image is done by the Class: SPCCanvas. It refreshes the current SPC Chart image that includes to draw upper and low SPEC limits, 3σ control limits, xbar line, 24 data points, and some data labels near lines and points in every 100 millisecond. Without it, the SPC Chart image won't show smoothly.
      • DB Sync: In order to know the current SPC info, for instance, xbar, std. dev., and the current 24 data points, last updated time, and last alarm time. The Class: SPCSync is to sync this information into database in every minute. And we can use the web application to query these information.

  • SPC Image Synchronization:
As mentioned below, SPC Server has multi-threads running when it starts so that it will encounter the resource that could be accessed or updated by 2 or more threads at the same time. It's the issue of resource synchronization. In our case, we have to avoid drawing image when SPC Server is adding a new point into its SPC Chart at the same time. In other words, we don't want to see that the SPC Chart image is not complete or not correct. This situation also will affect the correction of SPC Alarm Email. Our solution is to use Semaphore which is based on Lock object to achieve our goal. The more detail is in the following image: 
  • SPC Server Data Process Flow
    • When the number of the point in a SPC Chart reach 24, SPC Server will start to draw the Chart Image.
    • When data message comes, SPC Server will follow up this process flow to deal with SPC calculation and applying SPC Rules.

  • SPC Server Data Structure:
    • The data structure is very important because it controls and contains all the point data and SPC setting in the memory so that we can lookup and operate data quickly. The main data structure is as follows:

  • SPC Server Configuration
    • DataSource?_PROD.properties
      • This properties file is as same as we use in web application
    • activemq_PubSub.config
      • This config file is about the ActiveMQ (JMS Provider) setting
§  mq.url=tcp://localhost:61616
§  mq.messagetype=Topic
§  mq.subject=testtopic
§  mq.username=
§  mq.password=
    • log4j.properties
o    log4j.logger.SPCSERVER=ALL, SERVERFileAppender, consoleAppender
o     
o    #Console Log
o    log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
o    log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
o    log4j.appender.consoleAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n
o     
o    #SPC Server File Log
o    log4j.appender.SERVERFileAppender=org.apache.log4j.DailyRollingFileAppender
o    log4j.appender.SERVERFileAppender.DatePattern='.'yyyy-MM-dd
o    log4j.appender.SERVERFileAppender.layout=org.apache.log4j.PatternLayout
o    log4j.appender.SERVERFileAppender.layout.ConversionPattern=%d{yy-MM-dd HH:mm:ss:SSS} [%c] %p :  %m%n
o    log4j.appender.SERVERFileAppender.File=C:\\log\\spc\\spcserver.log
SPC Client
  • SPC Server needs to be fed by data message and SPC Client is playing the role to provide the messaging source. So far we only implement a client program for fetching the columns in TblFinal? table. Different message source could need a different client to deal with because how to generate the data message and what the format of data message are key points. For this case, the the foramt of chart name has 4 categories and 1 data vlaue: Product Name, Test Type, Station, Column Name, and coming with a colon and a data value.
  • For instance, nuvi 3790 Software Version 2.60,A,T3_3001FT07,SNR:44.5
  • SPC Client program will query data from TblFinal? in SPC database(MySQL) and is based on chart name format to generate the data message and send to the topic in JMS Provider.
  • SPC Client Configuration
    • activemq_client.config
o    mq.url=tcp://localhost:61616
o    mq.messagetype=Topic
o    mq.subject=testtopic
o    mq.username=
o    mq.password=
    • spc_client_datasource.config
o    DS_MYSQL.SPC_URL=jdbc:mysql://10.124.0.132:3306/SPC
o    DS_MYSQL.SPC_USER=xxxx
o    DS_MYSQL.SPC_PASSWD=xxxx
o    DS_MYSQL.SPC_DRIVER=com.mysql.jdbc.Driver
o    DS_MYSQL.SPC_CHARENCODING=big5
o    DS_MYSQL.SPC_DBTYPE=MYSQL
    • spc_data_mapper.config
o    #Data Mapper
o    spc.client.main=TBLFINALDataMapper
o    tblfinal=SNR
SPC System Web Application
  • This web application provides all the parameter setting management and query function in SPC.
    • spc_client_query
      • Provide the basic qeury function of SPC setting and current SPC info.

      • Provide the SPC Chart setting for TblFinal?.

      • Provide the Alarm Email setting with SPC chart.