Пример #1
0
        public void Test_GetBoardTemperature()
        {
            BaseOvenControl oven = new OvenControl(new Comm(_com, _baudrate));
            double          temp = oven.GetBoardTemperature(1, 1);

            Assert.AreEqual(true, temp > 57 && temp < 63);
        }
Пример #2
0
        public override Dictionary <int, List <KeyValuePair <string, string> > > ReadDataSet(string type)
        {
            var boardName = DataMember.BoardName;
            var floorNum  = DataMember.FloorNum;
            var boardNum  = DataMember.BoardNum;

            lock (FloorLock[floorNum])
            {
                Log.LogInfo("Read Data...");
                double ovenTemperature = 0;
                if (DataMember.OvenTempCheck)
                {
                    ovenTemperature = OvenControl.GetBoardTemperature(floorNum, boardNum);
                }


                var iccDac = ReadIcc();

                int[] mpdDac, currentDac;
                CtrlCom.ReadCurrentDacAndMpdDac(out currentDac, out mpdDac);


                var ret = new Dictionary <int, List <KeyValuePair <string, string> > >();
                foreach (var seat in Seats)
                {
                    var seatIndex = seat - 1;
                    var entry     = new List <KeyValuePair <string, string> >
                    {
                        new KeyValuePair <string, string>("PCName", Environment.MachineName),
                        new KeyValuePair <string, string>("BoardName", boardName),
                        new KeyValuePair <string, string>("Floor", floorNum.ToString()),
                        new KeyValuePair <string, string>("Seat", seat.ToString()),
                        new KeyValuePair <string, string>("BoardName", boardName),
                        new KeyValuePair <string, string>("CH", currentDac[seatIndex * 4].ToString()),
                        new KeyValuePair <string, string>("MPD", mpdDac[seatIndex * 4].ToString()),
                        new KeyValuePair <string, string>("ICC", iccDac[seatIndex].ToString("F2"))
                    };
                    if (DataMember.OvenTempCheck)
                    {
                        entry.Add(new KeyValuePair <string, string>("OVEN_Temperature", ovenTemperature.ToString("F2")));
                    }

                    SeatInit info;
                    if (TempInit.GetCalData(boardName, seat, out info))
                    {
                        entry.Add(new KeyValuePair <string, string>("DAC", info.CurrentDac0.ToString("F2")));
                        entry.Add(new KeyValuePair <string, string>("ICC0", info.Icc0.ToString("F2")));
                        entry.Add(new KeyValuePair <string, string>("LDI", BiConvert.ConvertToLdi(iccDac[seatIndex], info.Icc0, DataMember.DeltaIcck, DataMember.DeltaIccb).ToString("F2")));
                    }
                    ret[seat] = entry;
                }
                return(ret);
            }
        }
Пример #3
0
        protected override Dictionary <int, bool> PreCheckConnections()
        {
            var floorNum = DataMember.FloorNum;
            var boardNum = DataMember.BoardNum;

            Log.LogInfo("Check Connetions...");
            var ret = new Dictionary <int, bool>();

            foreach (var seat in Seats)
            {
                ret[seat] = true;
            }
            Log.LogInfo(GetVersion());

            lock (FloorLock[floorNum])
            {
                SetOvenTemperature();
                OpenDc();
                CtrlCom.EnableBiasSync(true);
                SetSyncBias(0);
                SetSyncBias(DataMember.ConnectCheckBias);

                var icc = ReadIcc();

                Dictionary <int, double> temp;
                double t1;
                double t2;
                ReadTecTemperature(out temp, out t1, out t2);


                SetSyncBias(0);

                CtrlCom.EnableBiasSync(false);
                CloseDc();

                Log.LogInfo("Check Icc & Tec...");
                foreach (var seat in Seats)
                {
                    var seatIndex = seat - 1;
                    ret[seat] = (icc[seatIndex] > DataMember.ConnectIccRangeMin &&
                                 icc[seatIndex] < DataMember.ConnectIccRangeMax) &&
                                (temp[seatIndex] > DataMember.ConnectTecTempRangeMin &&
                                 temp[seatIndex] < DataMember.ConnectTecTempRangeMax);
                    Log.LogInfo("SEAT:" + seat);
                    Log.LogInfo(
                        $"ICC\tSPEC({DataMember.ConnectIccRangeMin},{DataMember.ConnectIccRangeMax})\tValue:{icc[seatIndex]}");
                    Log.LogInfo(
                        $"TEC\tSPEC({DataMember.ConnectTecTempRangeMin},{DataMember.ConnectTecTempRangeMax})\tValue:{temp[seatIndex]}");
                }
            }

            if (ret.ContainsValue(false))
            {
                return(ret);
            }
            if (DataMember.OvenTempCheck)
            {
                Log.LogInfo("Check Oven Temperature...");
                var start = DateTime.Now;
                do
                {
                    double currentTemperature = OvenControl.GetBoardTemperature(floorNum, boardNum);
                    Log.LogInfo("Oven Temperature=" + currentTemperature);
                    if (currentTemperature > DataMember.CheckTemperature)
                    {
                        Log.LogInfo("Oven Temperature Check Pass...");
                        return(ret);
                    }

                    Thread.Sleep(1000);
                } while (DateTime.Now.Subtract(start).TotalMinutes < DataMember.OvenTimeout);

                throw new Exception(" Oven Temperature check fail!");
            }
            else
            {
                return(ret);
            }
        }
