GNU Radio 3.5.1 C++ API
gri_control_loop Class Reference

#include <gri_control_loop.h>

Inheritance diagram for gri_control_loop:

List of all members.

Public Member Functions

 gri_control_loop (float loop_bw, float max_freq, float min_freq)
virtual ~gri_control_loop ()
void update_gains ()
 update the system gains from the loop bandwidth and damping factor
void advance_loop (float error)
 update the system gains from the loop bandwidth and damping factor
void phase_wrap ()
 Keep the phase between -2pi and 2pi.
void frequency_limit ()
 Keep the frequency between d_min_freq and d_max_freq.
void set_loop_bandwidth (float bw)
 Set the loop bandwidth.
void set_damping_factor (float df)
 Set the loop damping factor.
void set_alpha (float alpha)
 Set the loop gain alpha.
void set_beta (float beta)
 Set the loop gain beta.
void set_frequency (float freq)
 Set the Costas loop's frequency.
void set_phase (float phase)
 Set the Costas loop's phase.
float get_loop_bandwidth () const
 Returns the loop bandwidth.
float get_damping_factor () const
 Returns the loop damping factor.
float get_alpha () const
 Returns the loop gain alpha.
float get_beta () const
 Returns the loop gain beta.
float get_frequency () const
 Get the Costas loop's frequency estimate.
float get_phase () const
 Get the Costas loop's phase estimate.

Protected Attributes

float d_phase
float d_freq
float d_max_freq
float d_min_freq
float d_damping
float d_loop_bw
float d_alpha
float d_beta

Constructor & Destructor Documentation

gri_control_loop::gri_control_loop ( float  loop_bw,
float  max_freq,
float  min_freq 
)
virtual gri_control_loop::~gri_control_loop ( ) [virtual]

Member Function Documentation

void gri_control_loop::advance_loop ( float  error)

update the system gains from the loop bandwidth and damping factor

This function updates the system gains based on the loop bandwidth and damping factor of the system. These two factors can be set separately through their own set functions.

void gri_control_loop::frequency_limit ( )

Keep the frequency between d_min_freq and d_max_freq.

This function keeps the frequency between d_min_freq and d_max_freq. If the frequency is greater than d_max_freq, it is set to d_max_freq. If the frequency is less than d_min_freq, it is set to d_min_freq.

This function should be called after advance_loop to keep the frequency in the specified region. It is set as a separate method in case another way is desired as this is fairly heavy-handed.

float gri_control_loop::get_alpha ( ) const

Returns the loop gain alpha.

float gri_control_loop::get_beta ( ) const

Returns the loop gain beta.

float gri_control_loop::get_damping_factor ( ) const

Returns the loop damping factor.

float gri_control_loop::get_frequency ( ) const

Get the Costas loop's frequency estimate.

float gri_control_loop::get_loop_bandwidth ( ) const

Returns the loop bandwidth.

float gri_control_loop::get_phase ( ) const

Get the Costas loop's phase estimate.

void gri_control_loop::phase_wrap ( )

Keep the phase between -2pi and 2pi.

This function keeps the phase between -2pi and 2pi. If the phase is greater than 2pi by d, it wraps around to be -2pi+d; similarly if it is less than -2pi by d, it wraps around to 2pi-d.

This function should be called after advance_loop to keep the phase in a good operating region. It is set as a separate method in case another way is desired as this is fairly heavy-handed.

void gri_control_loop::set_alpha ( float  alpha)

Set the loop gain alpha.

Set's the loop filter's alpha gain parameter.

This value should really only be set by adjusting the loop bandwidth and damping factor.

Parameters:
alpha(float) new alpha gain
void gri_control_loop::set_beta ( float  beta)

Set the loop gain beta.

Set's the loop filter's beta gain parameter.

This value should really only be set by adjusting the loop bandwidth and damping factor.

Parameters:
beta(float) new beta gain
void gri_control_loop::set_damping_factor ( float  df)

Set the loop damping factor.

Set the loop filter's damping factor to df. The damping factor should be sqrt(2)/2.0 for critically damped systems. Set it to anything else only if you know what you are doing. It must be a number between 0 and 1.

When a new damping factor is set, the gains, alpha and beta, of the loop are recalculated by a call to update_gains().

Parameters:
df(float) new damping factor
void gri_control_loop::set_frequency ( float  freq)

Set the Costas loop's frequency.

Set's the Costas Loop's frequency. While this is normally updated by the inner loop of the algorithm, it could be useful to manually initialize, set, or reset this under certain circumstances.

Parameters:
freq(float) new frequency
void gri_control_loop::set_loop_bandwidth ( float  bw)

Set the loop bandwidth.

Set the loop filter's bandwidth to bw. This should be between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive number.

When a new damping factor is set, the gains, alpha and beta, of the loop are recalculated by a call to update_gains().

Parameters:
bw(float) new bandwidth
void gri_control_loop::set_phase ( float  phase)

Set the Costas loop's phase.

Set's the Costas Loop's phase. While this is normally updated by the inner loop of the algorithm, it could be useful to manually initialize, set, or reset this under certain circumstances.

Parameters:
phase(float) new phase
void gri_control_loop::update_gains ( )

update the system gains from the loop bandwidth and damping factor

This function updates the system gains based on the loop bandwidth and damping factor of the system. These two factors can be set separately through their own set functions.


Member Data Documentation

float gri_control_loop::d_alpha [protected]
float gri_control_loop::d_beta [protected]
float gri_control_loop::d_damping [protected]
float gri_control_loop::d_freq [protected]
float gri_control_loop::d_loop_bw [protected]
float gri_control_loop::d_max_freq [protected]
float gri_control_loop::d_min_freq [protected]
float gri_control_loop::d_phase [protected]

The documentation for this class was generated from the following file: