Example #1
0
        private static Dictionary <string, PcbTesterMeasurements> dataTableToDict(DataTable sqlTable)
        {
            Dictionary <string, PcbTesterMeasurements> result = new Dictionary <string, PcbTesterMeasurements>();

            if (sqlTable.Rows.Count > 0)
            {
                Dictionary <string, string> lotToModel = new Dictionary <string, string>();

                foreach (DataRow row in sqlTable.Rows)
                {
                    string serial = row["serial_no"].ToString();
                    if (result.ContainsKey(serial))
                    {
                        continue;
                    }

                    string lot   = row["wip_entity_name"].ToString();
                    string model = "";

                    if (!IsInt(lot))
                    {
                        continue;
                    }
                    string orderNo = row["CUSTOMER_ORDER_NO"].ToString();

                    model = row["NC12"].ToString();
                    if (!lotToModel.ContainsKey(lot))
                    {
                        lotToModel.Add(lot, model);
                    }
                    string cxString = row["x"].ToString().Replace(".", ",");
                    string cyString = row["y"].ToString().Replace(".", ",");
                    if (cxString == "" || cyString == "")
                    {
                        continue;
                    }

                    if (model == "")
                    {
                        continue;
                    }
                    double cx   = Convert.ToDouble(cxString, new CultureInfo("pl-PL"));
                    double cy   = double.Parse(row["y"].ToString().Replace(".", ","));
                    double sdcm = double.Parse(row["sdcm"].ToString());
                    double cct  = double.Parse(row["cct"].ToString());
                    double vf   = double.Parse(row["v"].ToString());
                    double lm   = double.Parse(row["lm"].ToString());
                    double lmW  = double.Parse(row["lm_w"].ToString());
                    double cri  = double.Parse(row["cri"].ToString());

                    DateTime inspTime = DateTime.Parse(row["inspection_time"].ToString());

                    PcbTesterMeasurements newPcb = new PcbTesterMeasurements(cx, cy, sdcm, cct, inspTime, model, vf, lm, lmW, cri, cct, orderNo);
                    result.Add(serial, newPcb);
                }
            }
            return(result);
        }
Example #2
0
        private static double CalculateSDCM(PcbTesterMeasurements testResults, ModelSpecification modelSPecification)
        {
            double result = 0;

            if (modelSPecification.A > 0)
            {
                double partA        = Math.Pow((modelSPecification.Cx - testResults.Cx) * modelSPecification.A - (modelSPecification.Cy - testResults.Cy) * modelSPecification.B, 2) / Math.Pow(modelSPecification.C, 2);
                double partB        = Math.Pow((modelSPecification.Cx - testResults.Cx) * modelSPecification.B + (modelSPecification.Cy - testResults.Cy) * modelSPecification.A, 2) / Math.Pow(modelSPecification.D, 2);
                double AllensFactor = 0.04;
                result = Math.Sqrt(partA + partB);
                if (result > 0.04)
                {
                    result = result - AllensFactor;
                }
            }
            return(result);
        }