Default Transmission Delay Model (dpt_txdel)
This section describes the functionality and implementation of the default model occupying stage zero of the Point-to-Point Link Transceiver Pipeline. This model is named dpt_txdel. Source code is provided in the file dpt_txdel.ps.c, which resides in the <reldir>/models/std/links directory. An alternate version of this stage, for networks using background utilization, is in the file dpt_txdel_bgutil.ps.c.
Invocation Context
The Transmission Delay Model is invoked by the Simulation Kernel immediately upon the start of a packet transmission. This is computed independently for each new packet transmission, and represents the simulated time interval which the transmitter requires to completely process and transmit the packet.
The result of the Transmission Delay Model invocation for each packet is one double-precision floating-point value which represents the transmission delay for the packet. The Simulation Kernel expects that this result will be placed in the packet's OPC_TDA_PT_TX_DELAY transmission data attribute. The returned value is used in scheduling events in the packet transfer across the link, namely, the end of transmission in the source node, and the end of reception in the destination node.
Transmission Delay Computation
For all transmitted packets, dpt_txdel computes the transmission delay based on the channel data rate and the length of the packet.
dpt_txdel calls the op_td_get_int() Kernel Procedure to obtain the object ID of the transmitter channel which is forwarding the transmission. This object ID is then used when calling the op_ima_obj_attr_get() Kernel Procedure to obtain the transmitting channel's data rate.
The Kernel Procedure op_pk_total_size_get() is used to obtain the packet's length. The transmission delay is then calculated as the packet length divided by the transmitter channel data rate. This result is assigned to the packet's OPC_TDA_PT_TX_DELAY transmission data attribute for use by later pipeline stages and the Simulation Kernel. These operations are shown in source code form in the following figure.
Figure 10: Source Code for Pipeline Procedure dpt_txdel
/* dpt_txdel.ps.c */
/* Default transmission delay model for pt-to-pt link Transceiver Pipeline */
/**********************************/
/* Copyright (c) 2013 */
/* Riverbed Technology, Inc. */
/* All Rights Reserved. */
/**********************************/
#include "opnet.h"
#if defined (__cplusplus)
extern "C"
#endif
void
dpt_txdel (Packet * pkptr)
{
Objid tx_ch_obid;
OpT_Packet_Size pklen;
double tx_drate, tx_delay;
/** Compute transmission delay associated with a **/
/** packet transmission on a point-to-point link. **/
FIN (dpt_txdel (pkptr));
/* Obtain object id of transmitter channel forwarding transmission. */
tx_ch_obid = op_td_get_int (pkptr, OPC_TDA_PT_TX_CH_OBJID);
/* Obtain the transmission rate of that channel. */
if (op_ima_obj_attr_get (tx_ch_obid, "data rate", &tx_drate) ==
OPC_COMPCODE_FAILURE)
op_sim_end (
"Error in point-to-point transmission delay pipeline stage (dpt_txdel):",
"Unable to get transmission rate from channel attribute.",
OPC_NIL, OPC_NIL);
/* Obtain length of packet. */
pklen = op_pk_total_size_get (pkptr);
/* Compute time required to complete transmission of packet. */
tx_delay = pklen / tx_drate;
/* Place transmission delay in packet transmission data attribute. */
op_td_set_dbl (pkptr, OPC_TDA_PT_TX_DELAY, tx_delay);
FOUT
}