How to use the SPECTRAN V6 via Matlab

Quote from AdminTC on 09/02/2022, 18:25That's very simple.
Check the Missions-Folder e.g. https://v6-forum.aaronia.de/forum/topic/simple-iq-file-to-tx/ (Use the FileSource block instead of the FileReader)
That's very simple.
Check the Missions-Folder e.g. https://v6-forum.aaronia.de/forum/topic/simple-iq-file-to-tx/ (Use the FileSource block instead of the FileReader)

Quote from EnthuMan on 10/02/2022, 11:29Hello,
We were able to do something. We are unable to play any signal but there is signal at the output as set by the center frequency. The intended output signal is not present but there seems to be LO leakage.
Please advise on how to do the following:
- Generate required file (format) in Matlab. How to set the sampling rate and in what format should the file be (fixed point, hexadecimal etc)
- What is the difference between File Source and File Read
- Can a waveform be generated and stored in the hardware?
- Can this exercise be done through a stand-alone exe (write C code and run it)?
- We also wish to acquire data. What is the flow for that. Also, how to set the sample rate, trigger and data length.
- Thank you.
Hello,
We were able to do something. We are unable to play any signal but there is signal at the output as set by the center frequency. The intended output signal is not present but there seems to be LO leakage.
Please advise on how to do the following:
- Generate required file (format) in Matlab. How to set the sampling rate and in what format should the file be (fixed point, hexadecimal etc)
- What is the difference between File Source and File Read
- Can a waveform be generated and stored in the hardware?
- Can this exercise be done through a stand-alone exe (write C code and run it)?
- We also wish to acquire data. What is the flow for that. Also, how to set the sample rate, trigger and data length.
- Thank you.

Quote from AdminTC on 10/02/2022, 14:44Generate required file (format) in Matlab. How to set the sampling rate and in what format should the file be (fixed point, hexadecimal etc)
This is up to you. We can't help you on this. Please contact your Matlab support.
What is the difference between File Source and File Read
Please check the corresponding blocks:
https://v6-forum.aaronia.de/forum/topic/file-source-block/
https://v6-forum.aaronia.de/forum/topic/file-reader-block/
Can a waveform be generated and stored in the hardware?
No
Can this exercise be done through a stand-alone exe (write C code and run it)?
Sure but programming and implementation is up to you.
We also wish to acquire data. What is the flow for that. Also, how to set the sample rate, trigger and data length.
Check the various examples within this forum e.g. check the DLL examples at https://v6-forum.aaronia.de/forum/forum/dll-dynamic-link-library/
Generate required file (format) in Matlab. How to set the sampling rate and in what format should the file be (fixed point, hexadecimal etc)
This is up to you. We can't help you on this. Please contact your Matlab support.
What is the difference between File Source and File Read
Please check the corresponding blocks:
https://v6-forum.aaronia.de/forum/topic/file-source-block/
https://v6-forum.aaronia.de/forum/topic/file-reader-block/
Can a waveform be generated and stored in the hardware?
No
Can this exercise be done through a stand-alone exe (write C code and run it)?
Sure but programming and implementation is up to you.
We also wish to acquire data. What is the flow for that. Also, how to set the sample rate, trigger and data length.
Check the various examples within this forum e.g. check the DLL examples at https://v6-forum.aaronia.de/forum/forum/dll-dynamic-link-library/

Quote from nothingman1020 on 20/04/2022, 15:28When I use the sample endpoint, or the samples?limit=1 endpoint, I get 65536 complex samples as a 1x131072 vector.
If I do samples?limit=X where X is some number greater than one, I get multiple sets of 65536 complex samples, but based on the startTime and endTime information of each (and also examining the data itself) they do not appear to be anywhere near contiguous.
Does anyone know how to get more than 65536 contiguous IQ samples from the http server hooked to the SpectranV6 IQstream1 output? Or any other way that does not include file I/O to get more contiguous samples from the SpectranV6 into Matlab?
Thanks!
When I use the sample endpoint, or the samples?limit=1 endpoint, I get 65536 complex samples as a 1x131072 vector.
If I do samples?limit=X where X is some number greater than one, I get multiple sets of 65536 complex samples, but based on the startTime and endTime information of each (and also examining the data itself) they do not appear to be anywhere near contiguous.
Does anyone know how to get more than 65536 contiguous IQ samples from the http server hooked to the SpectranV6 IQstream1 output? Or any other way that does not include file I/O to get more contiguous samples from the SpectranV6 into Matlab?
Thanks!

Quote from mm_dev on 21/04/2022, 10:30Best use the "/stream" endpoint to get actual streaming data. This also supports more efficient (binary) data formats, as converting numbers to text on such a scale is quite wasteful for both bandwidth and processing power, esp. if you need to convert it back for further processing.
Best use the "/stream" endpoint to get actual streaming data. This also supports more efficient (binary) data formats, as converting numbers to text on such a scale is quite wasteful for both bandwidth and processing power, esp. if you need to convert it back for further processing.

Quote from nothingman1020 on 26/04/2022, 23:20Thank you for your response. Starting from the RTSAGetIQandDoFFT.m example, I changed 'sample' on line 8 to 'stream?limit=1' to see what would happen. I get a response.body.data back that is no longer a structure itself with a .samples underneath it, but is a 1098558x1 vector of uint8 values. I am not sure what I need to do to convert that vector of uint8 values into I/Q samples in IQData so the rest of the example code with the FFT process will run.
Thank you for your response. Starting from the RTSAGetIQandDoFFT.m example, I changed 'sample' on line 8 to 'stream?limit=1' to see what would happen. I get a response.body.data back that is no longer a structure itself with a .samples underneath it, but is a 1098558x1 vector of uint8 values. I am not sure what I need to do to convert that vector of uint8 values into I/Q samples in IQData so the rest of the example code with the FFT process will run.

