Quantcast

How to write data periodically in file sink

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to write data periodically in file sink

dpak
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

Moritz Luca Schmid

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

dpak
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

Gilad Beeri (ApolloShield)
If you need accuracy, I think the asynchronous nature of your method might problematic (will appreciate input from GR devs).
Maybe try a different approach - write the samples to a memory buffer, then read from the buffer the exact # of samples you want to write to a file.

On Fri, May 19, 2017 at 5:02 PM Deepak Gautam <[hidden email]> wrote:
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

Paul I.
You need to use USRP "issue_stream_cmd" method (mode: STREAM_MODE_NUM_SAMPS_AND_DONE). It's allow to receive burst of data by USRP timer.
If you work in GRC:
1) Disable streaming autostart for "UHD source"
2) Create your own block which will periodically issue stream commands (yes, you need to pass USRP pointer to it)
a) For stream command set "num_samples" =  sample_rate * 1 sec
b) Read the USRP timer value, add some time offset to it and use this value as timestamp for the first stream command
c) Increment timestamp after every stream command
...
3) Profit!

2017-05-20 10:09 GMT+03:00 Gilad Beeri (ApolloShield) <[hidden email]>:
If you need accuracy, I think the asynchronous nature of your method might problematic (will appreciate input from GR devs).
Maybe try a different approach - write the samples to a memory buffer, then read from the buffer the exact # of samples you want to write to a file.

On Fri, May 19, 2017 at 5:02 PM Deepak Gautam <[hidden email]> wrote:
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

Paul I.
If you don't need high accuracy just "filter" received samples by rx_time or use "Keep M in N" block where N = (samp_rate * 3 sec) and M = (samp_rate * 1 sec).

2017-05-21 12:24 GMT+03:00 Paul I. <[hidden email]>:
You need to use USRP "issue_stream_cmd" method (mode: STREAM_MODE_NUM_SAMPS_AND_DONE). It's allow to receive burst of data by USRP timer.
If you work in GRC:
1) Disable streaming autostart for "UHD source"
2) Create your own block which will periodically issue stream commands (yes, you need to pass USRP pointer to it)
a) For stream command set "num_samples" =  sample_rate * 1 sec
b) Read the USRP timer value, add some time offset to it and use this value as timestamp for the first stream command
c) Increment timestamp after every stream command
...
3) Profit!

2017-05-20 10:09 GMT+03:00 Gilad Beeri (ApolloShield) <[hidden email]>:
If you need accuracy, I think the asynchronous nature of your method might problematic (will appreciate input from GR devs).
Maybe try a different approach - write the samples to a memory buffer, then read from the buffer the exact # of samples you want to write to a file.

On Fri, May 19, 2017 at 5:02 PM Deepak Gautam <[hidden email]> wrote:
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

dpak
In reply to this post by Paul I.
Dear paul,luca,


Thank you for the kind response. Yes, i need the high accuracy and i think i should go with "issue_stream_cmd" method. Before i start working in this method, my concern is whether i can write the different burst in separate file. My main conern is written file size. Because i have to record data for few minutes With my sampling rate of 25msps. I got problem of overflow when i write in normal hard disk. So i am writing data in RAM disk by which i dont get overflow. Due to size limitation of the Ram disk, i will not be able to write all data in one file. If i write in different file, i can move previous files back to hard disk and proceed. If there is a way of writing in a file for 3/4 minutes with 25msps without overflow , i dont need burst reception also. I appreciate your opinion 

Best regards,  
Deepak




On Sun, May 21, 2017 at 6:24 PM Paul I. <[hidden email]> wrote:
You need to use USRP "issue_stream_cmd" method (mode: STREAM_MODE_NUM_SAMPS_AND_DONE). It's allow to receive burst of data by USRP timer.
If you work in GRC:
1) Disable streaming autostart for "UHD source"
2) Create your own block which will periodically issue stream commands (yes, you need to pass USRP pointer to it)
a) For stream command set "num_samples" =  sample_rate * 1 sec
b) Read the USRP timer value, add some time offset to it and use this value as timestamp for the first stream command
c) Increment timestamp after every stream command
...
3) Profit!

2017-05-20 10:09 GMT+03:00 Gilad Beeri (ApolloShield) <[hidden email]>:
If you need accuracy, I think the asynchronous nature of your method might problematic (will appreciate input from GR devs).
Maybe try a different approach - write the samples to a memory buffer, then read from the buffer the exact # of samples you want to write to a file.

On Fri, May 19, 2017 at 5:02 PM Deepak Gautam <[hidden email]> wrote:
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

dpak

On Thu, May 25, 2017 at 10:34 AM Deepak Gautam <[hidden email]> wrote:
Dear  Gilad, paul,luca


Thank you for the kind response. Yes, i need the high accuracy and i think i should go with "issue_stream_cmd" method. Before i start working in this method, my concern is whether i can write the different burst in separate file. My main conern is written file size. Because i have to record data for few minutes With my sampling rate of 25msps. I got problem of overflow when i write in normal hard disk. So i am writing data in RAM disk by which i dont get overflow. Due to size limitation of the Ram disk, i will not be able to write all data in one file. If i write in different file, i can move previous files back to hard disk and proceed. If there is a way of writing in a file for 3/4 minutes with 25msps without overflow , i dont need burst reception also. I appreciate your opinion 

