Loading...
Searching...
No Matches
gr::digital::constellation Class Referenceabstract
GNU Radio C++ Signal Processing Blocks » Symbol Coding

An abstracted constellation object. More...

`#include <gnuradio/digital/constellation.h>`

## Public Types

enum | normalization_t { NO_NORMALIZATION , POWER_NORMALIZATION , AMPLITUDE_NORMALIZATION }

## Public Member Functions

| constellation (std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, normalization_t normalization=AMPLITUDE_NORMALIZATION, float npwr=1.0)
| constellation ()
virtual | ~constellation ()
void | normalize (normalization_t normalization)
| Normalizes the constellation.
void | map_to_points (unsigned int value, gr_complex *points)
| Returns the constellation points for a symbol value.
std::vector< gr_complex > | map_to_points_v (unsigned int value)
virtual unsigned int | decision_maker (const gr_complex *sample)=0
| Returns the constellation point that matches best.
unsigned int | decision_maker_v (std::vector< gr_complex > sample)
| Takes a vector rather than a pointer. Better for SWIG wrapping.
unsigned int | decision_maker_pe (const gr_complex *sample, float *phase_error)
| Also calculates the phase error.
virtual void | calc_metric (const gr_complex *sample, float *metric, gr::digital::trellis_metric_type_t type)
| Calculates distance.
virtual void | calc_euclidean_metric (const gr_complex *sample, float *metric)
virtual void | calc_hard_symbol_metric (const gr_complex *sample, float *metric)
std::vector< gr_complex > | points ()
| Returns the set of points in this constellation.
std::vector< gr_complex > | s_points ()
| Returns the vector of points in this constellation. Raise error if dimensionality is not one.
std::vector< std::vector< gr_complex > > | v_points ()
| Returns a vector of vectors of points.
bool | apply_pre_diff_code ()
| Whether to apply an encoding before doing differential encoding. (e.g. gray coding).
void | set_pre_diff_code (bool a)
| Whether to apply an encoding before doing differential encoding. (e.g. gray coding).
std::vector< int > | pre_diff_code ()
| Returns the encoding to apply before differential encoding.
unsigned int | rotational_symmetry ()
| Returns the order of rotational symmetry.
unsigned int | dimensionality ()
| Returns the number of complex numbers in a single symbol.
unsigned int | bits_per_symbol ()
unsigned int | arity ()
constellation_sptr | base ()
pmt::pmt_t | as_pmt ()
void | gen_soft_dec_lut (int precision, float npwr=-1)
| Generates the soft decision LUT based on constellation and symbol map.
virtual std::vector< float > | calc_soft_dec (gr_complex sample, float npwr=-1)
| Calculate soft decisions for the given `sample`.
void | set_soft_dec_lut (const std::vector< std::vector< float > > &soft_dec_lut, int precision)
| Define a soft decision look-up table.
void | set_npwr (float npwr)
| Sets the constellation noise power and recalculates LUT given `npwr`.
bool | has_soft_dec_lut ()
| Returns True if the soft decision LUT has been defined, False otherwise.
std::vector< std::vector< float > > | soft_dec_lut ()
std::vector< float > | soft_decision_maker (gr_complex sample)
| Returns the soft decisions for the given `sample`.

## Protected Member Functions

float | get_distance (unsigned int index, const gr_complex *sample)
unsigned int | get_closest_point (const gr_complex *sample)
void | calc_arity ()
void | max_min_axes ()

## Protected Attributes

std::vector< gr_complex > | d_constellation
std::vector< int > | d_pre_diff_code
bool | d_apply_pre_diff_code
unsigned int | d_rotational_symmetry
unsigned int | d_dimensionality
unsigned int | d_arity
float | d_scalefactor
| The factor by which the user given constellation points were scaled by to achieve an average amplitude of 1.
float | d_maxamp
float | d_re_min
float | d_re_max
float | d_im_min
float | d_im_max
std::vector< std::vector< float > > | d_soft_dec_lut
int | d_lut_precision
float | d_lut_scale
float | d_npwr
float | d_padding
bool | d_use_external_lut

