[USRP-users] Zmq buffer and complex samples
marcus.mueller at ettus.com
Thu Oct 1 10:03:36 EDT 2015
the ZMQ blocks just instruct ZMQ to send the data that GNU Radio gives
them (if you activate sending of tags, then there will also be a
header); nothing magical happens. Since ZeroMQ takes all the "boring"
socket-style work off the sender (ie. you just tell ZMQ to send the
requested amount of data), the ZMQ blocks can simply send whatever input
is present when GNU Radio calls the Pub_sink's work() function.
> Firstly: How can I define the communication buffer of ZMQ connection
Not at all; that's business of ZMQ and the ZMQ blocks. Point is here
that GNU Radio works on a "there's as much work to be done as there's
work to be done" model: It might call a block's work() function with
e.g. 64 samples if that's how much the upstream block produced, or it
might call it with 4000 samples, if that's how much there is (produced +
left over from previous calls). ZMQ is flexible with respect to packet
sizes, so the ZMQ sinks always take all the samples GNU Radio offers
them, and sends them.
> how can I understand how many samples are sent through each send command?
On the receiver side: Divide the number of bytes you receive by the byte
size of one sample.
On the sender side (pub_sink):
It's simply the number of available input items.
> Does ZMQ send first the real part and then the imaginary one?
ZMQ doesn't "know" what it's sending. It's just transmitting the bytes
that are in the GNU Radio buffer; the complex sample format in GNU Radio
is float32 real0, float32 imag0, float32 real1, float32 imag1,...
On 01.10.2015 15:41, Giovanni MARINO via USRP-users wrote:
> I am trying to set a connection between an USRP N210 and matlab by
> using ZMQ PUBSUB paradigm (i.e. the USRP is the server and matlab the
> client). In doing so, I am writing a MEX code for the API between
> GNURADIO ZQM_PUBSUB and my matlab function, but I have not been able
> to understand yet how ZMQ_PUBSUB works in GNURADIO. Firstly: How can I
> define the communication buffer of ZMQ connection? The documentation
> of GNURADIO does not explain how to set it (i.e. is Vec Length the
> number of array elements which are actually sent into the ZMQ socket?
> If not how can I understand how many samples are sent through each
> send command?) Since I am working with IQ samples, how does ZMQ send
> them? Does ZMQ send first the real part and then the imaginary one? Do
> you have any info or example which I can study?
> Thank you in advance
> Kind regards
> Giovanni Mairno
> USRP-users mailing list
> USRP-users at lists.ettus.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the USRP-users