Best regards,  
Deepak



On Sun, May 21, 2017 at 6:24 PM Paul I. <[hidden email]> wrote:
You need to use USRP "issue_stream_cmd" method (mode: STREAM_MODE_NUM_SAMPS_AND_DONE). It's allow to receive burst of data by USRP timer.
If you work in GRC:
1) Disable streaming autostart for "UHD source"
2) Create your own block which will periodically issue stream commands (yes, you need to pass USRP pointer to it)
a) For stream command set "num_samples" =  sample_rate * 1 sec
b) Read the USRP timer value, add some time offset to it and use this value as timestamp for the first stream command
c) Increment timestamp after every stream command
...
3) Profit!

2017-05-20 10:09 GMT+03:00 Gilad Beeri (ApolloShield) <[hidden email]>:
If you need accuracy, I think the asynchronous nature of your method might problematic (will appreciate input from GR devs).
Maybe try a different approach - write the samples to a memory buffer, then read from the buffer the exact # of samples you want to write to a file.

On Fri, May 19, 2017 at 5:02 PM Deepak Gautam <[hidden email]> wrote:
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write data periodically in file sink

Paul I.
Take a look at "Tagged file sink" block.
 

2017-05-25 4:35 GMT+03:00 Deepak Gautam <[hidden email]>:

On Thu, May 25, 2017 at 10:34 AM Deepak Gautam <[hidden email]> wrote:
Dear  Gilad, paul,luca


Thank you for the kind response. Yes, i need the high accuracy and i think i should go with "issue_stream_cmd" method. Before i start working in this method, my concern is whether i can write the different burst in separate file. My main conern is written file size. Because i have to record data for few minutes With my sampling rate of 25msps. I got problem of overflow when i write in normal hard disk. So i am writing data in RAM disk by which i dont get overflow. Due to size limitation of the Ram disk, i will not be able to write all data in one file. If i write in different file, i can move previous files back to hard disk and proceed. If there is a way of writing in a file for 3/4 minutes with 25msps without overflow , i dont need burst reception also. I appreciate your opinion 

Best regards,  
Deepak



On Sun, May 21, 2017 at 6:24 PM Paul I. <[hidden email]> wrote:
You need to use USRP "issue_stream_cmd" method (mode: STREAM_MODE_NUM_SAMPS_AND_DONE). It's allow to receive burst of data by USRP timer.
If you work in GRC:
1) Disable streaming autostart for "UHD source"
2) Create your own block which will periodically issue stream commands (yes, you need to pass USRP pointer to it)
a) For stream command set "num_samples" =  sample_rate * 1 sec
b) Read the USRP timer value, add some time offset to it and use this value as timestamp for the first stream command
c) Increment timestamp after every stream command
...
3) Profit!

2017-05-20 10:09 GMT+03:00 Gilad Beeri (ApolloShield) <[hidden email]>:
If you need accuracy, I think the asynchronous nature of your method might problematic (will appreciate input from GR devs).
Maybe try a different approach - write the samples to a memory buffer, then read from the buffer the exact # of samples you want to write to a file.

On Fri, May 19, 2017 at 5:02 PM Deepak Gautam <[hidden email]> wrote:
Dear luca,

I had already tried with controlling flow graph dynamically using start(), stop(), lock(), unlock() function. Here i have the part of code i had used.

tb=top_block_cls()
count=1
tb.start()
while (count<5):
    time.sleep(1.0)           #data is recorded in the file
    tb.lock()
    tb.disconnect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))   #disconnect source and block
    tb.blocks_file_sink_0= blocks.file_sink(gr.sizeof_gr_complex*1, filename,False)  # create new file sink to write
    tb.connect((tb.uhd_usrp_source_0,0),(tb.blocks_file_sink_0, 0))  #connect source with new file
    count=count+1
    time.sleep(2.0)           #wait 
    tb.unlock()
tb.stop()


This program should write the data for 1 second in the file, wait for 2 second and again write for 1 second to another file and so on for 5 4 times. I expect the total data written in the file to be same. But total number of samples recorded in the files are different. for my sampling rate of 25MSps, it should record 25MS per file, but it is around 22Mega sample with different number of data in different file.  So it is difficult to reproduce the accurate signal from received data . My application requires very good phase coherence. So i am wondering whether there is something to do to solve in this method or i have to think of another idea. 


Best Regards,
Deepak



On Mon, May 15, 2017 at 9:02 PM Moritz Luca Schmid <[hidden email]> wrote:

Hey Deepak,

my first idea is to reconfigure the flowgraph. You could connect and disconnect your source for the time, you want to write data in your file sink and the time you don't want to.

You can find infos about the flowgraphs operations here.


Best

Luca



On 15.05.2017 13:53, Deepak Gautam wrote:
Currently i am working in the USRP using GNU Radio for my masters work. In my transmitter side, i send data continuously from file source followed by UHD Sink at the rate of 25 MSPS. In receiver side, I want to write the data in every two/three seconds after receiving from receiver USRP. Meaning, write data for 1 sec (25M samples), then dont write for next 2 second and again write for 1 sec and so on. Is there any suggestion for this purpose. I look forward for the resposne


Best Regards,
Deepak


_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Loading...