As mentioned, the stream-to-message-passing gr-eventstream approach is
right for you.

Best regards,
Marcus

On 10/29/2015 01:47 PM, s.subrata...@gmail.com wrote:
> Thank you Marcus. I am trying to simulate a network with 2 transmitters and 
> one receiver. The TX's transmit streams at random times and the RX receives 
> the sum of the signals from both the TX's. The adder block however doesn't 
> give any output when one of its input stream is empty (i.e. when both the 
> inputs are not available at the same time) . That's why I'm trying to create 
> an intermediate block for each TX that takes in an input and outputs zeros if 
> the input is empty. This way the adder block would always have something to 
> add. Thanks.
>
> Subrata
>
>> On Oct 28, 2015, at 17:36, Marcus Müller <marcus.muel...@ettus.com> wrote:
>>
>> Hi Subrata,
>>
>> while what you plan to do is possible if you build a block with a
>> general_work method and a forecast. In fact, here the forecast
>> implementation will probably be pretty crucial, but also be pretty
>> simple -- just always require the same amount of samples from input0 as
>> you're asked to produce output, and don't require anything from input1.
>>
>> However, I'm pretty certain GNU Radio won't schedule your block as you
>> want to (in fact, I just wrote a minimal test case to verify[1]).
>>
>> My general recommendation would be to write a minimal block that takes a
>> stream and converts it to messages, and passes those to
>> gr-eventstream[2]. gr-eventstream has blocks to do exactly that: produce
>> a zero-signal when there's no (message) input, produce the content of
>> the message input otherwise; you could just take that output and add it
>> to your input1, and be done :)
>>
>> Best regards,
>> Marcus
>>
>>
>> [1] https://github.com/marcusmueller/gr-demo_assymetric_input clone, and
>> run ./qa_prioritizer.py in the python/ folder
>> [2] http://oshearesearch.com/tag/gr-eventstream/
>>> On 28.10.2015 21:26, s.subrata...@gmail.com wrote:
>>> I am trying to create a block that has two input and one output. Its like a 
>>> priority multiplexer; if input0 is empty then output = input1 else output = 
>>> input0 ( input0 always has samples) its a stream based block. 
>>> How do I declare the work function, because the number of samples needed 
>>> from each input to produce noutput_items depends on whether input0 is 
>>> empty. 
>>> Any help in the general work function is also greatly appreciated.
>>>
>>> Thanks
>>> _______________________________________________
>>> Discuss-gnuradio mailing list
>>> Discuss-gnuradio@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to