## Detailed Description

An abstracted constellation object.

The constellation objects hold the necessary information to pass around constellation information for modulators and demodulators. These objects contain the mapping between the bits and the constellation points used to represent them as well as methods for slicing the symbol space. Various implementations are possible for efficiency and ease of use.

Standard constellations (BPSK, QPSK, QAM, etc) can be inherited from this class and overloaded to perform optimized slicing and constellation mappings.

## Member Enumeration Documentation

## normalization_t

enum gr::digital::constellation::normalization_t

Enumerator
NO_NORMALIZATION |
POWER_NORMALIZATION |
AMPLITUDE_NORMALIZATION |

## Constructor & Destructor Documentation

## constellation() [1/2]

gr::digital::constellation::constellation | ( | std::vector< gr_complex > | constell,
|  | std::vector< int > | pre_diff_code,
|  | unsigned int | rotational_symmetry,
|  | unsigned int | dimensionality,
|  | normalization_t | normalization = AMPLITUDE_NORMALIZATION,
|  | float | npwr = 1.0 )

References AMPLITUDE_NORMALIZATION, dimensionality(), pre_diff_code(), and rotational_symmetry().

## constellation() [2/2]

gr::digital::constellation::constellation | ( |  | ) |

## ~constellation()

virtual gr::digital::constellation::~constellation | ( |  | ) |

virtual

## Member Function Documentation

## apply_pre_diff_code()

bool gr::digital::constellation::apply_pre_diff_code | ( |  | ) |

inline

Whether to apply an encoding before doing differential encoding. (e.g. gray coding).

References d_apply_pre_diff_code.

## arity()

unsigned int gr::digital::constellation::arity | ( |  | ) |

inline

References d_arity.

## as_pmt()

pmt::pmt_t gr::digital::constellation::as_pmt | ( |  | ) |

inline

References base(), and pmt::make_any().

## base()

constellation_sptr gr::digital::constellation::base | ( |  | ) |

inline

Referenced by as_pmt().

## bits_per_symbol()

unsigned int gr::digital::constellation::bits_per_symbol | ( |  | ) |

inline

References d_constellation, and d_dimensionality.

## calc_arity()

void gr::digital::constellation::calc_arity | ( |  | ) |

protected

## calc_euclidean_metric()

virtual void gr::digital::constellation::calc_euclidean_metric | ( | const gr_complex * | sample,
|  | float * | metric )

virtual

## calc_hard_symbol_metric()

virtual void gr::digital::constellation::calc_hard_symbol_metric | ( | const gr_complex * | sample,
|  | float * | metric )

virtual

## calc_metric()

virtual void gr::digital::constellation::calc_metric | ( | const gr_complex * | sample,
|  | float * | metric,
|  | gr::digital::trellis_metric_type_t | type )

virtual

Calculates distance.

Calculates metrics for all points in the constellation. For use with the viterbi algorithm.

## calc_soft_dec()

virtual std::vector< float > gr::digital::constellation::calc_soft_dec | ( | gr_complex | sample,
|  | float | npwr = -1 )

virtual

Calculate soft decisions for the given `sample`.

Calculate the soft decisions from the given `sample` at the given noise power `npwr`.

This is a very costly algorithm (especially for higher order modulations) and should be used sparingly. It uses the gen_soft_dec_lut function to generate the LUT, which should be done once or if a large change in the noise floor is detected.

Instead of using this function, generate the LUT using the gen_soft_dec_lut after creating the constellation object and then use the soft_decision_maker function to return the answer from the LUT.

Parameters

  sample | The complex sample to get the soft decisions.
  npwr | estimate of the noise power, defaults to -1 which will use class member.

## decision_maker()

virtual unsigned int gr::digital::constellation::decision_maker | ( | const gr_complex * | sample | ) |

pure virtual

Returns the constellation point that matches best.

Implemented in gr::digital::constellation_16qam, gr::digital::constellation_8psk, gr::digital::constellation_8psk_natural, gr::digital::constellation_bpsk, gr::digital::constellation_calcdist, gr::digital::constellation_dqpsk, gr::digital::constellation_qpsk, and gr::digital::constellation_sector.

