Hello,
As I promised here I come with another Channel question.
I refer to the example project "Channel - Stream.lvproj", and the VI called "Stream with Replicate.vi" (see the snippet below for better following my questions).
- I really like the Replicate function, so we can transmit the same data to two consumers, which was not possible with a single Queue before
- I understand this is a demo example only, so the two consumers are artificially slowed down (Delay, 1, Delay 2 in msec) representing File operations, calculations, etc...
- I am thinking about a real life scenario, and how I would specify the buffer sizes.
- The example states that: "If you are going to have a size limit on the original stream, you will want to put a limit on the replica streams, and vice versa. If you have an unlimited stream on either end and a limited stream on the other, the infinite one will just drain in all the data and you will not have the buffering effect that a size limit normally provides. Because data will move from the original stream to the replicas as fast as possible, the original buffer only needs to be 1 element large. Any other size will be functionally the same as 1 -- still tied to the speed of the consumers."
- If I imagine a real life scenario, like I have a DAQmx Read in the Producer, and it generates a data pack at every 200 msec lets say.
- I do not want the iteration speed of the Producer to be effected by the Consumer loops, so I would specify the buffer size as "1" (as in the example VI) for the Stream Writer. But I would specify it as unlimited buffer for the REplicate.vi, since I want a lossless stream...
- The description says this is not a good idea, because: "If you have an unlimited stream on either end and a limited stream on the other, the infinite one will just drain in all the data and you will not have the buffering effect that a size limit normally provides. "
I think I do not fully understand the working of these Streams with Replicate here. What I try to do, is to use the Stream+Replicate.vi instead of two unlimited buffer sized Queues. So that is why I would set the buffer size unlimited for the Replicate.vi. In this case why I would not have the "buffering effect"? Just to note here, I assume that the Consumer loops ALMOST always faster iterates than the Producer, otherwise obviously I would get the problem of a memory leak with an infinite buffer...
Hmm, actually what the example describes is (theoretically) a lossy Queue, not (unless I set the buffer to a very high value (~size of the RAM as extreme), which I could...)?
If someone could explain these maters to me, thanks very much! Also, how would you setup a DAQmx Producer with two Consumers to work in a lossless way?
ps: Extra question: why "0" represents "unlimited" size for Channel functions? For Queues, the "-1" means unlimited. Does this change has any meaning?