Default Propagation Delay Model (dpt_propdel)
This section describes the functionality and implementation of the default model occupying stage one of the Point-to-Point Link Transceiver Pipeline. This model is named dpt_propdel. Source code is provided in the file dpt_propdel.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_propdel_bgutil.ps.c.
Invocation Context
Whenever a point-to-point transmitter initiates a transmission, propagation delay is computed to determine the time required for the packet to reach the receiver in the destination node. The Propagation Delay Model is invoked by the Simulation Kernel to compute this upon the completion of the Transmission Delay Model of the pipeline. The simulation time at invocation is the starting time of the packet transmission. The propagation delay represents the duration separating the time at which the first bit is transmitted from the time at which this same bit is received in the destination node.
The result of the Propagation Delay Model invocation for each packet is one double-precision floating-point value which is the propagation delay for the transmitted packet. The Simulation Kernel expects this result to be placed in the packet's OPC_TDA_PT_PROP_DELAY transmission data attribute.
Propagation Delay Assignment
dpt_propdel's assignment of propagation delay for all transmitted packets is simply the value of the delay attribute of the point-to-point link. Note that this value may change over time because the delay attribute can be dynamically modified as the simulation progresses.
dpt_propdel obtains the object ID of the point-to-point link carrying the transmission from the OPC_TDA_PT_LINK_OBJID transmission data attribute of the packet. This object ID is then used when calling the op_ima_obj_attr_get() Kernel Procedure to obtain the value of the delay attribute of the link. This result is placed in the OPC_TDA_PT_PROP_DELAY transmission data attribute of the packet for later use by other pipeline stages and the Simulation Kernel. Source code for dpt_propdel is shown below.
Figure 11: Source Code for Pipeline Procedure dpt_propdel
/* dpt_propdel.ps.c */
/* Default propagation delay model for pt-to-pt link Transceiver Pipeline */
/* The delay attribute on the link can be either set to "Distance Based" */
/* or to an explicit value (seconds). If set to Distance Based, the delay */
/* between source and destination node will be computed based on distance. */
/**********************************/
/* Copyright (c) 2013 */
/* Riverbed Technology, Inc. */
/* All Rights Reserved. */
/**********************************/
#include "opnet.h"
#include "link_delay.h"
#define DISTANCE_BASED 1E+15
#if defined (__cplusplus)
extern "C"
#endif
void
dpt_propdel (Packet * pkptr)
{
Objid link_objid;
double prop_delay;
/** Compute propagation delay associated with a **/
/** packet transmission on a point-to-point link. **/
FIN (dpt_propdel (pkptr));
/* Obtain object id of link carrying transmission. */
link_objid = op_td_get_int (pkptr, OPC_TDA_PT_LINK_OBJID);
/* Obtain propagation delay associated with that link. */
if (op_ima_obj_attr_get (link_objid, "delay", &prop_delay) ==
OPC_COMPCODE_FAILURE)
op_sim_end ("Error in point-to-point propagation delay pipeline stage "
"(dpt_propdel):", "Unable to get propagation delay from link attribute.",
OPC_NIL, OPC_NIL);
if (prop_delay == DISTANCE_BASED)
{
prop_delay = link_delay (OP_SIM_CONTEXT_PTR_OPT_COMMA link_objid);
}
/* Place propagation delay in packet transmission data attribute. */
op_td_set_dbl (pkptr, OPC_TDA_PT_PROP_DELAY, prop_delay);
FOUT
}