Quote from mm_dev on 27/04/2022, 09:25The data should by default use the same format, only it's using MIME type application/octet-stream rather than text/json as it may contain binary values if you request a different output format. You can just access http://localhost:54664/sample and http://localhost:54664/stream?limit=1 in a browser to see the results directly (the latter one will be saved to a file as the browser won't know how to display application/octet-stream data, but you can just open that file in a text editor).
So you'll probably just have to explicitly tell Matlab to treat the data as JSON before accessing it, as specified in https://de.mathworks.com/help/matlab/ref/webread.html
The data should by default use the same format, only it's using MIME type application/octet-stream rather than text/json as it may contain binary values if you request a different output format. You can just access http://localhost:54664/sample and http://localhost:54664/stream?limit=1 in a browser to see the results directly (the latter one will be saved to a file as the browser won't know how to display application/octet-stream data, but you can just open that file in a text editor).
So you'll probably just have to explicitly tell Matlab to treat the data as JSON before accessing it, as specified in https://de.mathworks.com/help/matlab/ref/webread.html

Quote from David3542 on 27/04/2022, 09:51Quote from mm_dev on 21/04/2022, 10:30Best use the "/stream" endpoint to get actual streaming data. This also supports more efficient (binary) data formats, as converting numbers to text on such a scale is quite wasteful for both bandwidth and processing power, esp. if you need to convert it back for further processing.
Could you please say , how we can recive binary stream insted of TEXT/Json stream?
up to now we ussed "127.0.0.1:54664 " , so wich parameter we have to add , for reciving binary stream ?
Quote from mm_dev on 21/04/2022, 10:30Best use the "/stream" endpoint to get actual streaming data. This also supports more efficient (binary) data formats, as converting numbers to text on such a scale is quite wasteful for both bandwidth and processing power, esp. if you need to convert it back for further processing.
Could you please say , how we can recive binary stream insted of TEXT/Json stream?
up to now we ussed "127.0.0.1:54664 " , so wich parameter we have to add , for reciving binary stream ?

Quote from mm_dev on 27/04/2022, 10:51Could you please say , how we can recive binary stream insted of TEXT/Json stream?
up to now we ussed "127.0.0.1:54664 " , so wich parameter we have to add , for reciving binary stream ?
http://localhost:54664/stream?limit=X&format=Y
X is the number of samples you want to receive per call (you can omit the limit parameter to get an infinite stream)
Y can be one of
- json (this is the default)
- int16 (you may want to also specify the "scale" parameter when using this to increase precision)
- float16
- float32
The metadata will still be JSON, just the sample values will use the specified binary format.
Could you please say , how we can recive binary stream insted of TEXT/Json stream?
up to now we ussed "127.0.0.1:54664 " , so wich parameter we have to add , for reciving binary stream ?
http://localhost:54664/stream?limit=X&format=Y
X is the number of samples you want to receive per call (you can omit the limit parameter to get an infinite stream)
Y can be one of
- json (this is the default)
- int16 (you may want to also specify the "scale" parameter when using this to increase precision)
- float16
- float32
The metadata will still be JSON, just the sample values will use the specified binary format.

Quote from abhijithbg on 27/05/2022, 16:13Hi mm_dev, Admin_TC,
I am observing an issue (with matlab script) with data samples received across multiple blocks/packets. The received data samples are not contiguous and broken.
I have followed above posts to generate streaming data.
Test signal is an exponent tone with 991Hz and is sampled at 61.44 MSPS. It is 10ms long ( Attaching matlab code as well). I am attaching the plots and Matlab codes for your reference. One can see that there is discontinuity from 49152th sample to 49153th sample.
So, these are the questions:
- How to ensure that there is no discontinuity between one block to another block?
- Why the startTime of packets are same across the packets (see the logs captured in the "991Hz_MatlabLogs.txt" )?
Additional information:
- newFileRead.m is the main file.
- AaroniaHTTP.m is the same file shared by the admin.
- expTone.m is the file that generates .mat file of 991 Hz.
- expTone_991Hz.mat to expTone_991Hz.wv conversion file is not attached, but converted file - expTone_991Hz.wv file is attached (as expTone_991Hz.zip) file).
Thanks
Hi mm_dev, Admin_TC,
I am observing an issue (with matlab script) with data samples received across multiple blocks/packets. The received data samples are not contiguous and broken.
I have followed above posts to generate streaming data.
Test signal is an exponent tone with 991Hz and is sampled at 61.44 MSPS. It is 10ms long ( Attaching matlab code as well). I am attaching the plots and Matlab codes for your reference. One can see that there is discontinuity from 49152th sample to 49153th sample.
So, these are the questions:
- How to ensure that there is no discontinuity between one block to another block?
- Why the startTime of packets are same across the packets (see the logs captured in the "991Hz_MatlabLogs.txt" )?
Additional information:
- newFileRead.m is the main file.
- AaroniaHTTP.m is the same file shared by the admin.
- expTone.m is the file that generates .mat file of 991 Hz.
- expTone_991Hz.mat to expTone_991Hz.wv conversion file is not attached, but converted file - expTone_991Hz.wv file is attached (as expTone_991Hz.zip) file).
Thanks
Uploaded files: