MITHaystack / digital_rf

Read, write, and interact with data in the Digital RF and Digital Metadata formats
Other
102 stars 31 forks source link

Programmable Stop time? #21

Open N6RFM opened 4 years ago

N6RFM commented 4 years ago

Hi,

Nice project. Is there a way(s) to program the Sink block to stop recording after a user defined amount of time has passed? Perhaps this can be accomplished by the Stop on Time Tag?

Thank You, Bob

ryanvolz commented 4 years ago

Hi Bob! I can think of a couple options right off the bat, but I'd be open to adding such functionality should it be necessary.

  1. Stopping after recording N number of samples is generally done in GNU Radio with a "Head" block: https://wiki.gnuradio.org/index.php/Head. You can stick one of those in front of a Digital RF Sink, set the parameter for number of samples, and then the flowgraph will stop when all of the required work is done.
  2. If you're writing a flowgraph just in Python (or maybe using a GNU Radio Python snippet block), you can follow the same strategy as the thor.py script: https://github.com/MITHaystack/digital_rf/blob/master/python/tools/thor.py#L1093-L1126. From the main Python thread, this waits until a specified time and then issues a stop command to the radio, waits a bit, and then stops the flowgraph.

If those aren't quite what you're looking for, can you elaborate on your specific workflow so that I can get a better sense of what might be needed to implement? Do you want to stop at a specific time, or after X amount of data, or dependent on some event happening?

N6RFM commented 4 years ago

Hi Ryan,

Thanks for the suggestions. I like the head block approach, but my hope is to automate both the start and stop of the recording component, sometime well after the GNU flowgraph itself is started.

My desired application is to automate the recording of signals from satellites passing overhead, for subsequent analysis. Since some passes occur well into the night, unattended recording desired passes is shamelessly attractive. :-) For example, manually start a flow graph during the day. At some designated time afterwards (e.g. middle of the night), the file sink block would start collecting data, run for a specified period of time and then the sink would stop recording the data. So, my preference is to stop at a specific time, although I imagine one could calculate the input rate to predict the desired amount of data to collect. Hope that helps clarify.

Best,

Bob

ryanvolz commented 4 years ago

Yeah, that makes sense. The thor.py script already has the feature of scheduling recordings with a given start and stop time, but I assume that's not an option because your radio is not supported there or in one of the variants and/or you want to do Doppler correction before recording. Generalizing such features from thor.py so that they can be used just through the Digital RF blocks in GNU Radio Companion is something that has been on my mind for a long time, and the stopping time at least should be straightforward. I'll have to give it some thought and look through the code when I get a little time. In the meantime, I'd suggest trying to copy the thor.py approach in the Python code of your particular flowgraph. You might be able to accomplish this using a Python Snippet block (available in GNU Radio 3.8+) with the section set to "Main - After Start", assuming you have no GUI elements.

N6RFM commented 4 years ago

Thanks again Ryan. Unfortunately, the frond receiver is GUI based and I'm not using a USRP device. So, I'll keep an eye out if/when you have something for me to try. Very Best. b/