Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DigitalWaveform simulation

I'm writing a program to simulate the output of our data acquistion system and am having some trouble getting the Digital Input signals to display in the TDMS File Previewer that ships with LabVIEW.  I have successrully simulated the other sensors, but I cannot get this one to work.  Here's the code snippet:

 

                           

                            DigitalWaveform awTemp = new DigitalWaveform(tmpSampleCount, 1);

                            /** set the timing information for the digital waveform **/
                            TimeSpan waveformTimeSpan = new TimeSpan(10);

                            awTemp.Timing = WaveformTiming.CreateWithRegularInterval(waveformTimeSpan);

                            channels[j].AppendData<bool>(GenerateBoolTestSignal(tmpSampleCount));

 

The function GenerateBoolTestSignal simply populates a boolean array with either a 1 or zero depending of the random number is divisible by 5 or not.  Does anyone have an idea what could be wrong?

0 Kudos
Message 1 of 3
(3,562 Views)

Hi Nowellj,

 

I'd like a bit more information on what problem you are running into. Are you able to graph this simulated data successfully in Visual Studio, but then when opening the file in LabVIEW TDMS viewer it shows no data, or can you see data but it is not what you expect?  Are you able to visualise the data in Visual Studio at all? Also, what differences exist between this code and the working code for the other sensors? I look forward to your response!

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 2 of 3
(3,529 Views)

Al b,

 

I haven't tried to visualize it in VS.  I have parsed through the TDMS file to make sure the Boolean channels are even there and if they contain data, and they do.  Is this a limitation of the LabVIEW TDMS viewer?  I know the graph and the data tables say "Analog", but surely they are capable of reading digital data as well.

 

In my program, I've classified the sensors into 3 TDMS Data Types, Double (used for 4-20mA, 0-10V, etc), Int16 (used for just "raw" discretized data), and Boolean (used for digital input simulation).  The Double data type simulation uses the SineWave library to generate a sine wave signal and then save it into the channel.  Int16 datatypes use a random number casted to a short and bound it between an upper limit and a lower limit that the user specifies.  Finally, the digital simulation uses a random number and checks if its divisible by 5, if it is the value is true, false otherwise.

 

All of the functions that generate the sample values return arrays of the correct datatype.  Like I said earlier in this post, I can see the data if I parse out the TDMS file, but it won't show up in the TDMS viewer.  I'm very confident the data is there, I just can't see it.

0 Kudos
Message 3 of 3
(3,527 Views)