Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 39:2e1b3148d6e6
Add setting to invert the sign of the measured slope on dedrifting
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 05 Oct 2012 12:53:39 +0200 |
parents | 5e81800fe354 |
children | 50544ecfcfc7 |
comparison
equal
deleted
inserted
replaced
38:537ca522c8b1 | 39:2e1b3148d6e6 |
---|---|
137 enum { | 137 enum { |
138 SLOPE_REFERENCE_MICROWAVE = 0, | 138 SLOPE_REFERENCE_MICROWAVE = 0, |
139 SLOPE_REFERENCE_HG_CAVITY = 1, | 139 SLOPE_REFERENCE_HG_CAVITY = 1, |
140 }; | 140 }; |
141 | 141 |
142 int invertSlopeSign = 0; | |
142 int slopeReference = SLOPE_REFERENCE_MICROWAVE; | 143 int slopeReference = SLOPE_REFERENCE_MICROWAVE; |
143 | 144 |
144 volatile bool KeepCentering=FALSE; | 145 volatile bool KeepCentering=FALSE; |
145 double Timetorecenter275K=3600.0*10; | 146 double Timetorecenter275K=3600.0*10; |
146 double Timetorecenter10K=3600.0*3; | 147 double Timetorecenter10K=3600.0*3; |
148 double CenteringTimeBegin10K=0.0; | 149 double CenteringTimeBegin10K=0.0; |
149 | 150 |
150 | 151 |
151 int DDSFox_Set(DDSParameter *DDS, double Frequency, double Sweeprate) | 152 int DDSFox_Set(DDSParameter *DDS, double Frequency, double Sweeprate) |
152 { | 153 { |
154 printf("DDSFox_Set(Frequency=%g, Sweeprate=%g)\n", Frequency, Sweeprate); | |
155 | |
153 DDS->Frequency = Frequency; | 156 DDS->Frequency = Frequency; |
154 DDS->SweepRate = Sweeprate; | 157 DDS->SweepRate = Sweeprate; |
155 | 158 |
156 DDSFox_SetFreq(DDS); | 159 DDSFox_SetFreq(DDS); |
157 DDSFox_SetDf(DDS); | 160 DDSFox_SetDf(DDS); |
1272 | 1275 |
1273 if (utc-SlopeMeasuringTimeBegin > TimetoSlope) | 1276 if (utc-SlopeMeasuringTimeBegin > TimetoSlope) |
1274 { | 1277 { |
1275 Nratio = Nratio + 1; | 1278 Nratio = Nratio + 1; |
1276 | 1279 |
1277 if (Nratio >= 1) | 1280 if (Nratio >= 1) { |
1278 { | |
1279 MoyMath2 = MoyMath2 + Moy_Math2slope; | 1281 MoyMath2 = MoyMath2 + Moy_Math2slope; |
1280 } | 1282 } |
1281 SlopeMath2 = SlopeMath2 + Slope_Math2slope; | 1283 |
1284 if (invertSlopeSign) { | |
1285 SlopeMath2 = SlopeMath2 - Slope_Math2slope; | |
1286 } else { | |
1287 SlopeMath2 = SlopeMath2 + Slope_Math2slope; | |
1288 } | |
1289 | |
1282 N_Math2slope = 0.0; | 1290 N_Math2slope = 0.0; |
1283 Math2_slope = 0.0; | 1291 Math2_slope = 0.0; |
1284 Moy_Math2slope = 0.0; | 1292 Moy_Math2slope = 0.0; |
1285 Slope_Math2slope = 0.0; | 1293 Slope_Math2slope = 0.0; |
1286 | 1294 |
1289 CenterFrequencyCh2 = MoyMath2; | 1297 CenterFrequencyCh2 = MoyMath2; |
1290 CenterFrequencyCh2ToDetermine = FALSE; | 1298 CenterFrequencyCh2ToDetermine = FALSE; |
1291 } | 1299 } |
1292 | 1300 |
1293 OnSlopeCancelling = TRUE; | 1301 OnSlopeCancelling = TRUE; |
1294 | |
1295 FoxFrequ = DDSFox_ReadFreq(&DDS1xAD9956); | |
1296 | 1302 |
1297 if (Nratio == ratio) | 1303 if (Nratio == ratio) |
1298 { | 1304 { |
1299 if (FrequCorrec == TRUE) | 1305 if (FrequCorrec == TRUE) |
1300 { | 1306 { |
1303 } | 1309 } |
1304 Nratio = 0; | 1310 Nratio = 0; |
1305 MoyMath2 = 0.0; | 1311 MoyMath2 = 0.0; |
1306 } | 1312 } |
1307 | 1313 |
1314 FoxFrequ = DDSFox_ReadFreq(&DDS1xAD9956); | |
1308 SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); | 1315 SetCtrlVal(MainPanel, PANEL_SLOPETOCANCEL, SlopeMath2); |
1309 DDSFox_Set(&DDS1xAD9956, FoxFrequ, SlopeMath2); | 1316 DDSFox_Set(&DDS1xAD9956, FoxFrequ, SlopeMath2); |
1310 | 1317 |
1311 nstabilisationSlopeMeasuring = 0; | 1318 nstabilisationSlopeMeasuring = 0; |
1312 SlopeMeasuringTimeBegin = utc; | 1319 SlopeMeasuringTimeBegin = utc; |
1438 CloseFile(FileExtraMath) ; | 1445 CloseFile(FileExtraMath) ; |
1439 } | 1446 } |
1440 | 1447 |
1441 // Special case to handle change of day at next second | 1448 // Special case to handle change of day at next second |
1442 if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>=58 ) { | 1449 if ( LocalTime.tm_hour==23 && LocalTime.tm_min==59 && strtod(Sec,NULL)>=58 ) { |
1443 printf("Entering change of date substructure\r\n"); | |
1444 printf("old file : %s %s %s \r\n",Date, Time, LogFileName); | |
1445 Acquiring = FALSE ; | 1450 Acquiring = FALSE ; |
1446 do { | 1451 do { |
1447 Delay(5.1); | 1452 Delay(5.1); |
1448 CurrentFileName(LogFileName) ; | 1453 CurrentFileName(LogFileName) ; |
1449 } while (!GetFileInfo(LogFileName, &OldLogFilePtr)); | 1454 } while (!GetFileInfo(LogFileName, &OldLogFilePtr)); |
1450 printf("new file : %s \r\n\r\n",Date, Time, LogFileName); | |
1451 Acquiring = TRUE ; | 1455 Acquiring = TRUE ; |
1452 OldLogFilePtr = 2; | 1456 OldLogFilePtr = 2; |
1453 } | 1457 } |
1454 | 1458 |
1455 ResumeTimerCallbacks() ; | 1459 ResumeTimerCallbacks() ; |
2584 DDSFox_Set(&DDS1xAD9956, frequency, SlopeMath2); | 2588 DDSFox_Set(&DDS1xAD9956, frequency, SlopeMath2); |
2585 break; | 2589 break; |
2586 } | 2590 } |
2587 return 0; | 2591 return 0; |
2588 } | 2592 } |
2593 | |
2594 int CVICALLBACK CB_InvertSlopeSign (int panel, int control, int event, | |
2595 void *callbackData, int eventData1, int eventData2) | |
2596 { | |
2597 switch (event) | |
2598 { | |
2599 case EVENT_COMMIT: | |
2600 GetCtrlVal(panel, control, &invertSlopeSign); | |
2601 break; | |
2602 } | |
2603 return 0; | |
2604 } |