11 #ifndef INCLUDED_DIGITAL_CONSTELLATION_H
12 #define INCLUDED_DIGITAL_CONSTELLATION_H
18 #include <boost/any.hpp>
31 typedef std::shared_ptr<constellation> constellation_sptr;
59 std::vector<int> pre_diff_code,
60 unsigned int rotational_symmetry,
61 unsigned int dimensionality,
92 std::vector<gr_complex>
points() {
return d_constellation; }
97 std::vector<std::vector<gr_complex>>
v_points();
113 return floor(log(
double(d_constellation.size())) / d_dimensionality / log(2.0));
116 unsigned int arity() {
return d_arity; }
118 constellation_sptr
base() {
return shared_from_this(); }
253 typedef std::shared_ptr<constellation_calcdist>
sptr;
270 std::vector<int> pre_diff_code,
271 unsigned int rotational_symmetry,
272 unsigned int dimensionality,
282 std::vector<int> pre_diff_code,
283 unsigned int rotational_symmetry,
284 unsigned int dimensionality,
318 std::vector<int> pre_diff_code,
319 unsigned int rotational_symmetry,
320 unsigned int dimensionality,
321 unsigned int n_sectors,
336 std::vector<int> sector_values;
360 typedef std::shared_ptr<constellation_rect>
sptr;
378 make(std::vector<gr_complex> constell,
379 std::vector<int> pre_diff_code,
380 unsigned int rotational_symmetry,
381 unsigned int real_sectors,
382 unsigned int imag_sectors,
383 float width_real_sectors,
384 float width_imag_sectors,
390 std::vector<int> pre_diff_code,
391 unsigned int rotational_symmetry,
392 unsigned int real_sectors,
393 unsigned int imag_sectors,
394 float width_real_sectors,
395 float width_imag_sectors,
403 unsigned int n_real_sectors;
404 unsigned int n_imag_sectors;
405 float d_width_real_sectors;
406 float d_width_imag_sectors;
434 typedef std::shared_ptr<constellation_expl_rect>
sptr;
437 std::vector<int> pre_diff_code,
438 unsigned int rotational_symmetry,
439 unsigned int real_sectors,
440 unsigned int imag_sectors,
441 float width_real_sectors,
442 float width_imag_sectors,
443 std::vector<unsigned int> sector_values);
448 std::vector<int> pre_diff_code,
449 unsigned int rotational_symmetry,
450 unsigned int real_sectors,
451 unsigned int imag_sectors,
452 float width_real_sectors,
453 float width_imag_sectors,
454 std::vector<unsigned int> sector_values);
458 return d_sector_values[sector];
462 std::vector<unsigned int> d_sector_values;
484 typedef std::shared_ptr<constellation_psk>
sptr;
488 std::vector<int> pre_diff_code,
489 unsigned int n_sectors);
499 std::vector<int> pre_diff_code,
500 unsigned int n_sectors);
523 typedef std::shared_ptr<constellation_bpsk>
sptr;
559 typedef std::shared_ptr<constellation_qpsk>
sptr;
594 typedef std::shared_ptr<constellation_dqpsk>
sptr;
631 typedef std::shared_ptr<constellation_8psk>
sptr;
667 typedef std::shared_ptr<constellation_8psk_natural>
sptr;
705 typedef std::shared_ptr<constellation_16qam>
sptr;
Digital constellation for 16qam.
Definition: constellation.h:703
std::shared_ptr< constellation_16qam > sptr
Definition: constellation.h:705
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
~constellation_16qam() override
Digital constellation for natually mapped 8PSK.
Definition: constellation.h:665
std::shared_ptr< constellation_8psk_natural > sptr
Definition: constellation.h:667
~constellation_8psk_natural() override
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
constellation_8psk_natural()
Digital constellation for 8PSK.
Definition: constellation.h:629
std::shared_ptr< constellation_8psk > sptr
Definition: constellation.h:631
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
~constellation_8psk() override
Digital constellation for BPSK .
Definition: constellation.h:521
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
~constellation_bpsk() override
std::shared_ptr< constellation_bpsk > sptr
Definition: constellation.h:523
Calculate Euclidean distance for any constellation.
Definition: constellation.h:251
std::shared_ptr< constellation_calcdist > sptr
Definition: constellation.h:253
constellation_calcdist(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, normalization_t normalization=AMPLITUDE_NORMALIZATION)
static sptr make(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, normalization_t normalization=AMPLITUDE_NORMALIZATION)
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
Digital constellation for DQPSK.
Definition: constellation.h:592
~constellation_dqpsk() override
std::shared_ptr< constellation_dqpsk > sptr
Definition: constellation.h:594
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
Rectangular digital constellation.
Definition: constellation.h:432
unsigned int calc_sector_value(unsigned int sector) override
Definition: constellation.h:456
static sptr make(std::vector< gr_complex > constellation, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors, std::vector< unsigned int > sector_values)
~constellation_expl_rect() override
constellation_expl_rect(std::vector< gr_complex > constellation, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors, std::vector< unsigned int > sector_values)
std::shared_ptr< constellation_expl_rect > sptr
Definition: constellation.h:434
constellation_psk
Definition: constellation.h:482
unsigned int get_sector(const gr_complex *sample) override
std::shared_ptr< constellation_psk > sptr
Definition: constellation.h:484
constellation_psk(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int n_sectors)
unsigned int calc_sector_value(unsigned int sector) override
~constellation_psk() override
static sptr make(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int n_sectors)
Digital constellation for QPSK.
Definition: constellation.h:557
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
std::shared_ptr< constellation_qpsk > sptr
Definition: constellation.h:559
~constellation_qpsk() override
Rectangular digital constellation.
Definition: constellation.h:358
unsigned int get_sector(const gr_complex *sample) override
~constellation_rect() override
std::shared_ptr< constellation_rect > sptr
Definition: constellation.h:360
unsigned int calc_sector_value(unsigned int sector) override
constellation_rect(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors, normalization_t normalization=AMPLITUDE_NORMALIZATION)
gr_complex calc_sector_center(unsigned int sector)
static constellation_rect::sptr make(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors, normalization_t normalization=AMPLITUDE_NORMALIZATION)
Sectorized digital constellation.
Definition: constellation.h:302
unsigned int decision_maker(const gr_complex *sample) override
Returns the constellation point that matches best.
virtual unsigned int calc_sector_value(unsigned int sector)=0
~constellation_sector() override
unsigned int n_sectors
Definition: constellation.h:333
virtual unsigned int get_sector(const gr_complex *sample)=0
void find_sector_values()
constellation_sector(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, unsigned int n_sectors, normalization_t normalization=AMPLITUDE_NORMALIZATION)
An abstracted constellation object.
Definition: constellation.h:50
constellation_sptr base()
Definition: constellation.h:118
float d_maxamp
Definition: constellation.h:220
bool d_apply_pre_diff_code
Definition: constellation.h:214
virtual void calc_hard_symbol_metric(const gr_complex *sample, float *metric)
void gen_soft_dec_lut(int precision, float npwr=-1)
Generates the soft decision LUT based on constellation and symbol map.
std::vector< int > pre_diff_code()
Returns the encoding to apply before differential encoding.
Definition: constellation.h:105
std::vector< gr_complex > s_points()
Returns the vector of points in this constellation. Raise error if dimensionality is not one.
std::vector< gr_complex > d_constellation
Definition: constellation.h:212
bool has_soft_dec_lut()
Returns True if the soft decision LUT has been defined, False otherwise.
std::vector< int > d_pre_diff_code
Definition: constellation.h:213
std::vector< gr_complex > points()
Returns the set of points in this constellation.
Definition: constellation.h:92
virtual void calc_metric(const gr_complex *sample, float *metric, gr::digital::trellis_metric_type_t type)
Calculates distance.
pmt::pmt_t as_pmt()
Definition: constellation.h:120
unsigned int arity()
Definition: constellation.h:116
std::vector< std::vector< float > > soft_dec_lut()
int d_lut_precision
Definition: constellation.h:224
float get_distance(unsigned int index, const gr_complex *sample)
float d_im_max
Definition: constellation.h:221
virtual void calc_euclidean_metric(const gr_complex *sample, float *metric)
unsigned int rotational_symmetry()
Returns the order of rotational symmetry.
Definition: constellation.h:107
unsigned int decision_maker_v(std::vector< gr_complex > sample)
Takes a vector rather than a pointer. Better for SWIG wrapping.
normalization_t
Definition: constellation.h:52
@ POWER_NORMALIZATION
Definition: constellation.h:54
@ NO_NORMALIZATION
Definition: constellation.h:53
@ AMPLITUDE_NORMALIZATION
Definition: constellation.h:55
unsigned int d_rotational_symmetry
Definition: constellation.h:215
std::vector< gr_complex > map_to_points_v(unsigned int value)
void set_pre_diff_code(bool a)
Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
Definition: constellation.h:103
void map_to_points(unsigned int value, gr_complex *points)
Returns the constellation points for a symbol value.
std::vector< std::vector< float > > d_soft_dec_lut
Definition: constellation.h:223
unsigned int d_dimensionality
Definition: constellation.h:216
bool apply_pre_diff_code()
Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
Definition: constellation.h:100
virtual std::vector< float > calc_soft_dec(gr_complex sample, float npwr=-1)
Calculate soft decisions for the given sample.
bool d_use_external_lut
Definition: constellation.h:228
unsigned int decision_maker_pe(const gr_complex *sample, float *phase_error)
Also calculates the phase error.
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)
unsigned int d_arity
Definition: constellation.h:217
float d_npwr
Definition: constellation.h:226
void set_soft_dec_lut(const std::vector< std::vector< float >> &soft_dec_lut, int precision)
Define a soft decision look-up table.
void normalize(normalization_t normalization)
Normalizes the constellation.
unsigned int dimensionality()
Returns the number of complex numbers in a single symbol.
Definition: constellation.h:109
float d_lut_scale
Definition: constellation.h:225
unsigned int bits_per_symbol()
Definition: constellation.h:111
float d_padding
Definition: constellation.h:227
virtual unsigned int decision_maker(const gr_complex *sample)=0
Returns the constellation point that matches best.
void set_npwr(float npwr)
Sets the constellation noise power and recalculates LUT given npwr.
std::vector< float > soft_decision_maker(gr_complex sample)
Returns the soft decisions for the given sample.
std::vector< std::vector< gr_complex > > v_points()
Returns a vector of vectors of points.
unsigned int get_closest_point(const gr_complex *sample)
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
std::complex< float > gr_complex
Definition: gr_complex.h:15
trellis_metric_type_t
Definition: metric_type.h:17
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
PMT_API pmt_t make_any(const boost::any &any)
make an any