Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Spectral Measurements via TCP/IP

Hello,
I am trying to put together a simple client/server program that uses the Simulate Signal.vi and Spectral Measurement.vi.

Right now I am using the Simulate Signal.vi on a simple server and Spectral Measurements.vi on a simple client program to test a TCP/IP connection. The client will request the data being simulated on the server and then analyze the simulated signal. My problem is dealing with the proper data types.

Simulate Signal and Spectral Measurement use dynamic data and the TCP/IP uses string data. I have tried to set the properties of the Convert From Dynamic Data on the Simulate Signal to different settings e.g. 1-D array of waveform, 1-D array of double, 1 channel, etc. etc. and tried to do a "reverse" pr
ocess on the client side by converting the string data from the TCP write to different kinds of arrays or setting the Convert To Daynamic Data properties.

If I use the Simulate Signal.vi and Spectral Measurements.vi together on a blank vi, it all works well. In both cases it does display a magnitude but I know the display is wrong when I try to use networking and I am thinking it has to do with how I read the data on the server and write the data to the client from the TCP stream.

I would greatly appreciate any help.

P.S.
I hope this makes sense!
0 Kudos
Message 1 of 8
(4,627 Views)
The reason you are seeing wrong results when using your client/server program is because of the Convert From/To Dynamic Data VIs. When you use these VIs to convert to a 1D array, you lose timing information that is necessary for the Spectral Measurement VI.

You can see this by opening a blank VI, using a Simulate Signal VI, Convert From DDT(1D array of double) VI, Convert To DDT(1D array of double) VI, and finally a Spectral Measurements VI. You will see the same results as your client/server program. The results of your program are independent of the TCP/IP communication.

If you want to be able to use Simulate Signal and Spectral Measurements, you will need to send timing information through the TCP/IP communication as well. You can use the C
onvert From DDT to convert to a waveform, use a Get Waveform Components, and convert each of the elements in the waveform to a string. You will then have to do some string manipulation on both sides of the TCP/IP communication, eventually building a waveform on the client side. Finally, you can send that waveform as an input to the Spectral Measurement VI.

-Alan
Message 2 of 8
(4,620 Views)
I am using datasocket to send data back and forth with dynamic data and spectral measurements; however, how do I rebuild the waveform on the client side if I strictly wish to use TCP/IP?

I have the simulate signal.vi on the server and I am using the get waveform components.vi to get the timestamp, dt, and Y values. I am flattening each of them to a string and then putting them all together using the concatenate string.vi. This output goes to a TCP write vi and is received via the client. Now here is the tricky part I am running into.

I am taking that output of the TCP read on the client side and putting it into three separate unflatten strings.vi and trying to rebuild the waveform. However, only one will work at the same time. In otherwords, if I only have the timestamp being sent on the server side, then the client side receives the correct data. If two or more components are sent over the TCP connection on the server then the only data that I can get to work (display correctly -- I can tell when I use a probe) will be whatever is wired FIRST in the concatenate strings vi. It looks as if the other two components are being chopped off.

Is there something better I can do?
0 Kudos
Message 3 of 8
(4,590 Views)
Hi,

Do make sure that you are reading enough bytes on the client side. If that does not help, please post your VIs so I can take a look at what's goind on.

Regards,
Ankita A.
0 Kudos
Message 4 of 8
(4,577 Views)
Here are my VI's. I must apologize as I do not know how to attach more than one VI per post!
0 Kudos
Message 5 of 8
(4,575 Views)
Part II of my project
0 Kudos
Message 6 of 8
(4,574 Views)
and the last part of my VI.
0 Kudos
Message 7 of 8
(4,573 Views)
Please refer to the other thread.
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 8 of 8
(4,552 Views)