Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Improve serial write / read time on TSI gauge


I am using a TSI model 4140 flow meter that provides data via a serial connection.  TSI provides a neat little (standalone) utility that allows recording of continuous flow data up to the maximum capabilty of the gauge of 1 reading per ms.  So I can collect 1000 readings per second in real time with this for pretty much as many seconds as needed.

 

The port settings of the gauge are 38.4k baud [N81]. 

 

When I use the Labview VISA Serial vi's to perform this operation, it takes 9-10 seconds to collect the same 1000 readings.  Basically, I send a command to the serial port (flow meter) as shown:  DCFxx1000   wire in a read delay, query the # of bytes at the port, and then read those bytes to obtain my readings.  If my read delay is not long enough, I will receive less than the requested 1000 data readings.

 

Since the TSI utility can ready real time with no delays, I do not understand why the VISA vi's take so long to collect the data.   If I want four seconds of data (4000 readings) I would expect to obtain it in 4 seconds or so yet with my current vi configuration, it would take more than 40 seconds.

 

Any thoughts on how to speed this up would be most apreciated.

 

Thanks.....    Doug

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 1 of 5
(3,813 Views)

Are you using the same command as their application?

 

Perhaps they are set up to send a command which tells the unit to continue sending data until told to stop.

 

 

0 Kudos
Message 2 of 5
(3,810 Views)

Doug,

 

It would help if you posted the VI you are using to communicate with the gauge. Also include some typical data messages and the resulting values.  It is hard to troubleshoot from a few sentences of description.

 

1. At 38.4 kilobaud the device is sending fewer than 4 characters per millisecond.  What is the data format sent by the instrument?

2. To read continuously at that rate a parallel loop architecture may be your best choice.  In the read loop just read all available bytes and enqueue them (no delays, no bytes at port). Repeat.  In the other loop dequeue the data and append it to a string in a shift register.  Extract the appropriate segments of that string to decode and convert to the flow data.

 

Lynn

0 Kudos
Message 3 of 5
(3,789 Views)

Several other fires and priorities have pulled me away from this fire but I did want to close the loop on this.  I have received updated code from TSI that reveals optional methods of reading the data real time from their meters.  While I have not had the opportunity to perform trials with the newer routines, I do suspect I will be able to dramatically improve my read time.

 

That being the case, I will let this topic close for now and if I have continued issues after working with the new stuff, I will re-open the topic and attach code as suggested.

 

Thanks for the feedback

 

Doug

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 4 of 5
(3,756 Views)

We use the same meters here.  Great little devices.

 

If you're not using binary mode, switch to that (DBFTPxxxx).  Meter sends less characters for the same data.

 

The data transfer's going to be the slowest operation for the meter - it can take/buffer data faster than it can send it. 

 

If there's some short duration of flow that you want to capture at a higher sample rate, synchronize the meter with that event (we use it for a pump run) and buffer the data on the meter then bring it into LabView.  For continuous flows, you can usually up the averaging time to get live data. 

 

Post the VI you're using to capture the data.  I suspect there's something in there adding delay.

0 Kudos
Message 5 of 5
(3,749 Views)