From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Daqmx clear buffer

Hello,

    I have a client/server apps i am building. The server has two features cDAQ and waveform generator.  the server it goes to the waveform generator as a default mode intentionally.  The client sends the command to change server from cDAQ to waveform. If i turn on the server it goes in waveform mode and collect data until the client tells it to switch. When I turn on the client in cDAQ mode, you see the waveform data first then youo get the cDAQ data. I was wondering if there is a way I can clear the buffer in the server once the client is on before it writes the data to the client.  If run the code succesfully, you will notice the issue. The same thing would happen if I set the server to run first in Cdaq mode. Once I turn on the client in waveform mode, I will get cdaq data first the once the server receives the packet from the client i then get waveform data. You will notice a delay when the server switch from waveform to Cdaq.

Suggestions are welcome. 

client name is: Mockup Client.vi

server name is: NEW SERVER1.vi

control type def is ALL data control.ctl

Im using a cdaq9172 with 5 NI cards. the server is programmed to run like that only

 

Admin Note - VIs removed per user's request.

0 Kudos
Message 1 of 11
(4,680 Views)

So are you looking for a method of flushing the Queue buffer?  If so, there is a function called Flush Queue palette that will remove all existing elements in the queue when called.  Here's the LabVIEW Help entry for that function:

 

http://zone.ni.com/reference/en-XX/help/371361L-01/glang/flush_queue_vi/

 

If that wasn't the operation you were looking for, what buffer are you referring to?

Cody A.
0 Kudos
Message 2 of 11
(4,620 Views)

Well, I tried to open your Zip file and open the Project to see what you were trying to do.  However, there were so many missing VIs that I "gave up" (because I couldn't be sure where the problem was nor what you were trying to do).  Can you put together a simple, complete (demo) Project?

 

BS

0 Kudos
Message 3 of 11
(4,589 Views)

The only missing files are not need to run the software.  look in the zipfiles and run the the mockup client.vi and the newserver1.vi all the subvis will be in the zipfiles.

0 Kudos
Message 4 of 11
(4,552 Views)

I tried to use the flush queue it didnt work at all..  my goal is to run the server and once the client is on.  Before the server writes to the client, it should clear the buffer containing all the data that was collected before when the client wasnt on. That way all the future data will be data collected after the server has recieved commands from the client.

0 Kudos
Message 5 of 11
(4,551 Views)

What do you mean "flush queue didn't work at all"?  Was it not the operation you were looking to perform?

 

Perhaps I'm not clear on what buffer you are referring to.  After taking a quick look at your code, I thought you were talking about the queue that transfers data from one loop to the other.  Are you referring to a different buffer?

Cody A.
0 Kudos
Message 6 of 11
(4,516 Views)

@ritch_by_nature wrote:

The only missing files are not need to run the software.  look in the zipfiles and run the the mockup client.vi and the newserver1.vi all the subvis will be in the zipfiles.


Well, I made the mistake of opening the Project.  Mockup Client is there, and cannot be run as it has the following errors:  Type Definition Background not found or contains errors, Save Data Plate Test is missing, and Channel Config Path is not executable.  The latter has the error configurefileDmass is missing.

 

I didn't find NewServer1 at all in the Project, but I did find it sitting in the Zip file.  Trying to open it gives Type Definition Background missing, Type Definition Data missing.  So forget about "run the software".

 

If you are not willing to help those who are trying to help you by providing a smaller complete code that we can actually execute, can you at least tell us clearly what you are trying to do?  There's a lot of code here, we cannot execute it and see what it does, but you can tell us what you want it to do.  But you have to say more.  Take us through the basic steps that the Server runs (I presume that is running "all the time" on the CompactDAQ system, right?) and the intended action of the Client.  Include such things as how the client and server establish communications with each other (it looks like you are using raw TCP/IP, instead of Network Streams).  Is the Client supposed to control the Server, and also accept data from the Server?  Describe briefly the protocol you are using for Client/Server communication (I don't mean "I use TCP/IP", but rather describing the nature of the data path from client to server and server to client, are there separate paths for Data and Control?, and "who is in charge").

 

As an example, I've got a Client/Server system using LabVIEW Real-Time (running on a PXI-based chassis).  There are four Network Streams established, two for sending Messages (Control) from Host to Remote (PXI) and from Remote to Host, one for sampled data (multiple channels, typically at 1KHz), and one for "events" (time-stamped, occasional data).  The Host sends commands (such as "Start/Stop") to the Remote, but once acquisition starts, the Remote controls all of the timing.  Note that if the Remote is always streaming data to the Host, you need to also send "Status" information so that the Host knows when the Remote has actually started (because the two machines are running asynchronously, and the Remote is in charge of the clock).

There are several ways to do this, including bundling the Status data in the sampled data stream.

 

BS

0 Kudos
Message 7 of 11
(4,496 Views)

Here's a better project file for the project. 

In my server, i used state machine in the consumer loop. That way when it check to see if a client is online. it goes to flush queue state and flush all the data. when the client is online it goes to the sedn data state and write data to the client. but I still get the bogus data that was supposed to be flushed.

Please help. I attached a file with all the Vis needed

 

Admin Note - VIs removed per user's request.

0 Kudos
Message 8 of 11
(4,494 Views)

thanks for replying and I apologize. I attached a copy of the porject for you. This should work now

 

Admin Note - VIs removed per user's request.

0 Kudos
Message 9 of 11
(4,492 Views)

Did you get to run it by chance?

0 Kudos
Message 10 of 11
(4,470 Views)