Stage 12: Error Allocation
The error allocation stage is the thirteenth stage of the radio transceiver pipeline, and is specified by the “error model” attribute of the radio receiver. It is always executed immediately upon return from the bit error rate stage. The purpose of the error allocation stage is to estimate the number of bit errors in a packet segment where the bit error probability has been calculated and is constant. This segment might be the entire packet, if no changes in bit error probability occur over the course of the packet’s reception. Bit error count estimation is usually based on the bit error probability (obtained from stage 11) and the length of the affected segment.
The Simulation Kernel requires that the error allocation stage procedure accept a packet address as its sole argument. The Kernel maintains only a bit error accumulator TDA within the packet; therefore, the pipeline stage is expected to add the number of new errors into the existing value found in the integer TDA represented by the symbolic constant OPC_TDA_RA_NUM_ERRORS. The added value should be between zero and the number of bits in the affected packet segment. In addition, the Kernel expects the error allocation stage to provide the empirical bit-error-rate over the packet segment; this value is obtained by dividing the number of bit errors in the segment by the size of the segment. The empirical bit error rate should be placed in the double-precision TDA represented by the symbolic constant OPC_TDA_RA_ACTUAL_BER. The Kernel uses this value to update the bit error rate result of the receiver channel object. Syntax requirements for the error allocations stage are specified in Figure 99.
Figure 99: Templates for Radio Transceiver Pipeline: Error Allocation Stage
Not MT-safe (will execute sequentially in a parallel simulation):
void
err_alloc_template (Packet* pk)
{
int num_added_errs, segment_length;
double empirical_ber;
FIN (err_alloc_template (Packet* pk))
/* extract required information from packet. */
/* perform calculation of number of bit errors in segment. */
/* Add errors to bit-error accumulator. */
op_td_increment_int (pk, OPC_TDA_RA_NUM_ERRORS, num_added_errs);
op_td_set_dbl (pk, OPC_TDA_RA_ACTUAL_BER,
num_added_errs / segment_length);
FOUT
}
MT-safe (can execute in parallel in a parallel simulation):
void
err_alloc_template_mt (OP_SIM_CONTEXT_ARG_OPT_COMMA Packet* pk)
{
int num_added_errs, segment_length;
double empirical_ber;
FIN_MT (err_alloc_template (Packet* pk))
/* extract required information from packet. */
/* perform calculation of number of bit errors in segment. */
/* Add errors to bit-error accumulator. */
op_td_increment_int (pk, OPC_TDA_RA_NUM_ERRORS, num_added_errs);
op_td_set_dbl (pk, OPC_TDA_RA_ACTUAL_BER,
num_added_errs / segment_length);
FOUT
}