Esempio n. 1
0
 public bool InsertNode(int insertIndex, CtlNodeBaseModel node)
 {
     if (nodePath.Count() < insertIndex)
     {
         return(false);
     }
     nodePath.Insert(insertIndex, node);
     return(true);
 }
Esempio n. 2
0
 public bool InsertNode(int insertIndex, CtlNodeBaseModel node, ref string reStr)
 {
     if (this.nodeList.Count() < insertIndex)
     {
         reStr = "线程:" + this.taskName + " 插入控制节点失败,插入索引越界";
         return(false);
     }
     this.nodeList.Insert(insertIndex, node);
     return(true);
 }
Esempio n. 3
0
        protected override void TaskloopProc()
        {
            while (!exitRunning)
            {
                Thread.Sleep(loopInterval);
                if (pauseFlag)
                {
                    continue;
                }

                //   logRecorder.AddDebugLog("线程:" + threadID,"线程:" + threadID+"循环开始:");

                //IPlcRW plcRW = nodeList[0].PlcRW;
                //if (!SysCfgModel.SimMode)
                //{
                //    if (lastPlcStat == plcRW.PlcStatCounter)
                //    {
                //        continue;
                //    }
                //}

                //if (threadID == 1)
                //{
                //    Console.WriteLine("线程:" + threadID + "循环开始:");
                //}
                for (int nodeIndex = 0; nodeIndex < nodeList.Count(); nodeIndex++)
                {
                    CtlNodeBaseModel node = nodeList[nodeIndex];
                    try
                    {
                        //if(!SysCfgModel.SimMode && SysCfgModel.TestMode)
                        //{
                        //    bool disable = false;
                        //    string[] disableNodes = new string[] {  "4001", "4002", "4003", "4004", "4005", "4006", "4007", "4008","8001"};
                        //    foreach(string disableNodeID in disableNodes)
                        //    {
                        //        if(node.NodeID == disableNodeID)
                        //        {
                        //            disable = true;
                        //            break;
                        //        }
                        //    }
                        //    if(disable)
                        //    {
                        //        continue;
                        //    }
                        //    if(node.GetType().ToString()== "NbProcessCtl.NodeAssemPack"||
                        //        node.GetType().ToString() == "NbProcessCtl.NodeAssemBottom"||
                        //        node.GetType().ToString() == "NbProcessCtl.NodeAssemUpper"||
                        //        node.GetType().ToString()== "NbProcessCtl.NodePalletBind")
                        //    {
                        //        continue;
                        //    }
                        //}
                        string reStr = "";
                        //if (!node.ReadDB1())
                        //{
                        //    continue;
                        //}
                        if (!node.NodeEnabled)
                        {
                            continue;
                        }
                        if (!node.ReadDB2(ref reStr))
                        {
                            continue;
                        }
                        if (!node.ExeBusiness(ref reStr))
                        {
                            continue;
                        }
                        if (!node.NodeCmdCommit(true, ref reStr))
                        {
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(node.NodeName + ex.ToString());
                        node.ThrowErrorStat(ex.ToString(), EnumNodeStatus.设备故障);
                    }
                }
                // lastPlcStat = plcRW.PlcStatCounter;
                //if (threadID == 1)
                //{
                //    Console.WriteLine("线程:" + threadID + "循环结束");
                //}
            }
        }
Esempio n. 4
0
 public void AddNode(CtlNodeBaseModel node)
 {
     this.nodeList.Add(node);
 }
Esempio n. 5
0
 public bool DelNode(CtlNodeBaseModel node)
 {
     return(nodePath.Remove(node));
 }
Esempio n. 6
0
 public void AddNode(CtlNodeBaseModel node)
 {
     nodePath.Add(node);
 }
Esempio n. 7
0
        protected override void TaskloopProc()
        {
            while (!exitRunning)
            {
                Thread.Sleep(loopInterval);
                if (pauseFlag)
                {
                    continue;
                }

                //   logRecorder.AddDebugLog("线程:" + threadID,"线程:" + threadID+"循环开始:");

                //IPlcRW plcRW = nodeList[0].PlcRW;
                //if (!SysCfg.SysCfgModel.SimMode && SysCfg.SysCfgModel.PlcCommSynMode)
                //{
                //    if (lastPlcStat == plcRW.PlcStatCounter)
                //    {
                //        continue;
                //    }
                //}

                //if (threadID == 1)
                //{
                //    Console.WriteLine("线程:" + threadID + "循环开始:");
                //}
                for (int nodeIndex = 0; nodeIndex < nodeList.Count(); nodeIndex++)
                {
                    CtlNodeBaseModel node = nodeList[nodeIndex];
                    try
                    {
                        string reStr = "";

                        if (!node.NodeEnabled)
                        {
                            continue;
                        }
                        //if (node.NodeID == "12134")
                        //{
                        //    Console.WriteLine("{0} S1", node.NodeName);
                        //}
                        if (!node.ReadDB2(ref reStr))
                        {
                            continue;
                        }

                        //if (node.NodeID == "12134")
                        //{
                        //    Console.WriteLine("{0} S2", node.NodeName);
                        //}
                        if (!node.ExeBusiness(ref reStr))
                        {
                            continue;
                        }
                        //if (node.NodeID == "12134")
                        //{
                        //    Console.WriteLine("{0} S3", node.NodeName);
                        //}
                        if (!node.NodeCmdCommit(true, ref reStr))
                        {
                            continue;
                        }

                        //if (node.NodeID == "12134")
                        //{
                        //    Console.WriteLine("{0} S4", node.NodeName);
                        //}
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(node.NodeName + ex.ToString());
                        node.ThrowErrorStat(ex.ToString(), EnumNodeStatus.设备故障);
                    }
                }
                //if (!SysCfg.SysCfgModel.SimMode && SysCfg.SysCfgModel.PlcCommSynMode)
                //{
                //    lastPlcStat = plcRW.PlcStatCounter;
                //}

                //if (threadID == 1)
                //{
                //    Console.WriteLine("线程:" + threadID + "循环结束");
                //}
            }
        }