diff FXAnalyse.c @ 156:4ab8099a18e2

Add beatnote frequency drift correction to N3 measurement
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 03 Feb 2014 12:30:39 +0100
parents b060780ade19
children 9154291658ef
line wrap: on
line diff
--- a/FXAnalyse.c	Fri Jan 31 21:39:58 2014 +0100
+++ b/FXAnalyse.c	Mon Feb 03 12:30:39 2014 +0100
@@ -202,7 +202,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_slope;
+double f_rep_slope, f_beat_slope;
 double f_rep_plus, f_rep_minus;
 double f_beat_Sr_plus, f_beat_Sr_minus;
 
@@ -1054,6 +1054,7 @@
 						
 						t1_3 = utc;
 						stat_zero(&stat_math1);
+						stat_zero(&stat_ch3);
 						f_rep_plus = f_rep_minus = 0.0;
 						f_beat_Sr_plus = f_beat_Sr_minus = 0.0;
 						
@@ -1074,11 +1075,15 @@
 						}
 						
 						stat_accumulate(&stat_math1, Math1);
+						stat_accumulate(&stat_ch3, Ch3);
 						
 						if (utc - t1_3 > SlopeTime3) {
 							// slope measurement
 							f_rep_slope = stat_math1.slope;
-							
+							logmsg("f_rep_slope=%e Hz/s", f_rep_slope);
+							f_beat_slope = stat_ch3.slope;
+							logmsg("f_beat_slope=%e Hz/s", f_rep_slope);
+
 							t2_3 = utc;
 							
 							// frep positive step
@@ -1128,7 +1133,7 @@
 						
 						n_3++;
 						f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t3_2);
-						f_beat_Sr_plus += Ch3;
+						f_beat_Sr_plus += Ch3 - f_beat_slope * (utc - t3_2);
 						
 						if (utc - t2_3 > DeltaT_3) {
 							// positive step measurement
@@ -1164,7 +1169,7 @@
 						
 						n_3++;
 						f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t3_2);
-						f_beat_Sr_minus += Ch3;
+						f_beat_Sr_minus += Ch3 - f_beat_slope * (utc - t3_2);
 						
 						if (utc - t3_3 > DeltaT_3) {
 							// negative step measurement
@@ -1173,7 +1178,7 @@
 							
 							// check delta frep
 							double delta_f_rep_m = f_rep_plus - f_rep_minus;
-							double delta_f_rep = -Sign1 * Ndiv * 2.0 * DeltakHz_3 * 1000.0 / N1;
+							double delta_f_rep = Sign1 * Ndiv * 2.0 * DeltakHz_3 * 1000.0 / N1;
 							logmsg("delta frep: measured=%.12e Hz expected=%.12e Hz difference=%.12e", 
 								delta_f_rep_m, delta_f_rep, delta_f_rep_m - delta_f_rep);