## decision_maker_pe()

unsigned int gr::digital::constellation::decision_maker_pe | ( | const gr_complex * | sample,
|  | float * | phase_error )

Also calculates the phase error.

## decision_maker_v()

unsigned int gr::digital::constellation::decision_maker_v | ( | std::vector< gr_complex > | sample | ) |

Takes a vector rather than a pointer. Better for SWIG wrapping.

## dimensionality()

unsigned int gr::digital::constellation::dimensionality | ( |  | ) |

inline

Returns the number of complex numbers in a single symbol.

References d_dimensionality.

Referenced by constellation(), gr::digital::constellation_calcdist::constellation_calcdist(), gr::digital::constellation_sector::constellation_sector(), and gr::digital::constellation_calcdist::make().

## gen_soft_dec_lut()

void gr::digital::constellation::gen_soft_dec_lut | ( | int | precision,
|  | float | npwr = -1 )

Generates the soft decision LUT based on constellation and symbol map.

Generates the soft decision LUT based on constellation and symbol map. It can be given a estimate of the noise power in the channel as `npwr`.

Parameters

  precision | Number of bits of precision on each axis.
  npwr | Estimate of the noise power (if known), defaults to -1 which will use class member.

This is expensive to compute.

## get_closest_point()

unsigned int gr::digital::constellation::get_closest_point | ( | const gr_complex * | sample | ) |

protected

## get_distance()

float gr::digital::constellation::get_distance | ( | unsigned int | index,
|  | const gr_complex * | sample )

protected

## has_soft_dec_lut()

bool gr::digital::constellation::has_soft_dec_lut | ( |  | ) |

Returns True if the soft decision LUT has been defined, False otherwise.

## map_to_points()

void gr::digital::constellation::map_to_points | ( | unsigned int | value,
|  | gr_complex * | points )

Returns the constellation points for a symbol value.

References points().

## map_to_points_v()

std::vector< gr_complex > gr::digital::constellation::map_to_points_v | ( | unsigned int | value | ) |

## max_min_axes()

void gr::digital::constellation::max_min_axes | ( |  | ) |

protected

## normalize()

void gr::digital::constellation::normalize | ( | normalization_t | normalization | ) |

Normalizes the constellation.

## points()

std::vector< gr_complex > gr::digital::constellation::points | ( |  | ) |

inline

Returns the set of points in this constellation.

References d_constellation.

Referenced by map_to_points().

## pre_diff_code()

std::vector< int > gr::digital::constellation::pre_diff_code | ( |  | ) |

inline

Returns the encoding to apply before differential encoding.

References d_pre_diff_code.

Referenced by constellation(), gr::digital::constellation_calcdist::constellation_calcdist(), gr::digital::constellation_expl_rect::constellation_expl_rect(), gr::digital::constellation_psk::constellation_psk(), gr::digital::constellation_rect::constellation_rect(), gr::digital::constellation_sector::constellation_sector(), gr::digital::constellation_calcdist::make(), gr::digital::constellation_expl_rect::make(), gr::digital::constellation_psk::make(), and gr::digital::constellation_rect::make().

## rotational_symmetry()

unsigned int gr::digital::constellation::rotational_symmetry | ( |  | ) |

inline

Returns the order of rotational symmetry.

References d_rotational_symmetry.

Referenced by constellation(), gr::digital::constellation_calcdist::constellation_calcdist(), gr::digital::constellation_expl_rect::constellation_expl_rect(), gr::digital::constellation_rect::constellation_rect(), gr::digital::constellation_sector::constellation_sector(), gr::digital::constellation_calcdist::make(), gr::digital::constellation_expl_rect::make(), and gr::digital::constellation_rect::make().

## s_points()

std::vector< gr_complex > gr::digital::constellation::s_points | ( |  | ) |

Returns the vector of points in this constellation. Raise error if dimensionality is not one.

## set_npwr()

void gr::digital::constellation::set_npwr | ( | float | npwr | ) |

