Exemple #1
0
        public void ClearLotEndFlag1Test()
        {
            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);

            target.Open();
            target.ClearLotEndFlag();

            plcComm.Verify(x => x.Write(It.IsAny<string>()), Times.Exactly(1));
            plcComm.Verify(x => x.Write(PlcHelper.GetBoolWriteCommand(false, 0x136)), Times.Exactly(1));
        }
Exemple #2
0
        public void AcceptWaferBreakNumber1Test()
        {
            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);

            target.Open();
            target.AcceptWaferBreakNumber();

            plcComm.Verify(x => x.Write(It.IsAny<string>()), Times.Exactly(1));
            plcComm.Verify(x => x.Write(PlcHelper.GetBoolWriteCommand(true, 0x134)), Times.Exactly(1));
        }
Exemple #3
0
        public void CarrierPlateBarcodeSuccesfullyReaded1Test()
        {
            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);

            target.Open();
            target.CarrierPlateBarcodeSuccesfullyReaded();

            plcComm.Verify(x => x.Write(It.IsAny<string>()), Times.Exactly(1));
            plcComm.Verify(x => x.Write(PlcHelper.GetBoolWriteCommand(true, 0x131)), Times.Exactly(1));
        }
        public void MountPlcIntegrationTest()
        {
            MountSimulatorPlcCommunication simulator = MountSimulatorPlcCommunication.Create();

            IMountPlc target = new MountPlc(simulator);
            target.Open();

            bool isCassetteIdError = false;
            string newLotId = "";
            MountLine line = MountLine.Both;
            bool isNewLotStarted = false;

            bool isBarcodeReadedOk = false;
            bool isCarrierPlateMountingReady = false;
            bool isWaferBreakInfoOk = false;
            bool isMountingCarrierPlateError = false;

            bool isLotEnded = false;
            bool isReservationLotCanceled = false;
            bool isInformationSystemError = false;

            ILotData lotData = SimulatorHelper.GetDefaultLotData();

            IMountStatus status = target.GetStatus();
            CompareObjects(simulator, status);

            for (int i = 0; i < 1000; i++)
            {
                // "PLC" randomly clear/setup memory
                if (_random.NextDouble() > 0.40)
                {
                    switch (_random.Next(1, 10))
                    {
                        case 1:
                            isCassetteIdError = false;
                            simulator.IsCassetteIdError = isCassetteIdError;
                            break;
                        case 2:
                            newLotId = SimulatorHelper.GetRandomString(14);
                            simulator.NewLotId = newLotId;

                            line = SimulatorHelper.GetRandomMountLine();
                            simulator.Line = line;

                            isNewLotStarted = true;
                            simulator.IsLotStarted = isNewLotStarted;
                            break;
                        case 3:
                            isBarcodeReadedOk = false;
                            simulator.IsBarcodeReadedOk = isBarcodeReadedOk;
                            break;
                        case 4:
                            isCarrierPlateMountingReady = true;
                            simulator.IsCarrierPlateMountingReady = isCarrierPlateMountingReady;
                            break;
                        case 5:
                            isWaferBreakInfoOk = false;
                            simulator.IsWaferBreakInfoOk = isWaferBreakInfoOk;
                            break;
                        case 6:
                            isMountingCarrierPlateError = true;
                            simulator.IsMountingCarrierPlateError = isMountingCarrierPlateError;
                            break;
                        case 7:
                            isLotEnded = true;
                            simulator.IsLotEnded = isLotEnded;
                            break;
                        case 8:
                            isReservationLotCanceled = true;
                            simulator.IsReservationLotCanceled = isReservationLotCanceled;
                            break;
                        case 9:
                            lotData = SimulatorHelper.GetDefaultLotData();
                            simulator.LotId = lotData.LotId;
                            for (int idx = 0; idx < 12; idx++)
                            {
                                simulator.Cassettes[idx].Id = string.Empty;
                            }
                            simulator.CassetteQuantityInLot = lotData.Cassettes.Count;

                            for (int idx = 0; idx < 300; idx++)
                            {
                                simulator.Wafers[idx].WaferCassetteNumber = 0;
                                simulator.Wafers[idx].WaferSlotNumber = 0;
                            }
                            simulator.WaferQuantity = lotData.Wafers.Count;

                            simulator.NotGoodWaferQuantity = lotData.NGWaferCount;
                            simulator.Size = lotData.WaferSize;
                            simulator.Type = lotData.OfType;
                            simulator.Division = lotData.PolishDivision;
                            simulator.CarrierPlateQuantity1 = lotData.Assembly1.CarrierPlateCount;
                            simulator.WaferQuantity1 = lotData.Assembly1.WaferCount;
                            simulator.CarrierPlateQuantity2 = lotData.Assembly2.CarrierPlateCount;
                            simulator.WaferQuantity2 = lotData.Assembly2.WaferCount;
                            break;
                    }
                }

                // "Information system" randomly write to memory
                if (_random.NextDouble() > 0.50)
                {
                    switch (_random.Next(1, 11))
                    {
                        case 1:
                            target.AcceptNewLot(false);
                            isCassetteIdError = true;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 2:
                            target.ClearNewLotStartData();
                            newLotId = "";
                            line = MountLine.Cleared;
                            isNewLotStarted = false;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 3:
                            target.CarrierPlateBarcodeSuccesfullyReaded();
                            isBarcodeReadedOk = true;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 4:
                            target.ClearCarrierPlateMountingReadyFlag();
                            isCarrierPlateMountingReady = false;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 5:
                            target.AcceptWaferBreakNumber();
                            isWaferBreakInfoOk = true;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 6:
                            target.ClearMountingErrorCarrierPlateFlag();
                            isMountingCarrierPlateError = false;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 7:
                            target.ClearLotEndFlag();
                            isLotEnded = false;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 8:
                            target.ClearReservationLotCancelFlag();
                            isReservationLotCanceled = false; ;
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 9:
                            isInformationSystemError = (_random.NextDouble() > 0.5) ? true : false;
                            target.WriteBarcodeError(isInformationSystemError);
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                        case 10:
                            lotData = SimulatorHelper.GetRandomLotData();
                            target.SetLotData(lotData);
                            CompareObjects(simulator, isCassetteIdError, newLotId, line, isNewLotStarted, isBarcodeReadedOk, isCarrierPlateMountingReady,
                                           isWaferBreakInfoOk, isMountingCarrierPlateError, isLotEnded, isReservationLotCanceled, isInformationSystemError, lotData);
                            break;
                    }
                }

                ChangeStatusData(simulator);
                status = target.GetStatus();
                CompareObjects(simulator, status);
            }
        }
