Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Timestamp from AnalogWaveform

Hi,

 I'm using Visual Studio 2015 and Measurement Studio 2015. I'm having problems when using the WaveformAttributeMode on a Stream so that I can read the time samples along with the data. When the program gets to the line below, I get the error "Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property"

 

myTask.Stream.WaveformAttributeMode = WaveformAttributeModes.Timing

 

I am using VB.Net for this program. The full error is attached. All of the code is taken from a NI example (ContAcqVoltageSamples_IntClk.2013) besides this line. I couldn't find any examples using VB.Net that had time sampling with the data. Any help would be appreciated.

Thanks

0 Kudos
Message 1 of 8
(3,230 Views)

Fixed this, found out it was another issue with custom scales. Still have problems getting a timestamp with the data though.

0 Kudos
Message 2 of 8
(3,172 Views)

Hey curt99,

 

What issue are you having getting your timestamp?

 

Cheers,

Ryan C.

0 Kudos
Message 3 of 8
(3,163 Views)

Hey Ryan,

 I am using the TDMS logging to capture AI data. Currently using the ConfigureLogging method. This captures all the data fine except the time stamp data. I thought by setting the WaveformAttributeMode to Timing would automatically give me the timestamp for the data and it's not. Is there example code in vb.net that I could look at to see how this is done? I started looking at creating a Tdms Channel Group and Tdms Channels. I thought this would be a pretty simple task to do.

Thanks

Curt

0 Kudos
Message 4 of 8
(3,154 Views)

Hey curt99,

 

If you haven't seen the introductory guide, this has some pretty good examples to use to get started:

 

http://www.ni.com/white-paper/8032/en/

 

As for the timing information, it should come back as the Timing property of your AnalogWaveform object. The AnalogWaveform object is returned when you use the ReadWaveform method. Take a look at this API documentation for some more details:

 

http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/f909a16a/

 

If you're not using any of those methods, could you post some of your code? There are multiple ways to do things, so if yours is different, I'd like to see.

 

Cheers,

Ryan C.

0 Kudos
Message 5 of 8
(3,139 Views)

Hey Ryan,

 Please see attached. I sent it as a reply in e-mail yesterday without thinking that it wouldn't go to you. This is the main body of code. Any help/suggestions would be appreciated.

Thanks

Curt

0 Kudos
Message 6 of 8
(3,131 Views)

Hey curt99,

 

From our API documentation I linked in my last post, you should be able to get the timing information from the AnalogWaveform object (which is the object "data" in this case). Try something like this:

 

WaveformTiming timing = data.Timing;

Then you can use the API documentation for WaveformTiming to get things like the start time and the sample interval:

 

http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/843e302b/

 

Cheers,

Ryan C.

0 Kudos
Message 7 of 8
(3,127 Views)

Hi Ryan,

 I must be interpreting something wrong or explaining my issue poorly. In the NI-DAQms.Net Class Library Help, it is stated that " Each AnalogWaveform<TData> returned represents one channel and may contain timing information or extended properties, depending on the value of the WaveformAttributeMode property on the DaqStream class." I set the WaveformAttributeMode property to Timing and ExtendedProperties on the DaqStream. Would this "timing" information be the time stamp for the read? If so, this is the data I want in the TDMS file. I want the file to look like:

Time Stamp |  Channel 1 | Channel 2 | etc.

 I thought by turning on the timing, I would get the time stamp along with the data and this would be written directly into the TDMS file by using ConfigureLogging. Do you have an example of how this could be done?

Thanks

Curt

0 Kudos
Message 8 of 8
(3,124 Views)