Пример #4
0
        public override Dictionary <int, List <KeyValuePair <string, string> > > ReadDataSet(string type)
        {
            var boardName = DataMember.BoardName;
            var floorNum  = DataMember.FloorNum;
            var boardNum  = DataMember.BoardNum;

            lock (FloorLock[floorNum])
            {
                Log.LogInfo("Read Data...");
                double ovenTemperature = 0;
                if (DataMember.OvenTempCheck)
                {
                    ovenTemperature = OvenControl.GetBoardTemperature(floorNum, boardNum);
                }
                var icc     = ReadIcc();
                var iTecDac = CtrlCom.ReadItecDac();

                Dictionary <int, double> temp;
                double t1, t2;
                ReadTecTemperature(out temp, out t1, out t2);

                int[] mpdDac, currentDac;
                CtrlCom.ReadCurrentDacAndMpdDac(out currentDac, out mpdDac);


                var ret = new Dictionary <int, List <KeyValuePair <string, string> > >();
                foreach (var seat in Seats)
                {
                    var seatIndex = seat - 1;
                    var entry     = new List <KeyValuePair <string, string> >
                    {
                        new KeyValuePair <string, string>("Floor", floorNum.ToString()),
                        new KeyValuePair <string, string>("Seat", seat.ToString()),
                        new KeyValuePair <string, string>("BoardName", boardName)
                    };
                    if (DataMember.OvenTempCheck)
                    {
                        entry.Add(new KeyValuePair <string, string>("OVEN_Temperature", ovenTemperature.ToString(CultureInfo.InvariantCulture)));
                    }
                    for (int channel = 0; channel < 4; channel++)
                    {
                        entry.Add(new KeyValuePair <string, string>("CH" + channel, currentDac[seatIndex * 4 + channel].ToString()));
                        entry.Add(new KeyValuePair <string, string>("MPD" + channel, mpdDac[seatIndex * 4 + channel].ToString()));
                    }
                    entry.Add(new KeyValuePair <string, string>("TEC_TEMPERATURE", temp[seatIndex].ToString(CultureInfo.InvariantCulture)));
                    entry.Add(new KeyValuePair <string, string>("T1", t1.ToString(CultureInfo.InvariantCulture)));
                    entry.Add(new KeyValuePair <string, string>("T2", t2.ToString(CultureInfo.InvariantCulture)));
                    entry.Add(new KeyValuePair <string, string>("ITEC", BiConvert.ConvertDacToITec(iTecDac[seatIndex], DataMember.ReadIteck, DataMember.ReadItecb).ToString(CultureInfo.InvariantCulture)));
                    entry.Add(new KeyValuePair <string, string>("ICC", icc[seatIndex].ToString(CultureInfo.InvariantCulture)));
                    entry.Add(new KeyValuePair <string, string>("PCName", Environment.MachineName));
                    entry.Add(new KeyValuePair <string, string>("BoardName", boardName));
                    entry.Add(new KeyValuePair <string, string>("Seat", seat.ToString()));

                    SeatInit info;
                    if (TempInit.GetCalData(boardName, seat, out info))
                    {
                        entry.Add(new KeyValuePair <string, string>("DAC1", info.CurrentDac0.ToString("F2")));
                        entry.Add(new KeyValuePair <string, string>("DAC2", info.CurrentDac1.ToString("F2")));
                        entry.Add(new KeyValuePair <string, string>("DAC3", info.CurrentDac2.ToString("F2")));
                        entry.Add(new KeyValuePair <string, string>("DAC4", info.CurrentDac3.ToString("F2")));
                        entry.Add(new KeyValuePair <string, string>("ICC0", info.Icc0.ToString("F2")));
                        // entry.Add(new KeyValuePair<string, string>("LDI", BiConvert.ConvertToLdi(icc[seatIndex], info.icc0, _dataMember.DeltaIcck, _dataMember.DeltaIccb).ToString("F2")));
                    }
                    ret[seat] = entry;
                }
                return(ret);
            }
        }
