This commit is contained in:
2025-10-23 22:36:57 +02:00
parent bf8421abb6
commit 98ccdf857f
4 changed files with 4199 additions and 841 deletions

File diff suppressed because it is too large Load Diff

BIN
QAM/out

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -377,7 +377,7 @@ int main () {
init_constellation(&qam);
// Conversion du texte en bits
char* texte = "Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux";
char* texte = "Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux";
int nb_chars = strlen(texte);
int nb_bits = nb_chars * 8;
int nb_symbols = (nb_bits + qam.k - 1) / qam.k;
@ -389,7 +389,7 @@ int main () {
bits_to_symbols(&qam, input_bits, nb_bits, symbols);
// Initialisation du préambule
int L = 16;
int L = 15;
int total_samples = qam.N * (nb_symbols + L);
double complex* preamble = malloc(sizeof(double complex) * L);
@ -404,17 +404,17 @@ int main () {
double complex* s_with_preamble = concat_preamble_signal(preamble_mod, L, s_mod, nb_symbols, qam.N);
// Ajout du bruit
add_noise(s_with_preamble, total_samples, 24);
add_noise(s_with_preamble, total_samples, 20);
FILE *fp_ref = fopen("constellation_ref.dat", "w");
fill_constellation_data(&qam, fp_ref);
fclose(fp_ref);
// Ajout de dephasage
add_dephasage(s_with_preamble, M_PI / 6.0 , total_samples);
add_dephasage(s_with_preamble, M_PI / 2.0 , total_samples);
// AJout de decalage de fréquence
add_freq(&qam, s_with_preamble, 50, total_samples);
add_freq(&qam, s_with_preamble, 100, total_samples);
// Estimation / correction du CFO
cfo(s_with_preamble, qam.N, L, qam.Fs, total_samples, qam.Fc);
@ -425,15 +425,13 @@ int main () {
// PLL
double complex* s_corrected = malloc(sizeof(double complex) * total_samples);
double Kp = 0.5;
double Ki = 0.01;
double Kp = 0.03;
double Ki = 0.002;
double alpha = 0.1;
FILE *fp_pll_error = fopen("pll_error.dat", "w");
pll(&qam, s_with_preamble, s_corrected, L, total_samples, nb_symbols, Kp, Ki, alpha, fp_pll_error);
fclose(fp_pll_error);
// Démodulation
FILE *fp_constel = fopen("constellation.dat", "w");
uint8_t* output_bits = (uint8_t*)malloc(nb_bits * sizeof(uint8_t));