Exemple #5
0
        public void WriteBarcodeError2Test()
        {
            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);

            target.Open();
            target.WriteBarcodeError(false);

            plcComm.Verify(x => x.Write(It.IsAny<string>()), Times.Exactly(1));
            plcComm.Verify(x => x.Write(PlcHelper.GetBoolWriteCommand(false, 0x141)), Times.Exactly(1));
        }
Exemple #6
0
        public void SetLotData3Test()
        {
            List<IWafer> listOfWafers = PlcHelper.GetWaferList(300, 12);

            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);
            ILotData lotData = PlcHelper.GetLotData("ABCDEFGHIJKLMN", PlcHelper.GetCassetteList(12), listOfWafers);

            target.Open();
            target.SetLotData(lotData);

            plcComm.Verify(x => x.Write(PlcHelper.GetIntWriteCommand(1, 0x188)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandSetLotCassetteDataString(lotData)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(PlcHelper.GetIntWriteCommand(2, 0x188)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandSetLotWaferDataString(lotData)), Times.Exactly(1));
            for (int i = 0; i < 10; i++)
            {
                plcComm.Verify(x => x.Write(GetWriteCommandWafersDataString(PlcHelper.GetWaferSubList(listOfWafers, 0 + i * 32, 32), 0x200 + i * 0x40)), Times.Exactly(1));
            }
            plcComm.Verify(x => x.Write(PlcHelper.GetIntWriteCommand(0, 0x188)), Times.Exactly(1));
        }
Exemple #7
0
        public void SetLotData1Test()
        {
            List<IWafer> listOfWafers = PlcHelper.GetWaferList(3, 1);

            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);
            ILotData lotData = PlcHelper.GetLotData("ABCDEFGHIJKLMN", PlcHelper.GetCassetteList(1), listOfWafers);

            target.Open();
            target.SetLotData(lotData);

            plcComm.Verify(x => x.Write(GetWriteCommandLotDataTransmissionString(LotDataTransmission.BeforeWritingCassetteInfo)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandSetLotCassetteDataString(lotData)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandLotDataTransmissionString(LotDataTransmission.BeforeWritingWaferInfo)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandSetLotWaferDataString(lotData)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandWafersDataString(PlcHelper.GetWaferSubList(listOfWafers, 0, 32), 0x200)), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandLotDataTransmissionString(LotDataTransmission.Cleared)), Times.Exactly(1));
        }
Exemple #8
0
        public void GetStatus3Test()
        {
            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            string read = string.Empty;
            plcComm.Setup(x => x.Read()).Returns(() => { return read; });
            plcComm.Setup(x => x.Write(It.IsAny<string>())).Callback<string>((s) =>
            {
                if (s.StartsWith("\u000500FFCR0001202107"))
                    read = "\u0002" + PlcHelper.GetMountStatusStream(2) + PlcStream.CalculateCheckSum(PlcHelper.GetMountStatusStream(2));
            });

            MountPlc target = new MountPlc(plcComm.Object);
            target.Open();

            IMountStatus target1 = target.GetStatus();

            Assert.AreEqual<MountState>(MountState.StopAlarm, target1.State);
            Assert.AreEqual<string>("LDPW8X2D", target1.NewLotCassette.CassetteId);
            Assert.AreEqual<bool>(true, target1.NewLotCassette.IsCassetteId);
            Assert.AreEqual<bool>(false, target1.IsLotDataTimeout);
            Assert.AreEqual<string>("MZQPALJFIR2JCS", target1.NewLotStarted.LotId);
            Assert.AreEqual<MountLine>(MountLine.Right, target1.NewLotStarted.Line);
            Assert.AreEqual<bool>(false, target1.NewLotStarted.IsLotStarted);
            Assert.AreEqual<bool>(true, target1.IsCarrierPlateArrived);
            Assert.AreEqual<bool>(true, target1.IsCarrierPlateMountingReady);
            Assert.AreEqual<int>(0, target1.WaferBreakNumber);
            Assert.AreEqual<bool>(false, target1.IsMountingErrorCarrierPlate);
            Assert.AreEqual<bool>(false, target1.IsEndLot);
            Assert.AreEqual<bool>(true, target1.IsReservationLotCanceled);
        }
Exemple #9
0
        public void ClearNewLotStartData1Test()
        {
            Mock<ICommunication> plcComm = PlcHelper.GetPlcCommunicationMock();
            MountPlc target = new MountPlc(plcComm.Object);

            target.Open();
            target.ClearNewLotStartData();

            plcComm.Verify(x => x.Write(It.IsAny<string>()), Times.Exactly(1));
            plcComm.Verify(x => x.Write(GetWriteCommandClearNewLotStartDataString()), Times.Exactly(1));
        }