Stage 1: Transmission Delay

The transmission delay stage is numerically the second stage of the radio pipeline, but is the first to be executed on a dynamic basis as the result of a new transmission taking place. It is specified by the “txdel model” attribute of the radio transmitter, and is invoked immediately upon beginning transmission of a packet. This is the only stage for which a single execution is performed to support all pipelines that result from a new transmission (that is, the computation is shared by all resulting pipelines).

This stage is invoked to calculate the amount of time required for the entire packet to complete transmission. This result is the simulation time difference between the beginning of transmission of the first bit and the end of transmission of the last bit of the packet. The Simulation Kernel uses the result provided by this stage to schedule an end-of-transmission event for the transmitter channel that is used to send the packet. When this event occurs, the transmitter can begin transmission of the next packet in the channel’s internal queue, if any are present; otherwise the transmitter channel becomes idle. In addition, the transmission delay result is used in conjunction with the result of the propagation delay stage to compute the time at which the packet completes reception at the link’s destination (that is, the time at which the last bit finishes arriving is the time at which it finishes transmitting added to the propagation delay on the link).

The Simulation Kernel requires that the transmission delay stage procedure accept a packet address as its sole argument. The computed transmission delay is then expected by the Kernel within the TDA represented by the symbolic constant OPC_TDA_RA_TX_DELAY. The assigned value should be a nonnegative double-precision floating-point number. No other results are required. Syntax requirements for this stage are specified in Figure 88.

Figure 88: Templates for Radio Transceiver Pipeline: Transmission Delay Stage

Not MT-safe (will execute sequentially in a parallel simulation):

void
tx_delay_template (Packet* pk)
	{
	double result;

	FIN (tx_delay_template (Packet* pk))

	/* extract required information from packet. */

	/* perform calculation of transmission delay. */

	/* place result in TDA to return to Simulation Kernel. */
	op_td_set_dbl (pk, OPC_TDA_RA_TX_DELAY, result);

	FOUT
	}

MT-safe (can execute in parallel in a parallel simulation):

void
tx_delay_template_mt (OP_SIM_CONTEXT_ARG_OPT_COMMA Packet* pk)
	{
	double result;

	FIN_MT (tx_delay_template (Packet* pk))

	/* extract required information from packet. */

	/* perform calculation of transmission delay. */

	/* place result in TDA to return to Simulation Kernel. */
	op_td_set_dbl (pk, OPC_TDA_RA_TX_DELAY, result);

	FOUT
	}