changeset 61:37075b60408b

Fix N2 measurement after cleanup. Further simplification
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 18 Oct 2012 12:24:31 +0200
parents cd7b5903f168
children 53dbce5f0745
files FXAnalyse.c
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/FXAnalyse.c	Thu Oct 18 12:24:19 2012 +0200
+++ b/FXAnalyse.c	Thu Oct 18 12:24:31 2012 +0200
@@ -83,8 +83,8 @@
 double  Beat_slope_2=0.0 ,Moy_Beatslope_2=0.0,Slope_Beatslope_2=0.0; 
 double Ch4_slope=0.0,Moy_Ch4slope_1=0.0,Slope_Ch4slope_1=0.0,Ch4Slope=0.0;
 
-double FrequencyDDSBes=0.0,FrequencyDDSBesInit=0.0;
-double FrequencyDDS3=0.0,FrequencyDDS3Init=0.0;
+double FrequencyDDSBesInit = 0.0;
+double FrequencyDDS3Init = 0.0;
 
 double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0;
 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6;  
@@ -888,10 +888,13 @@
 							
 							// frep positive step
 							double fDDS1 = FrequDDS1 + DeltakHz_2 * 1000;
+							printf("fDDS1 = %g\n", fDDS1);
 							DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, FrequDDS1, fDDS1, Step2/Ndiv);
 							SetCtrlVal(MainPanel, PANEL_DDS1, fDDS1);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, fDDS1);
+							// adjust DDS3 to keep beatnote within the bandpass filter. prediction
 							DeltaDDS3 = -DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2);
+							printf("deltaDDS3 = %g\n", DeltaDDS3);
 							SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init + DeltaDDS3);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init + DeltaDDS3);
 						
@@ -911,17 +914,15 @@
 							settling--;
 							break;
 						}
-
-						double DeltaFrep275 = 275000 - Ch4;
-						double DeltaFrep10 = 10000 - Ch2;
+						
+						double fDDS2 = DDS4xAD9912.Frequency2 + 275000 - Ch4;
+						SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2);
+						DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2);
 						
-						DeltaDDS3 = DeltaDDS3 + DeltaFrep10;
-						FrequencyDDSBes = FrequencyDDSBes + DeltaFrep275;
-						FrequencyDDS3 = FrequencyDDS3 + DeltaDDS3;
-						SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBes);
-						DDS4xAD9912_SetFrequency(&DDS4xAD9912,2,FrequencyDDSBes);
-						SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3);
-						DDS4xAD9912_SetFrequency(&DDS4xAD9912,3,FrequencyDDS3);
+						double fDDS3 = DDS4xAD9912.Frequency3 + 10000 - Ch2;
+						DeltaDDS3 = DeltaDDS3 + 10000 - Ch2;
+						SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3);
+						DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 
 						// allow counter to settle
 						settling = 3;
@@ -954,9 +955,10 @@
 							DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, (FrequDDS1+DeltakHz_2*1000),(FrequDDS1-DeltakHz_2*1000), Step2/Ndiv);
 							SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1-DeltakHz_2*1000));
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912,1, (FrequDDS1-DeltakHz_2*1000));
-							DeltaDDS3 = (FrequencyDDS3Init+DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1)) - FrequencyDDS3;
-							SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3+DeltaDDS3);
-							DDS4xAD9912_SetFrequency(&DDS4xAD9912,3, FrequencyDDS3+DeltaDDS3);
+							double fDDS3 = FrequencyDDS3Init+DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1);
+							DeltaDDS3 = fDDS3 - DDS4xAD9912.Frequency3;
+							SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3);
+							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 
 							// allow counter to settle
 							settling = 3;
@@ -1008,7 +1010,6 @@
 							Frepplus_2 = 0.0;
 							Delta10K_Minus = 0.0;
 							Delta10K_Plus = 0.0;
-							FrequencyDDSBes = 0.0;
 
 							// done
 							Measuring_2 = N_MEASUREMENT_NONE;