11-23-2023 07:30 AM
Hi,
I have a program here where I need to send a waveform from server side to client side. While TCP protocol is working, the data I am getting on client side is single 32-bit real numbers. I am getting waveform when this is plotted but now, I need to get the FFT of this data. I have attached the photo of the circuit on client side. Can anyone give any suggestions please?
11-23-2023 07:40 AM
Hi shreyaskarnad,
@shreyaskarnad wrote:
I have a program here where I need to send a waveform from server side to client side. While TCP protocol is working, the data I am getting on client side is single 32-bit real numbers. I am getting waveform when this is plotted but now, I need to get the FFT of this data. I have attached the photo of the circuit on client side. Can anyone give any suggestions please?
When you receive single samples then you need to build your waveform from those samples…
11-23-2023 07:47 AM
Thanks for reply sir,
The thing is I am completely new to LabVIEW and I got the program online which I modified a bit. I replaced the sinewave creator on the server side to function generator. The signal passing to client side is going very good. The moment I change frequency and amplitude on the knobs in given image, it is reflected in client side immediately. But the signal in sine wave or any wave I wish to get in frequency domain. to find the peaks in frequency as required for the further analysis
11-23-2023 08:31 AM
Hi shreyaskarnad,
@shreyaskarnad wrote:
The thing is I am completely new to LabVIEW and I got the program online which I modified a bit. I replaced the sinewave creator on the server side to function generator. The signal passing to client side is going very good.
So on server side you typecast a SGL array to a string, but on client side you convert that string back to a scalar SGL value: does that sound right to you?
Recommendation:
11-23-2023 08:54 AM
Frankly speaking sir, I am fully confused. I have never used these functions before. Flatten and unflatten both require some additional parameters and I have no idea what those are...
11-23-2023 09:06 AM - edited 11-23-2023 09:07 AM
Hi shreyaskarnad,
@shreyaskarnad wrote:
Frankly speaking sir, I am fully confused. I have never used these functions before. Flatten and unflatten both require some additional parameters and I have no idea what those are...
First read the LabVIEW help for those functions.
Then use the same parameters for both functions - or don't wire the optional inputs to use their default values…
11-23-2023 09:21 AM
Sir I didn't understand what do you mean by Use a SGL array constant as "type" input.
11-23-2023 11:03 AM
Some basic things. An FFT requires that you have a value for deltaT and an array of data.
To get started use
Programming -> Signal Processing -> Spectral -> Amp&Ph Spect
That function requires an array of signal values and a dT value. You also have an input for unrap phase if you want to use it. At first I would recommend that you do some tests using your produce a sine wave subVI to see what to expect. Thus if you want to use the TCP function to pass the data you will also need to pass dT.
Regarding flatten to a string. Here is a hint when someone just tells you a function name. tap cntl-spacebar at the same time it will give you kind of a search for function box. Type in the function name and double click on the correct one. Then tap Cntl-H to get the context help box and click on detailed help.
It happens to be in
Programming -> String -> Flatten Unflatten String -> To string
Me if I was passing some thing that as a string I would probably do it by building an array where the first element is dT and the remaining elements are the data array. I would then convert it to an string by using the function.
Programming -> string -> Array to string
Then pass the string like you are. On the receiving end I would take the string and run it through the function.
Programming -> String -> Spreadsheet string to array
I would then split the 1 D array at 1 and index the top array to 0 in order to get the value for dT and plug the bottom array into the FFT function.
Also the level of complexity that I like for passing variables is.
Within a single VI, local variables (better yet with a shift register and a wire).
From a single VI to a separately running VI I use global variables
From one computer to another I use shared variables, which tend to be tricky to set up but work very well.
I should look into the TCP write and TCP read to see what level of complexity they add as compared to the shared variables.
11-23-2023 01:22 PM
@shreyaskarnad wrote:
Sir I didn't understand what do you mean by Use a SGL array constant as "type" input.
this from your receiver
and that is from your sender
you are sending an array - serialized as a string - but are receiving a scalar, because you use a scalar not an array to de-serialize.
in your receiver, you are meant to change the scalar constant into an array constant
https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/constants/array.html
11-24-2023 12:19 AM
Sir I tried switching it to numeric array but on doing so I am not getting any waveform on the monitor in receiver end. When it is just a numeric constant at least I was getting waveform.