Mercurial > hg > fxanalyse
comparison 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 |
comparison
equal
deleted
inserted
replaced
155:b060780ade19 | 156:4ab8099a18e2 |
---|---|
200 double FrequencyDDS3Init = 0.0; | 200 double FrequencyDDS3Init = 0.0; |
201 | 201 |
202 double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0; | 202 double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0; |
203 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6; | 203 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6; |
204 | 204 |
205 double f_rep_slope; | 205 double f_rep_slope, f_beat_slope; |
206 double f_rep_plus, f_rep_minus; | 206 double f_rep_plus, f_rep_minus; |
207 double f_beat_Sr_plus, f_beat_Sr_minus; | 207 double f_beat_Sr_plus, f_beat_Sr_minus; |
208 | 208 |
209 double Ch4Plus=0.0,Ch4Minus=0.0; | 209 double Ch4Plus=0.0,Ch4Minus=0.0; |
210 | 210 |
1052 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); | 1052 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); |
1053 settling = 3; | 1053 settling = 3; |
1054 | 1054 |
1055 t1_3 = utc; | 1055 t1_3 = utc; |
1056 stat_zero(&stat_math1); | 1056 stat_zero(&stat_math1); |
1057 stat_zero(&stat_ch3); | |
1057 f_rep_plus = f_rep_minus = 0.0; | 1058 f_rep_plus = f_rep_minus = 0.0; |
1058 f_beat_Sr_plus = f_beat_Sr_minus = 0.0; | 1059 f_beat_Sr_plus = f_beat_Sr_minus = 0.0; |
1059 | 1060 |
1060 // record current DDS frequencies | 1061 // record current DDS frequencies |
1061 FrequencyDDSBesInit = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); | 1062 FrequencyDDSBesInit = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); |
1072 settling--; | 1073 settling--; |
1073 break; | 1074 break; |
1074 } | 1075 } |
1075 | 1076 |
1076 stat_accumulate(&stat_math1, Math1); | 1077 stat_accumulate(&stat_math1, Math1); |
1078 stat_accumulate(&stat_ch3, Ch3); | |
1077 | 1079 |
1078 if (utc - t1_3 > SlopeTime3) { | 1080 if (utc - t1_3 > SlopeTime3) { |
1079 // slope measurement | 1081 // slope measurement |
1080 f_rep_slope = stat_math1.slope; | 1082 f_rep_slope = stat_math1.slope; |
1081 | 1083 logmsg("f_rep_slope=%e Hz/s", f_rep_slope); |
1084 f_beat_slope = stat_ch3.slope; | |
1085 logmsg("f_beat_slope=%e Hz/s", f_rep_slope); | |
1086 | |
1082 t2_3 = utc; | 1087 t2_3 = utc; |
1083 | 1088 |
1084 // frep positive step | 1089 // frep positive step |
1085 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 + DeltakHz_3 * 1000); | 1090 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 + DeltakHz_3 * 1000); |
1086 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 + DeltakHz_3 * 1000, FREP_STEP_SIZE); | 1091 DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 + DeltakHz_3 * 1000, FREP_STEP_SIZE); |
1126 break; | 1131 break; |
1127 } | 1132 } |
1128 | 1133 |
1129 n_3++; | 1134 n_3++; |
1130 f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t3_2); | 1135 f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t3_2); |
1131 f_beat_Sr_plus += Ch3; | 1136 f_beat_Sr_plus += Ch3 - f_beat_slope * (utc - t3_2); |
1132 | 1137 |
1133 if (utc - t2_3 > DeltaT_3) { | 1138 if (utc - t2_3 > DeltaT_3) { |
1134 // positive step measurement | 1139 // positive step measurement |
1135 f_rep_plus = f_rep_plus / n_3; | 1140 f_rep_plus = f_rep_plus / n_3; |
1136 f_beat_Sr_plus = f_beat_Sr_plus / n_3; | 1141 f_beat_Sr_plus = f_beat_Sr_plus / n_3; |
1162 break; | 1167 break; |
1163 } | 1168 } |
1164 | 1169 |
1165 n_3++; | 1170 n_3++; |
1166 f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t3_2); | 1171 f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t3_2); |
1167 f_beat_Sr_minus += Ch3; | 1172 f_beat_Sr_minus += Ch3 - f_beat_slope * (utc - t3_2); |
1168 | 1173 |
1169 if (utc - t3_3 > DeltaT_3) { | 1174 if (utc - t3_3 > DeltaT_3) { |
1170 // negative step measurement | 1175 // negative step measurement |
1171 f_rep_minus = f_rep_minus / n_3; | 1176 f_rep_minus = f_rep_minus / n_3; |
1172 f_beat_Sr_minus = f_beat_Sr_minus / n_3; | 1177 f_beat_Sr_minus = f_beat_Sr_minus / n_3; |
1173 | 1178 |
1174 // check delta frep | 1179 // check delta frep |
1175 double delta_f_rep_m = f_rep_plus - f_rep_minus; | 1180 double delta_f_rep_m = f_rep_plus - f_rep_minus; |
1176 double delta_f_rep = -Sign1 * Ndiv * 2.0 * DeltakHz_3 * 1000.0 / N1; | 1181 double delta_f_rep = Sign1 * Ndiv * 2.0 * DeltakHz_3 * 1000.0 / N1; |
1177 logmsg("delta frep: measured=%.12e Hz expected=%.12e Hz difference=%.12e", | 1182 logmsg("delta frep: measured=%.12e Hz expected=%.12e Hz difference=%.12e", |
1178 delta_f_rep_m, delta_f_rep, delta_f_rep_m - delta_f_rep); | 1183 delta_f_rep_m, delta_f_rep, delta_f_rep_m - delta_f_rep); |
1179 | 1184 |
1180 logmsg("f_beat_Sr_minus=%.12e", f_beat_Sr_minus); | 1185 logmsg("f_beat_Sr_minus=%.12e", f_beat_Sr_minus); |
1181 logmsg("f_beat_Sr_plus =%.12e", f_beat_Sr_plus); | 1186 logmsg("f_beat_Sr_plus =%.12e", f_beat_Sr_plus); |