示例#1
0
        public void CheckNodeStatus() //update node status after combination is completed
        {
            double wt;

            foreach (byte addr in packer.weight_nodes)
            {
                if (NodeMaster.GetStatus(addr) == NodeStatus.ST_LOST || NodeMaster.GetStatus(addr) == NodeStatus.ST_DISABLED)
                {
                    continue;
                }
                //no match case
                NodeMaster.IncMatchCount(addr);
                //over_weight check
                wt = NodeMaster.GetWeight(addr);
                double nw = wt;
                if (nw > (packer.curr_cfg.target * 0.66) && (nw <= WeighNode.MAX_VALID_WEIGHT)) //has overweight
                {
                    if (AlertWnd.b_turnon_alert)
                    {
                        NodeMaster.SetOverWeight(addr, true);
                        if (!AlertWnd.b_manual_reset) //auto reset
                        {
                            NodeMaster.Action(new byte[] { addr }, "empty");
                        }
                    }
                    continue;
                }
                else
                {
                    if ((nw > -1000) && (nw <= WeighNode.MAX_VALID_WEIGHT))
                    {
                        NodeMaster.SetOverWeight(addr, false);
                    }
                }
            }
        }