Sets the constellation noise power and recalculates LUT given `npwr`.

Sets the constellation noise power and recalculates LUT given `npwr`. If a LUT was defined via manual entry of a table, it will be a left alone. Otherwise, the LUT will be recalculated with the new noise power. This member is used by calc_soft_dec primarily.

Parameters

  npwr | The noise power to use for soft decisions

## set_pre_diff_code()

void gr::digital::constellation::set_pre_diff_code | ( | bool | a | ) |

inline

Whether to apply an encoding before doing differential encoding. (e.g. gray coding).

References d_apply_pre_diff_code.

## set_soft_dec_lut()

void gr::digital::constellation::set_soft_dec_lut | ( | const std::vector< std::vector< float > > & | soft_dec_lut,
|  | int | precision )

Define a soft decision look-up table.

Define a soft decision look-up table (LUT). Because soft decisions can be calculated in various ways with various levels of accuracy and complexity, this function allows users to create a LUT in their own way.

Setting the LUT here means that has_soft_dec_lut will return true. Decision vectors returned by soft_decision_maker will be calculated using this LUT.

Parameters

  soft_dec_lut | The soft decision LUT as a vector of tuples (vectors in C++) of soft decisions. Each element of the LUT is a vector of k-bit floats (where there are k bits/sample in the constellation).
  precision | The number of bits of precision used when generating the LUT.

References soft_dec_lut().

## soft_dec_lut()

std::vector< std::vector< float > > gr::digital::constellation::soft_dec_lut | ( |  | ) |

Referenced by set_soft_dec_lut().

## soft_decision_maker()

std::vector< float > gr::digital::constellation::soft_decision_maker | ( | gr_complex | sample | ) |

Returns the soft decisions for the given `sample`.

Returns the soft decisions for the given `sample`. If a LUT is defined for the object, the decisions will be calculated from there. Otherwise, this function will call calc_soft_dec directly to calculate the soft decisions.

Parameters

  sample | The complex sample to get the soft decisions.

## v_points()

std::vector< std::vector< gr_complex > > gr::digital::constellation::v_points | ( |  | ) |

Returns a vector of vectors of points.

## Member Data Documentation

## d_apply_pre_diff_code

bool gr::digital::constellation::d_apply_pre_diff_code

protected

Referenced by apply_pre_diff_code(), and set_pre_diff_code().

## d_arity

unsigned int gr::digital::constellation::d_arity

protected

Referenced by arity().

## d_constellation

std::vector<gr_complex> gr::digital::constellation::d_constellation

protected

Referenced by bits_per_symbol(), and points().

## d_dimensionality

unsigned int gr::digital::constellation::d_dimensionality

protected

Referenced by bits_per_symbol(), and dimensionality().

## d_im_max

float gr::digital::constellation::d_im_max

protected

## d_im_min

float gr::digital::constellation::d_im_min

protected

## d_lut_precision

int gr::digital::constellation::d_lut_precision

protected

## d_lut_scale

float gr::digital::constellation::d_lut_scale

protected

## d_maxamp

float gr::digital::constellation::d_maxamp

protected

## d_npwr

float gr::digital::constellation::d_npwr

protected

## d_padding

float gr::digital::constellation::d_padding

protected

## d_pre_diff_code

std::vector<int> gr::digital::constellation::d_pre_diff_code

protected

Referenced by pre_diff_code().

## d_re_max

float gr::digital::constellation::d_re_max

protected

## d_re_min

float gr::digital::constellation::d_re_min

protected

## d_rotational_symmetry

unsigned int gr::digital::constellation::d_rotational_symmetry

protected

Referenced by rotational_symmetry().

## d_scalefactor

float gr::digital::constellation::d_scalefactor

protected

The factor by which the user given constellation points were scaled by to achieve an average amplitude of 1.

## d_soft_dec_lut

std::vector<std::vector<float> > gr::digital::constellation::d_soft_dec_lut

protected

## d_use_external_lut

bool gr::digital::constellation::d_use_external_lut

protected

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

- constellation.h