op_td_set_dbl()
Abstract
Assigns a double value to the specified transmission data attribute.
Syntax
op_td_set_dbl (pkptr, tda_index, value)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
pointer to the packet-of-interest [This KP must be invoked within the context of a Transceiver Pipeline stage. In this context, the packet-of-interest is the packet that is passed into the stage procedure as an argument.] |
tda_index |
int |
numeric index of the transmission data attribute-of-interest. The TDA must be a double. [This value is an integer code which specifies the transmission data attribute to be accessed. Predefined values for this argument appear in “Transmission Data Attribute“ on page 28. User-defined transmission information can be assigned to any attribute index greater than the largest index occupied by a predefined attribute. The largest predefined attribute indices are OPC_TDA_PT_MAX_INDEX (for the point-to-point pipeline), OPC_TDA_BU_MAX_INDEX (for the bus pipeline), and OPC_TDA_RA_MAX_INDEX (for the radio pipeline).] |
value |
double |
value to assign to the specified transmission data attribute |
Return Type
void
No return value.
Example
Excerpt from: example model (models/std/base); pipeline model (dra_ber).
/* Determine current value of Signal-to-Noise-Ratio (SNR). */
snr = op_td_get_dbl (pkptr, OPC_TDA_RA_SNR);
/* Determine address of modulation table. */
modulation_table = op_td_get_ptr (pkptr, OPC_TDA_RA_RX_MOD);
/* Determine processing gain on channel. */
proc_gain = op_td_get_dbl (pkptr, OPC_TDA_RA_PROC_GAIN);
/* Calculate effective SNR incorporating processing gain. */
eff_snr = snr + proc_gain;
/* Derive expected BER from effective SNR. */
ber = op_tbl_mod_ber (modulation_table, eff_snr);
/* Place the BER in the packet's transmission data. */
op_td_set_dbl (pkptr, OPC_TDA_RA_BER, ber);
Details
Transmission data attributes are used to convey link modeling data between the Simulation Kernel and successive Transceiver Pipeline stages. The Td package KPs provide primitive operations (set and get) for operating on transmission data attributes. The basic format of a Pipeline stage model is a C file which contains a single function with the same name (for instance, the base Pipeline stage model dra_power is stored in the file dra_power.ps.c, and is implemented as the C function dra_power()). In most stages, the single argument of the function is a pointer to the packet on which the stage operates. The statements in the C function generally perform the following sequence of activities:
- Extract attributes from the packet’s transmission data (via the KPs op_td_get_dbl(), op_td_get_int(), op_td_get_int64(), and op_td_get_ptr()).
- Perform calculations which characterize the corresponding stage of the link model (typically a combination of numerical and symbolic processing).
- Assign newly computed attributes to the packet’s transmission data (via the KPs op_td_set_dbl(), op_td_set_int(), op_td_set_int64(), and op_td_set_ptr()).
Purpose
Provides a mechanism to assign a value to an attribute of the transmission data which is associated with each packet passing through the stages of the Transceiver Pipeline of a link model. This KP is used to assign a single double attribute value within the specified packet’s transmission data block.
Errors
- Recoverable Error:
<type>TDA (<name>) cannot be set using 'op_td_set_dbl'. - Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
- Program Abort: KP cannot be called from process context.
- Program Abort: Packet pointer is NIL.
- Program Abort: Packet pointer references destroyed packet (
<pk_id>). - Program Abort: Read-only TDA (
<tda_name>) cannot be assigned in (<pk_id>). - Program Abort: Tda index (
<tda_index>) is out-of-range for packet (<pk_id>). - Program Abort: Tda (
<tda_name>) is unassigned in packet (<pk_id>).
Reference
- Use the KP op_td_set_int() or op_td_set_int64() to assign the value of an integer transmission data attribute
- Use the KP op_td_set_ptr() to assign the value of a pointer transmission data attribute
- Use the KP op_td_get_int() or op_td_get_int64() to obtain the value of an integer transmission data attribute
- Use the KP op_td_get_dbl() to obtain the value of a double transmission data attribute
- Use the KP op_td_get_ptr() to obtain the value of a pointer transmission data attribute