[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4565 - gnuradio/branches/developers/n4hy/ofdm/gnuradi
From: |
trondeau |
Subject: |
[Commit-gnuradio] r4565 - gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen |
Date: |
Wed, 21 Feb 2007 15:24:26 -0700 (MST) |
Author: trondeau
Date: 2007-02-21 15:24:26 -0700 (Wed, 21 Feb 2007)
New Revision: 4565
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t
Log:
Using different threshold factors for rise and fall triggers.
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t
2007-02-21 21:24:23 UTC (rev 4564)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t
2007-02-21 22:24:26 UTC (rev 4565)
@@ -30,17 +30,24 @@
#include <gr_io_signature.h>
@SPTR_NAME@
address@hidden@ (float threshold_factor, int look_ahead, float alpha)
address@hidden@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha)
{
- return @SPTR_NAME@ (new @NAME@ (threshold_factor, look_ahead, alpha));
+ return @SPTR_NAME@ (new @NAME@ (threshold_factor_rise,
+ threshold_factor_fall,
+ look_ahead, alpha));
}
address@hidden@::@NAME@ (float threshold_factor, int look_ahead, float alpha)
address@hidden@::@NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha)
: gr_sync_block ("@BASE_NAME@",
gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_threshold_factor(threshold_factor), d_look_ahead(look_ahead),
- d_avg_alpha(alpha), d_avg(0), d_found(0)
+ d_threshold_factor_rise(threshold_factor_rise),
+ d_threshold_factor_fall(threshold_factor_fall),
+ d_look_ahead(look_ahead), d_avg_alpha(alpha), d_avg(0), d_found(0)
{
}
@@ -62,7 +69,7 @@
//printf("noutput_items %d\n",noutput_items);
while(i < noutput_items) {
if(state == 0) { // below threshold
- if(iptr[i] > d_avg*d_threshold_factor) {
+ if(iptr[i] > d_avg*d_threshold_factor_rise) {
state = 1;
}
else {
@@ -78,7 +85,7 @@
d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg;
i++;
}
- else if (iptr[i] > d_avg*d_threshold_factor) {
+ else if (iptr[i] > d_avg*d_threshold_factor_fall) {
d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg;
i++;
}
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t
2007-02-21 21:24:23 UTC (rev 4564)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t
2007-02-21 22:24:26 UTC (rev 4565)
@@ -30,7 +30,8 @@
class @NAME@;
typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
address@hidden@ address@hidden@ (float threshold_factor = 0.25,
address@hidden@ address@hidden@ (float threshold_factor_rise = 0.25,
+ float threshold_factor_fall = 0.40,
int look_ahead = 10,
float alpha = 0.001);
@@ -41,26 +42,34 @@
* If a peak is detected, this block outputs a 1,
* or it outputs 0's.
*
- * \param threshold_factor The threshold factor determins when a peak
+ * \param threshold_factor_rise The threshold factor determins when a peak
* has started. An average of the signal is calculated and when the
- * value of the signal goes over threshold_factor*average, we start
- * looking for a peak.
+ * value of the signal goes over threshold_factor_rise*average, we
+ * start looking for a peak.
+ * \param threshold_factor_fall The threshold factor determins when a peak
+ * has ended. An average of the signal is calculated and when the
+ * value of the signal goes bellow threshold_factor_fall*average, we
+ * stop looking for a peak.
* \param look_ahead The look-ahead value is used when the threshold is
* found to look if there another peak within this step range.
* If there is a larger value, we set that as the peak and look ahead
* again. This is continued until the highest point is found with
* This look-ahead range.
+ * \param alpha The gain value of a moving average filter
*/
class @NAME@ : public gr_sync_block
{
- friend @SPTR_NAME@ address@hidden@ (float threshold_factor,
- int look_ahead,
- float alpha);
+ friend @SPTR_NAME@ address@hidden@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha);
- @NAME@ (float threshold_factor, int look_ahead, float alpha);
+ @NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha);
private:
- float d_threshold_factor;
+ float d_threshold_factor_rise;
+ float d_threshold_factor_fall;
int d_look_ahead;
float d_avg_alpha;
float d_avg;
@@ -68,11 +77,16 @@
public:
- /*! \brief Set the threshold factor value
+ /*! \brief Set the threshold factor value for the rise time
* \param thr new threshold factor
*/
- void set_threshold_factor(float thr) { d_threshold_factor = thr; }
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+ /*! \brief Set the threshold factor value for the fall time
+ * \param thr new threshold factor
+ */
+ void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; }
+
/*! \brief Set the look-ahead factor
* \param look new look-ahead factor
*/
@@ -83,11 +97,16 @@
*/
void set_alpha(int alpha) { d_avg_alpha = alpha; }
- /*! \brief Get the threshold factor value
+ /*! \brief Get the threshold factor value for the rise time
* \return threshold factor
*/
- float threshold_factor() { return d_threshold_factor; }
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ /*! \brief Get the threshold factor value for the fall time
+ * \return threshold factor
+ */
+ float threshold_factor_fall() { return d_threshold_factor_fall; }
+
/*! \brief Get the look-ahead factor value
* \return look-ahead factor
*/
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t
2007-02-21 21:24:23 UTC (rev 4564)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t
2007-02-21 22:24:26 UTC (rev 4565)
@@ -24,21 +24,26 @@
GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
address@hidden@ address@hidden@ (float threshold_factor = 0.25,
address@hidden@ address@hidden@ (float threshold_factor_rise = 0.25,
+ float threshold_factor_fall = 0.40,
int look_ahead = 10,
float alpha=0.001);
class @NAME@ : public gr_sync_block
{
private:
- @NAME@ (float threshold_factor, int look_ahead, float alpha);
+ @NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha);
public:
- void set_threshold_factor(float thr) { d_threshold_factor = thr; }
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+ void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; }
void set_look_ahead(int look) { d_look_ahead = look; }
void set_alpha(int alpha) { d_avg_alpha = alpha; }
- float threshold_factor() { return d_threshold_factor; }
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ float threshold_factor_fall() { return d_threshold_factor_fall; }
int look_ahead() { return d_look_ahead; }
float alpha() { return d_avg_alpha; }
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4565 - gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen,
trondeau <=