From: Activecat [[email protected]]
Sent: 04 June 2014 15:39
To: David Halls
Cc: [email protected]
Subject: Re: [Discuss-gnuradio] Scheduling a block even with no input
items RE: Flow graph blocking when doing 2x1 transmission
On Wed, Jun 4, 2014 at 10:25 PM, David Halls
<[email protected]mailto:[email protected]>
wrote:
Yes, there are 3. The Source Tx, the Relay Tx, and the Relay Rx.
To clarify,
i). the “Source Tx” USRP may or may not receive data at any time
interval.
ii). the “Relay Tx” USRP transmit data only when the “Source Tx” USRP
receive data, and there is a delay due to signal processing
iii). the “Relay Rx” USRP will receive data only when the “Relay Tx”
USRP transmit it,
is this correct?
Not quite…
i). the “Source Tx” USRP has a constant stream of data, and is
constantly transmitting. If the codewords in the file are exhausted it
repeats.
ii). the “Relay Tx” USRP transmits data only when data has been received
by the “Relay Rx” (I will use tx_time to control when the received burst
is re-transmitted)
iii). the “Relay Rx” USRP will receive data only when the “Source Tx”
USRP transmits (section where Relay Tx’s too will be ignored),
I have changed the block you suggested, to avoid inserting 0’s mid
burst.
void
avoid_block_impl::forecast (int noutput_items, gr_vector_int
&ninput_items_required)
{
ninput_items_required[0] = noutput_items;
ninput_items_required[1] = 0;
}
int
avoid_block_impl::general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in0 = (const gr_complex*)
input_items[0];
const gr_complex in1 = (const gr_complex)
input_items[1];
gr_complex out0 = (gr_complex) output_items[0];
gr_complex out1 = (gr_complex) output_items[1];
//if(DEBUG) fprintf(stderr, " noutput_items = %d,
ninput_items[0] = %d, ninput_items[1] = %d.\n", noutput_items,
ninput_items[0], ninput_items[1]);
// For first input, just copy
for (int i=0; i < noutput_items; i++)
out0[i] = in0[i];
// Count number of output items
int num_out1 = 0;
// If items available for second input, copy
for (int i=0; i < ninput_items[1]; i++)
{
out1[i] = in1[i];
if(!d_burst)
{
if(DEBUG) fprintf(stderr, " Entering
burst…\n");
d_burst = true;
}
// Number of (actual) items tx’d this call
num_out1++;
// Total number of items in burst transmitted so
far
d_items_sent++;
}
// For the rest of second output, fill with zeros
if(!d_burst)
{
for (int i=ninput_items[1]; i < noutput_items ;
i++)
{
// Fill zeros
out1[i] = 0.0;
// Number of (zero) items tx’d this call
num_out1++;
}
}
// Mark end of burst
if(d_items_sent >= 1280*6) //TODO change to external
burst length parameter
{
if(DEBUG) fprintf(stderr, " Finishing
burst…\n");
d_burst = false;
d_items_sent = 0;
}
consume( 0, noutput_items);
consume( 1, ninput_items[1]); // Consume all available
items
produce( 0, noutput_items);
produce( 1, num_out1); // Only produce the required
number of items
return WORK_CALLED_PRODUCE;
}
NOTE: The information in this email and any attachments may be
confidential and/or legally privileged. This message may be read, copied
and used only by the intended recipient. If you are not the intended
recipient, please destroy this message, delete any copies held on your
system and notify the sender immediately.
Toshiba Research Europe Limited, registered in England and Wales
(2519556). Registered Office 208 Cambridge Science Park, Milton Road,
Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl