LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing and Plotting Data from a Measurement File

1.  If you turn on context help and hover over a wire, it will give you the structure of the data within the wire.

2.  If you need to create a constant of that datatype, rather than trying to create is from scratch, right click on the wire of the datatype you want and select Create Constant.  Then you can move that constant to wherever you want such as connecting it to the obtain queue function to define the datatype of that queue.

0 Kudos
Message 11 of 52
(1,258 Views)
Okay, I've developed a portion of my program in a producer/consumer arrangement.   Right now, it is cyling the 13 valves and displaying the real time data on the front panel succesfully.  However, whenver I press the stop button I am receiving the Error 0 which says that LabVIEW is having trouble connecting to a GPIB driver or device, and the measurement file in the consumer loop is never created. What do I need to do to correct this?
Download All
0 Kudos
Message 12 of 52
(1,232 Views)

A few quick tips:

1.  Always give a label to any control or indicator, and make the label visible on the block diagram terminal.  Your Stop button has no name, and its label was not shown on the block diagram.  That makes it harder to tell by inspecting the block diagram which control that terminal is associated with.

2.  On your End DAQ tasks, wire the error wire through them rather than branching off of them.

3.  In my opinion, using shift registers on the error wire in a loop will cause more problems.  Just use normal tunnels on the input and output tunnels of the error wires.

4.  When you save your VI, make sure your front panel is relatively neat and the window is large enough to show everything.  It is annoying when trying to help to have to search around the front panel to find widely scattered controls that are out of the windows bounds.

 

Error 0 probably has nothing to do with GPIB since you don't appear to be using any GPIB functions.  It probably has to do with something else.  Error 0 is kind of generic and a mysterious error.  I would recommend that you run the VI with indicators or probes on most of your error wires to try to determine exactly where this error is generated.  The error message you posted doesn't seem to give a clue on that.  I would guess that it is actually some kind of file I/O error, perhaps some sort of file permissions error.  File errors seem to have low value positive numbers, so the number zero is right in that neighborhood.

0 Kudos
Message 13 of 52
(1,221 Views)
Thanks for the tips. I've implemented them into the VI. Sorry about the front panel being all jumbled up.  The error has gone away, and the measurement file is now created. However, only one channel is being written to the file. Is this because the element data type is a constant 0? Do I need to make an array with a constant for each channel that I am measuring?
0 Kudos
Message 14 of 52
(1,214 Views)

Yes.  Because the queue was obtained using a double scalar, only one value of a double representation gets passed.  If you see in the Enqueue function, the blue dynamic wire gets coerced.  It just takes the first value out of that dynamic data.

 

I don't know if you can enqueue the dynamic datatype.  You may need to convert it to either a double array, a waveform, or a waveform array depending on the structure of the data.  The Express palette has some VI's to aid in this conversion.  Whichever is the best datatype for your data, just wire a constant of that datatype to the Obtain queue instead of the double representation zero.

0 Kudos
Message 15 of 52
(1,210 Views)
Okay, I converted the dynamic data into 2D array with the channels being columns, and then converted it back to dynamic data before the Write to Measurement File. VI.  The data is being logged correctly. However, the time stamps in the far left column are not correct. It counts from 0 to approximately 10 in second intervals, and then it repeats itself.  How do I get this to show the correct time stamp?  I've attached the VI along with the measurement file.
Download All
0 Kudos
Message 16 of 52
(1,196 Views)

Try using a 1-D waveform array instead.

 

A 2-D array doesn't contain any timing information, so the T0 and dt times get lost. 

0 Kudos
Message 17 of 52
(1,188 Views)
Okay that works. However, I would like to display the elasped time in the form of a time stamp. How do I do this with the dynamic data? I've tried using the "Get Date/Time String," but LabVIEW will not let me wire it to the signal.
0 Kudos
Message 18 of 52
(1,181 Views)

Elapsed time in the data file?  On the front panel?

 

A time stamp can be converted to a double as well.  It is actually seconds since Jan 1, 1904 or there about.  For elapsed time, just subtract a timestamp from when the VI starts from a current timestamp.

 

Express VI's are great for getting some code up and running quickly, but once you need to customize it some, then you run into problems.  And the Dynamic Datatype is the evil spawn of Express VI's.  I'm not sure anybody really understands its underlying data structure.  You may want to start getting away from Express VI's and the blue dynamic data wires.

 

One way you can learn a lot is by right clicking on and Express VI and selecting "Open Front Panel".  It will turn the blue Express VI into a yellow normal subVI.  Open that up and you see the underlying code.  Note this is a one way conversion.  You can undo it, but if you happen to save your file, you can't go backwards to an Express VI.  You'd have to recreate it from scratch again.

0 Kudos
Message 19 of 52
(1,175 Views)
Okay, I've figured out how to add the time stamp to the data file. However, it is only putting a time stamp once every 0.1666 seconds.  How do I get the time stamp associated with each measurement?
Download All
0 Kudos
Message 20 of 52
(1,161 Views)