Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 115:23f8b7b2b63a
Use DDS1 to change frep in the measurement of N3. Improve some variable names
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 05 Jul 2013 16:06:26 +0200 |
parents | 77b442322984 |
children | 4f56dbdad85d |
line wrap: on
line diff
--- a/FXAnalyse.c Tue Jul 02 13:07:18 2013 +0200 +++ b/FXAnalyse.c Fri Jul 05 16:06:26 2013 +0200 @@ -59,8 +59,6 @@ muParserHandle_t MathParser1, MathParser2, MathParser3, MathParser4, MathParser5; - - double Ndiv = 8.0; int settling = 0; @@ -88,7 +86,7 @@ int Measuring_2 = N_MEASUREMENT_NONE; int Measuring_3 = N_MEASUREMENT_NONE; -double FrequDDS1=110000000.0, FrequDDS4=110000000.0; +double FrequDDS1=110000000.0; double Slope_1=0.0, Slope_2=0.0, Slope_3=0.0, Beatslope_2=0.0; double SlopeTime1=40.0, SlopeTime2=40.0, SlopeTime3=40.0; double Ch4Slope = 0.0; @@ -96,7 +94,7 @@ double N_1=0.0, N_2=0.0, N_3=0.0; double DeltaT_1=20.0, DeltakHz_1=500.0, t1_1=0.0, t2_1=0.0, t3_1=0.0, Frepplus_1=0.0, Frepminus_1=0.0; double DeltaT_2=20.0, DeltakHz_2=500.0, t1_2=0.0, t2_2=0.0, t3_2=0.0, Frepplus_2=0.0, Frepminus_2=0.0; -double DeltaT_3=20.0, DeltakHz_3=500.0, t1_3=0.0, t2_3=0.0, t3_3=0.0, Frepplus_3=0.0, Frepminus_3=0.0; +double DeltaT_3=20.0, DeltakHz_3=500.0, t1_3=0.0, t2_3=0.0, t3_3=0.0; int n_1=0, n_2=0, n_3=0; @@ -106,6 +104,7 @@ double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0; double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6; +double f_rep_plus, f_rep_minus; double f_beat_Sr_plus, f_beat_Sr_minus; double Step1=800000.0,Step2=800000.0; @@ -744,7 +743,7 @@ SetCtrlVal(CalcNPanel, CALCN_SLOPE, Slope_1); // frep positive step - DDS4xAD9912_RampFrequency(&DDS4xAD9912,1, FrequDDS1, FrequDDS1 + DeltakHz_1 * 1000.0, FREP_STEP_SIZE); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1, FrequDDS1 + DeltakHz_1 * 1000.0, FREP_STEP_SIZE); SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 + DeltakHz_1 * 1000.0); // allow counter to settle @@ -1031,15 +1030,15 @@ case N_MEASUREMENT_INIT: // init - SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, FrequDDS4); + SetCtrlVal(MainPanel, 1, FrequDDS1); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); settling = 3; t1_3 = utc; stat_zero(&stat_ch2); stat_zero(&stat_ch3); - f_beat_Sr_plus = 0.0; - f_beat_Sr_minus = 0.0; + f_rep_plus = f_rep_minus = 0.0; + f_beat_Sr_plus = f_beat_Sr_minus = 0.0; // record current DDS3 frequency GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyDDS3Init); @@ -1068,8 +1067,8 @@ stat_zero(&stat_ch3); // frep positive step - SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4 + DeltakHz_3 * 1000); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 4, FrequDDS4, FrequDDS4 + DeltakHz_3 * 1000, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 + DeltakHz_3 * 1000); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1, FrequDDS1 + DeltakHz_3 * 1000, FREP_STEP_SIZE); // compensate with DDS3 to keep measured beatnote in counter box range double fDDS3 = FrequencyDDS3Init + Signe1 * Signe3 * N3/N1 * Ndiv * DeltakHz_3 * 1000; SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); @@ -1113,20 +1112,20 @@ } n_3++; - Frepplus_3 += Math1 + 250000000 - Slope_3 * (utc - t3_2); + f_rep_plus += Math1 + 250000000 - Slope_3 * (utc - t3_2); f_beat_Sr_plus += Ch3; if (utc - t2_3 > DeltaT_3) { // positive step measurement - Frepplus_3 = Frepplus_3 / n_3; + f_rep_plus = f_rep_plus / n_3; f_beat_Sr_plus = f_beat_Sr_plus / n_3; n_3 = 0; t3_3 = utc; // frep negative step - SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4 - DeltakHz_3 * 1000); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 4, FrequDDS4 + DeltakHz_3 * 1000, FrequDDS4 - DeltakHz_3 * 1000, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 - DeltakHz_3 * 1000); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 + DeltakHz_3 * 1000, FrequDDS1 - DeltakHz_3 * 1000, FREP_STEP_SIZE); // compensate with DDS3 to keep measured beatnote in counter box range double fDDS3 = FrequencyDDS3Init - Signe1 * Signe3 * N3/N1 * Ndiv * DeltakHz_3 * 1000; SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); @@ -1150,18 +1149,18 @@ } n_3++; - Frepminus_3 += Ch2 - Slope_3 * (utc - t3_3); + f_rep_minus += Ch2 - Slope_3 * (utc - t3_3); f_beat_Sr_minus += Ch3; if (utc - t3_3 > DeltaT_3) { // negative step measurement - Frepminus_3 = Frepminus_3 / n_3; + f_rep_minus = f_rep_minus / n_3; f_beat_Sr_minus = f_beat_Sr_plus / n_3; // check delta frep - double delta_f_rep = Frepplus_3 - Frepplus_3; + double delta_f_rep = f_rep_plus - f_rep_minus; double expected = N1 / Ndiv * 2.0 * DeltakHz_3 * 1000.0; - logmsg("delta frep=%g expected=%g", delta_f_rep, expected); + logmsg("delta frep=%g Hz expected=%g Hz", delta_f_rep, expected); // compute N3 double delta_f_beat_Sr = f_beat_Sr_plus - f_beat_Sr_minus + 2.0 * N3/N1 * Ndiv * DeltakHz_3 * 1000; @@ -1173,12 +1172,10 @@ t2_3=0.0; t3_3=0.0; n_3 = 0; - Frepminus_3 = 0.0; - Frepplus_3 = 0.0; // back to nominal frep - SetCtrlVal(MainPanel, PANEL_DDS4, FrequDDS4); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 4, FrequDDS4 - DeltakHz_3 * 1000, FrequDDS4, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 - DeltakHz_3 * 1000, FrequDDS1, FREP_STEP_SIZE); // back to initial DDS3 frequency SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init);