public synchronized boolean enque(Packet pnp)
    {
        double pb;
        double avgQueueSize = avgQueueSize();

        //System.out.println(super.get_name() + ": enque. MIN_TH: " + MIN_TH);

        if ((MIN_TH <= avgQueueSize) && (avgQueueSize < MAX_TH))
        {
            // when the avgQueueSize is between the thrsholds, then calculate the dropping probability
            COUNT++;

            pb = C1 * AVG - C2;

            if ((COUNT > 0) && (COUNT >= R / pb))
            {
                dropPacket(pnp);

                return true;
            }
            else if (COUNT == 0)
            {
                R = random.nextInt(2); // 2, because the interval is [0,1]
            }

            checkAndInsertPacketIntoQueue(pnp); /// insert the pkt into the queue
            return true;
        }
        else if (avgQueueSize >= MAX_TH)
        {
            // if the avgQueueSize is greater than the max threshold, then drop the packet.
            // If it's a control packet, then the sim will get stopped.
            dropPacket(pnp);
            COUNT = -1;

            return true;
        }
        else
        {
            COUNT = -1;
            checkAndInsertPacketIntoQueue(pnp); /// insert the pkt into the queue
            return true;
        }
    } // public synchronized boolean enque(Packet pnp)