rmind = fmod (Simulator::Now ().GetNanoSeconds () , slot_time ); //my slot should be in nano scale
if (rmind == 0 ){
//if (rmind < (0.1*slot_time) || rmind > (0.9*slot_time) ){
phy->StartTx (p); //sending to the physical layer
NS_LOG_FUNCTION (this <<"now:"<<Simulator::Now ().GetNanoSeconds () << "reminder" << rmind);
if (m_queue.size () > 0) //if still there is packet(s) in the queue then start to send the next packet
{
double backoff = rand () % 100000;
Simulator::Schedule (PicoSeconds (backoff), &BackoffBasedNanoMacEntity::DoSendPacket, this); //sending the next packet
}
}
else {
Simulator::Schedule (NanoSeconds (slot_time - rmind), &BackoffBasedNanoMacEntity::call_StartTx , this , phy , p ); //wait for the beginning of next slot.
}
}
but unfortunately i got more packet loss . could you please tell me whats wrong with my code ?
do you think i need a small interval to determine the beginning of slot?(like the second "if" that is commented ) or not...
if so , what should be its boundries?
best regards