Hi Pengyu,
There are few considerations:

 On Sat, May 31, 2014 at 4:19 AM, Pengyu Zhang <zhange...@gmail.com> wrote:

> Hi All,
> How to determine the sampling rate of a customized signal source?
>
> I designed a customized signal source which should output two 1ms pulses
> every 10ms. If I do not know the sampling rate of the customized module, I
> do not know how many elements I should put into the out* buffer for
> generating the two 1ms pulses.
>


To make the discussion easy, let's assume there is rate-limiting block (eg.
throttle, USRP etc) in your flowgraph.

1).  When your parameters above are described in time (example 1ms, 10ms
etc), it is very likely that you will need to configure "Sample Rate"
(which is samp_rate) as one of the variables of your custom block setting.

2).  If you need 1ms pulses, this means your samp_rate must not be lower
than 1kHz.
      In fact your samp_rate must be multiple of 1kHz.
      You may want to put a runtime check on this.

3).  When you say "should output two 1ms pulses every 10ms", does it mean
it output one 1ms pulse every 5ms ?
      Let me assume yes to proceed with the discussion.

Says, the amplitude of the pulse is 1V.

4).  When samp_rate=1kHz, then your custom block will output one 1V and
four 0V in every five outputs.
     This means you need to "set_output_multiple(5)"

5).  When samp_rate=10kHz, then your custom block will output ten 1V and
forty 0V in every fifty outputs.
      This means you need to "set_output_multiple(50)".

6).  To generalize item 4 and 5 above, you need to
      "set_output_multiple( samp_rate / 200 );"

.... (many more)

This gives you some idea to start with, the rest is up to you to figure out.
Good luck.
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to