public Engine(Config config) { this.config = config; this.colorimeter = new Colorimeter(); this.xml = new Xml(this.config.ScriptName); if (!this.config.IsSimulation) { this.fixture = new Fixture(this.config.FixturePortName); //this.ca310Pipe = new Ca310Pipe(System.Windows.Forms.Application.StartupPath); IDevice intergrate = new IntegratingSphere(this.fixture, this.config.LCP3005PortName); DevManage.Instance.AddDevice(fixture); DevManage.Instance.AddDevice(intergrate); } dut = (DUT)Activator.CreateInstance(Type.GetType("DUTclass." + this.config.ProductType)); mode = (TestMode)Enum.Parse(typeof(TestMode), this.config.TestMode); ip = new imagingpipeline(); args = new DataChangeEventArgs(); tableArgs = new TableViewEventArgs(); tableArgs.Items = xml.Items; log = new Testlog(); SerialNumber = ""; if (!System.IO.Directory.Exists(IMAGE_SAVE_PATH)) { System.IO.Directory.CreateDirectory(IMAGE_SAVE_PATH); } }
// get the uniformity by 5 zones. public double getuniformity(double[, ,] XYZ, int pointNums) { int productType = 0; zoneresult zr = new zoneresult(); List <double> pointLv = new List <double>(); string value = ""; if (pointNums < 9) { pointNums = 9; productType = 0; } else { pointNums = 13; productType = 1; } zr.clear(); for (int i = 0; i < pointNums; i++) { double[, ,] XYZValue = zr.XYZlocalzone(productType, (i + 1), 10, XYZ); double a = getlv(XYZValue); pointLv.Add(a); } if (log == null) { log = new Testlog(); } pointLv = PointLV(pointLv); for (int i = 0; i < pointNums; i++) { value = string.Format("{0},{1}", value, pointLv[i]); } log.AppendCamareVaule(value); lvvalue = pointLv; double lvMax = pointLv.ToArray().Max(); double lvMin = pointLv.ToArray().Min(); double unif = lvMin / lvMax; return(unif); }