Пример #5
0
        public override Dictionary <int, List <KeyValuePair <string, string> > > ReadDataSet(string type)
        {
            var floorNum  = DataMember.FloorNum;
            var boardName = DataMember.BoardName;
            var ret       = new Dictionary <int, List <KeyValuePair <string, string> > >();

            Log.LogInfo("read oven temperature.");

            lock (FloorLock[floorNum])
            {
                double oventemperature = 0;
                if (DataMember.OvenTempCheck)
                {
                    oventemperature = OvenControl.GetBoardTemperature(DataMember.FloorNum, DataMember.BoardNum);
                }


                int[] channelArray;
                int[] mpdArray;
                CtrlCom.ReadCurrentDacAndMpdDac(out channelArray, out mpdArray);


                var icc     = ReadIcc();
                var itecSet = CtrlCom.ReadItecDac();


                int[] therTempSet;
                int   t1Set;
                int   t2Set;
                CtrlCom.ReadTecTemperatureDac(out therTempSet, out t1Set, out t2Set);

                foreach (var seat in Seats)
                {
                    var seatIndex = seat - 1;
                    var record    = new List <KeyValuePair <string, string> >
                    {
                        new KeyValuePair <string, string>("PCName", Environment.MachineName),
                        new KeyValuePair <string, string>("Floor", DataMember.FloorNum.ToString()),
                        new KeyValuePair <string, string>("BoardName", DataMember.BoardNum.ToString()),
                        new KeyValuePair <string, string>("Seat", seat.ToString()),
                        new KeyValuePair <string, string>("OVEN_Temperature", oventemperature.ToString("F1")),
                        new KeyValuePair <string, string>("ICC", icc[seatIndex].ToString("F2")),
                        new KeyValuePair <string, string>("ITEC", BiConvert.ConvertDacToITec(itecSet[seatIndex], DataMember.ReadIteck, DataMember.ReadItecb).ToString("F2")),
                        new KeyValuePair <string, string>("TEC_Temperature", BiConvert.ConvertDacToTemp(therTempSet[seatIndex]).ToString("F2")),
                        new KeyValuePair <string, string>("T1", BiConvert.ConvertDacToTemp(t1Set).ToString("F2")),
                        new KeyValuePair <string, string>("T2", BiConvert.ConvertDacToTemp(t2Set).ToString("F2"))
                    };
                    SeatInit info;
                    if (TempInit.GetCalData(boardName, seat, out info))
                    {
                        record.Add(new KeyValuePair <string, string>("DAC", info.CurrentDac0.ToString("F2")));
                        record.Add(new KeyValuePair <string, string>("ICC0", info.Icc0.ToString("F2")));
                        record.Add(new KeyValuePair <string, string>("LDI", BiConvert.ConvertToLdi(icc[seatIndex], info.Icc0, DataMember.DeltaIcck, DataMember.DeltaIccb).ToString("F2")));
                    }

                    for (var channel = 0; channel < 4; channel++)
                    {
                        record.Add(new KeyValuePair <string, string>("Ch" + channel, channelArray[seatIndex * 4 + channel].ToString()));
                        record.Add(new KeyValuePair <string, string>("MPD" + channel, mpdArray[seatIndex * 4 + channel].ToString()));
                    }
                    ret[seat] = record;
                }
                return(ret);
            }
        }
Пример #6
0
        protected override Dictionary <int, bool> PreCheckConnections()
        {
            var floorNum = DataMember.FloorNum;
            var boardNum = DataMember.BoardNum;

            Log.LogInfo("Check Connetions...");
            var ret = new Dictionary <int, bool>();

            foreach (var seat in Seats)
            {
                ret[seat] = true;
            }
            Log.LogInfo(GetVersion());
            SetOvenTemperature();
            lock (FloorLock[floorNum])
            {
                OpenDc();

                CtrlCom.EnableBiasSync(true);
                SetSyncBias(0);
                Thread.Sleep(1000);
                SetSyncBias(DataMember.ConnectCheckBias);
                Thread.Sleep(1000);
                var icc = ReadIcc();
                SetSyncBias(0);
                CtrlCom.EnableBiasSync(false);
                CloseDc();

                Log.LogInfo("Check Icc & Tec...");
                foreach (var seat in Seats)
                {
                    int seatIndex = seat - 1;
                    ret[seat] = (icc[seatIndex] > DataMember.ConnectIccRangeMin && icc[seatIndex] < DataMember.ConnectIccRangeMax);

                    Log.LogInfo("SEAT:" + seat);
                    Log.LogInfo("ICC\tSPEC(<min>,<max>)\tValue:<value>".Replace("<min>", DataMember.ConnectIccRangeMin.ToString()).Replace("<max>", DataMember.ConnectIccRangeMax.ToString()).Replace("<value>", icc[seatIndex].ToString(CultureInfo.InvariantCulture)));
                }
            }
            if (ret.ContainsValue(false))
            {
                return(ret);
            }
            if (DataMember.OvenTempCheck)
            {
                Log.LogInfo("Check Oven Temperature...");
                var start = DateTime.Now;
                do
                {
                    var currentTemperature = OvenControl.GetBoardTemperature(floorNum, boardNum);
                    Log.LogInfo("Oven Temperature=" + currentTemperature);
                    if (currentTemperature > DataMember.CheckTemperature)
                    {
                        Log.LogInfo("Oven Temperature Check Pass...");
                        return(ret);
                    }
                    Thread.Sleep(1000);
                } while (DateTime.Now.Subtract(start).TotalMinutes < DataMember.OvenTimeout);
                throw new Exception(" Oven Temperature check fail!");
            }
            else
            {
                return(ret);
            }
        }