| | |
| | | { |
| | | m_listener.onStateChanged = listener.onStateChanged; |
| | | m_listener.onPlcStateChanged = listener.onPlcStateChanged; |
| | | m_listener.onCimStateChanged = listener.onCimStateChanged; |
| | | m_listener.onEfemStateChanged = listener.onEfemStateChanged; |
| | | m_listener.onRecvBroadcast = listener.onRecvBroadcast; |
| | | } |
| | |
| | | const std::vector<CComponent*>& CBonder::getComponents() |
| | | { |
| | | return m_components; |
| | | } |
| | | |
| | | CPLC* CBonder::getPLC(const char* pszName) |
| | | { |
| | | return (CPLC*)GetComponent("PLC(1)"); |
| | | } |
| | | |
| | | int CBonder::save() |
| | |
| | | { |
| | | // 机器状态 |
| | | CEQStateMonitor* pEQStateMonitor1 = new CEQStateMonitor(); |
| | | pEQStateMonitor1->setName("机器状态(A单元)"); |
| | | pEQStateMonitor1->setDescription("A单机器状态"); |
| | | pEQStateMonitor1->setName("机器状态"); |
| | | pEQStateMonitor1->setDescription("机器状态"); |
| | | pEQStateMonitor1->setIndex(0); |
| | | pEQStateMonitor1->setBeginAddr(4463 - 4400); |
| | | AddComponent(pEQStateMonitor1); |
| | | pEQStateMonitor1->init(); |
| | | |
| | | CEQStateMonitor* pEQStateMonitor2 = new CEQStateMonitor(); |
| | | pEQStateMonitor2->setName("机器状态(B单元)"); |
| | | pEQStateMonitor2->setDescription("B单机器状态"); |
| | | pEQStateMonitor2->setIndex(1); |
| | | pEQStateMonitor2->setBeginAddr(4563 - 4500); |
| | | AddComponent(pEQStateMonitor2); |
| | | pEQStateMonitor2->init(); |
| | | |
| | | |
| | | // 初始化各种组件 |
| | |
| | | pPlc->setName("PLC(1)"); |
| | | pPlc->setDescription("PLC"); |
| | | pPlc->setIndex(0); |
| | | pPlc->init(); |
| | | AddComponent(pPlc); |
| | | |
| | | |
| | | CDataMonitor1* pDataMonitor1 = new CDataMonitor1(); |
| | | pDataMonitor1->setName("数据监控(A单元)"); |
| | | pDataMonitor1->setDescription("A单元真空、压力和温度数据"); |
| | | pDataMonitor1->setName("数据监控"); |
| | | pDataMonitor1->setDescription("真空、压力和温度数据"); |
| | | pDataMonitor1->setIndex(0); |
| | | pDataMonitor1->setResponseAddr(4425); |
| | | pDataMonitor1->enableAutoSendData(bAutoSendData); |
| | | AddComponent(pDataMonitor1); |
| | | pDataMonitor1->init(); |
| | | |
| | | CDataMonitor1* pDataMonitor2 = new CDataMonitor1(); |
| | | pDataMonitor2->setName("数据监控(B单元)"); |
| | | pDataMonitor2->setDescription("B单元真空、压力和温度数据"); |
| | | pDataMonitor2->setIndex(1); |
| | | pDataMonitor2->setResponseAddr(4525); |
| | | pDataMonitor2->enableAutoSendData(bAutoSendData); |
| | | AddComponent(pDataMonitor2); |
| | | pDataMonitor2->init(); |
| | | |
| | | |
| | | |
| | | CString strAlarmFile; |
| | | strAlarmFile.Format(_T("%s\\AlarmList.txt"), m_strWorkDir.c_str()); |
| | | CAlarmMonitor* pAlarmMonitor1 = new CAlarmMonitor(); |
| | | pAlarmMonitor1->setName("警告信息(A单元)"); |
| | | pAlarmMonitor1->setDescription("警告信息监控(A单元)"); |
| | | pAlarmMonitor1->setName("警告信息"); |
| | | pAlarmMonitor1->setDescription("警告信息监控"); |
| | | pAlarmMonitor1->setBeginAddr(4461 - 4400); |
| | | pAlarmMonitor1->setIndex(0); |
| | | pAlarmMonitor1->readAlarmListFromFile((LPTSTR)(LPCTSTR)strAlarmFile); |
| | | AddComponent(pAlarmMonitor1); |
| | | pAlarmMonitor1->init(); |
| | | |
| | | CAlarmMonitor* pAlarmMonitor2 = new CAlarmMonitor(); |
| | | pAlarmMonitor2->setName("警告信息(B单元)"); |
| | | pAlarmMonitor2->setDescription("警告信息监控(B单元)"); |
| | | pAlarmMonitor2->setBeginAddr(4561 - 4500); |
| | | pAlarmMonitor2->setIndex(1); |
| | | pAlarmMonitor2->readAlarmListFromFile((LPTSTR)(LPCTSTR)strAlarmFile); |
| | | AddComponent(pAlarmMonitor2); |
| | | pAlarmMonitor2->init(); |
| | | |
| | | // LoadMonitor |
| | | CLoadMonitor* pLoadMonitor1 = new CLoadMonitor(); |
| | | pLoadMonitor1->setName("上下料(A单元)"); |
| | | pLoadMonitor1->setDescription("上下料信号监控(A单元)"); |
| | | pLoadMonitor1->setName("上下料"); |
| | | pLoadMonitor1->setDescription("上下料信号监控"); |
| | | pLoadMonitor1->setBeginAddr(4700); |
| | | pLoadMonitor1->setIndex(0); |
| | | AddComponent(pLoadMonitor1); |
| | | pLoadMonitor1->init(); |
| | | |
| | | CLoadMonitor* pLoadMonitor2 = new CLoadMonitor(); |
| | | pLoadMonitor2->setName("上下料(B单元)"); |
| | | pLoadMonitor2->setDescription("上下料信号监控(B单元)"); |
| | | pLoadMonitor2->setBeginAddr(4700); |
| | | pLoadMonitor2->setIndex(1); |
| | | AddComponent(pLoadMonitor2); |
| | | pLoadMonitor2->init(); |
| | | |
| | | CLoadMonitor* pLoadMonitor3 = new CLoadMonitor(); |
| | | pLoadMonitor3->setName("上下料(冷却箱)"); |
| | | pLoadMonitor3->setDescription("上下料信号监控(冷却箱)"); |
| | | pLoadMonitor3->setBeginAddr(4700); |
| | | pLoadMonitor3->setIndex(2); |
| | | AddComponent(pLoadMonitor3); |
| | | pLoadMonitor3->init(); |
| | | |
| | | |
| | | // BEQ与EFEM通讯 |
| | |
| | | }; |
| | | m_pEquipment->setEquipmentListener(equListener); |
| | | m_pEquipment->setVersion(m_strSoftRev.c_str()); |
| | | m_pEquipment->addUnit(UNITA, 5); |
| | | m_pEquipment->addUnit(UNITB, 5); |
| | | BEQ::IUnit* pUnitC = m_pEquipment->addUnit(UNITC, 1); |
| | | pUnitC->setLayerCount(4); |
| | | m_pEquipment->addUnit(UNIT1, 5); |
| | | m_pEquipment->runOnServerMode(8192); |
| | | |
| | | |
| | |
| | | item->OnTimer(nTimerid); |
| | | } |
| | | |
| | | |
| | | // PLC延时连接 |
| | | static int nPlc = 0; |
| | | nPlc++; |
| | | if (nPlc == 3) { |
| | | CPLC* pPLC = (CPLC*)GetComponent("PLC(1)"); |
| | | pPLC->init(); |
| | | } |
| | | |
| | | |
| | | // 自动保存 |
| | | static int iii = 0; |
| | | iii++; |
| | | if (iii % 5 == 0) { |
| | |
| | | BEQ::IUnit* CBonder::getUnit(int index) |
| | | { |
| | | if (index == 0) |
| | | return m_pEquipment->getUnit(UNITA); |
| | | if (index == 1) |
| | | return m_pEquipment->getUnit(UNITB); |
| | | if (index == 2) |
| | | return m_pEquipment->getUnit(UNITC); |
| | | return m_pEquipment->getUnit(UNIT1); |
| | | |
| | | return nullptr; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // 单元C为水冷塔,不需要写 |
| | | if (strcmp(szUnitName, UNITC) == 0) { |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | // 如果是单元A或单元B, 写物料ID和配方ID到PLC |
| | | CLoadMonitor* pLoadMonitor = nullptr; |
| | | if (strcmp(szUnitName, UNITA) == 0) { |
| | | if (strcmp(szUnitName, UNIT1) == 0) { |
| | | |
| | | pLoadMonitor = (CLoadMonitor*)GetComponent("上下料(A单元)"); |
| | | pLoadMonitor = (CLoadMonitor*)GetComponent("上下料"); |
| | | return pLoadMonitor->loadReady(pszMaterielId, pszRecipeId); |
| | | } |
| | | else if (strcmp(szUnitName, UNITB) == 0) { |
| | | |
| | | pLoadMonitor = (CLoadMonitor*)GetComponent("上下料(B单元)"); |
| | | return pLoadMonitor->loadReady(pszMaterielId, pszRecipeId); |
| | | } |
| | | |
| | | return -2; |
| | | } |
| | |
| | | if (!pPLC->isConnected()) { |
| | | return -1; |
| | | } |
| | | if (layer <= 0 || layer > 4) { |
| | | if (layer <= 0 || layer > 1) { |
| | | return -2; |
| | | } |
| | | |
| | |
| | | |
| | | // д |
| | | int index, nFlagAddr; |
| | | if (strcmp(szUnitName, UNITA) == 0) { |
| | | if (strcmp(szUnitName, UNIT1) == 0) { |
| | | index = 0; |
| | | nFlagAddr = 4710; |
| | | szBuffer[index * 2] |= 0x02; |
| | | } |
| | | else if (strcmp(szUnitName, UNITB) == 0) { |
| | | index = 1; |
| | | nFlagAddr = 4711; |
| | | szBuffer[index * 2] |= 0x02; |
| | | } |
| | | else if (strcmp(szUnitName, UNITC) == 0) { |
| | | index = 2; |
| | | nFlagAddr = 4712; |
| | | switch (layer) |
| | | { |
| | | case 1: |
| | | szBuffer[index * 2] |= 0x01; |
| | | break; |
| | | case 2: |
| | | szBuffer[index * 2] |= 0x02; |
| | | break; |
| | | case 3: |
| | | szBuffer[index * 2] |= 0x04; |
| | | break; |
| | | case 4: |
| | | szBuffer[index * 2] |= 0x08; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // д |
| | | int index, nFlagAddr; |
| | | if (strcmp(szUnitName, UNITA) == 0) { |
| | | if (strcmp(szUnitName, UNIT1) == 0) { |
| | | index = 0; |
| | | nFlagAddr = 4710; |
| | | szBuffer[index * 2 + 1] |= 0x02; |
| | | } |
| | | else if (strcmp(szUnitName, UNITB) == 0) { |
| | | index = 1; |
| | | nFlagAddr = 4711; |
| | | szBuffer[index * 2 + 1] |= 0x02; |
| | | } |
| | | else if (strcmp(szUnitName, UNITC) == 0) { |
| | | index = 2; |
| | | nFlagAddr = 4712; |
| | | switch (layer) |
| | | { |
| | | case 1: |
| | | szBuffer[index * 2] |= 0x20; |
| | | break; |
| | | case 2: |
| | | szBuffer[index * 2] |= 0x40; |
| | | break; |
| | | case 3: |
| | | szBuffer[index * 2] |= 0x80; |
| | | break; |
| | | case 4: |
| | | szBuffer[index * 2 + 1] |= 0x01; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |