Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 123:35861fe64d14
Allow to set dedrift DDS central frequency. Add option to double applied slope.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Thu, 12 Dec 2013 17:21:15 +0100 |
parents | bdd3ec3c212e |
children | bdfc61a8ebee |
comparison
equal
deleted
inserted
replaced
122:bdd3ec3c212e | 123:35861fe64d14 |
---|---|
16 #include "muParserDLL.h" | 16 #include "muParserDLL.h" |
17 | 17 |
18 #define SR_LOGGER_IP "145.238.204.91" | 18 #define SR_LOGGER_IP "145.238.204.91" |
19 #define DATAFOLDER "Z:\\Measures-2013" | 19 #define DATAFOLDER "Z:\\Measures-2013" |
20 | 20 |
21 #define DEDRIFT_DDS_FREQUENCY 70000000.0 | |
22 #define FREP_STEP_SIZE 50000.0 | 21 #define FREP_STEP_SIZE 50000.0 |
23 | 22 |
24 // number of channels read | 23 // number of channels read |
25 #define NCHAN 4 | 24 #define NCHAN 4 |
26 | 25 |
119 volatile bool Getsign1=FALSE,Getsign2=FALSE,Getsign3=FALSE; | 118 volatile bool Getsign1=FALSE,Getsign2=FALSE,Getsign3=FALSE; |
120 double Signe1=1.0,Signe2=1.0,Signe3=0.0; | 119 double Signe1=1.0,Signe2=1.0,Signe3=0.0; |
121 | 120 |
122 // slope cancelling | 121 // slope cancelling |
123 | 122 |
123 double dedrift_DDS_freq = 70e6; | |
124 int SlopeMeasuring = FALSE; | 124 int SlopeMeasuring = FALSE; |
125 int StopSlopeCancellingOnUnlocked = TRUE; | 125 int StopSlopeCancellingOnUnlocked = TRUE; |
126 double TimetoSlope = 60.0; | 126 double TimetoSlope = 60.0; |
127 double SlopeMeasuringTimeBegin = 0.0; | 127 double SlopeMeasuringTimeBegin = 0.0; |
128 double appliedSlope = 0.0; // currently applied frequency dedrifiting slope | 128 double appliedSlope = 0.0; // currently applied frequency dedrifiting slope |
129 int slopeX2 = FALSE; | |
129 | 130 |
130 double limitotakoff=70.0; | 131 double limitotakoff=70.0; |
131 | 132 |
132 int ratio=10; //Recentre la frequence tous les ratios | 133 int ratio=10; //Recentre la frequence tous les ratios |
133 | 134 |
348 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); | 349 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); |
349 GetCtrlVal(MainPanel, PANEL_DDS4, &frequency); | 350 GetCtrlVal(MainPanel, PANEL_DDS4, &frequency); |
350 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); | 351 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); |
351 | 352 |
352 // initialyze 1x AD9956 DDS box | 353 // initialyze 1x AD9956 DDS box |
353 DDSFox_Initialize(&DDS1xAD9956, "145.238.205.58", 6665, DEDRIFT_DDS_FREQUENCY); | 354 DDSFox_Initialize(&DDS1xAD9956, "145.238.205.58", 6665, dedrift_DDS_freq); |
354 | 355 |
355 Ch1 = Ch2 = Ch3 = Ch4 = 0.0; | 356 Ch1 = Ch2 = Ch3 = Ch4 = 0.0; |
356 | 357 |
357 GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1); | 358 GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1); |
358 GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2); | 359 GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2); |
1287 appliedSlope = 0.0; | 1288 appliedSlope = 0.0; |
1288 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); | 1289 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); |
1289 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); | 1290 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); |
1290 } | 1291 } |
1291 if (! KeepFrequ) { | 1292 if (! KeepFrequ) { |
1292 DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); | 1293 DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); |
1293 } | 1294 } |
1294 | 1295 |
1295 stat_zero(&freq); | 1296 stat_zero(&freq); |
1296 SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, freq.slope); | 1297 SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, freq.slope); |
1297 SlopeMeasuring = FALSE; | 1298 SlopeMeasuring = FALSE; |
1333 MoyMath2 = 0.0; | 1334 MoyMath2 = 0.0; |
1334 } | 1335 } |
1335 } | 1336 } |
1336 | 1337 |
1337 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); | 1338 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); |
1338 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); | 1339 if (slopeX2) |
1340 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope * 2.0); | |
1341 else | |
1342 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); | |
1339 | 1343 |
1340 logmsg("Slope correction update (%+6g) %6g", freq.slope, appliedSlope); | 1344 logmsg("Slope correction update (%+6g) %6g", freq.slope, appliedSlope); |
1341 | 1345 |
1342 stat_zero(&freq); | 1346 stat_zero(&freq); |
1343 SlopeMeasuringTimeBegin = utc; | 1347 SlopeMeasuringTimeBegin = utc; |
2017 appliedSlope = 0.0; | 2021 appliedSlope = 0.0; |
2018 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); | 2022 DDSFox_SetSweepRate(&DDS1xAD9956, appliedSlope); |
2019 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); | 2023 SetCtrlVal(MainPanel, PANEL_SLOPE_APPLIED, appliedSlope); |
2020 } | 2024 } |
2021 if (! KeepFrequ) { | 2025 if (! KeepFrequ) { |
2022 DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); | 2026 DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); |
2023 } | 2027 } |
2024 stat_zero(&freq); | 2028 stat_zero(&freq); |
2025 SetCtrlVal(panel, PANEL_SLOPE_MEASURED, freq.slope); | 2029 SetCtrlVal(panel, PANEL_SLOPE_MEASURED, freq.slope); |
2026 | 2030 |
2027 logmsg("Stop slope measurement"); | 2031 logmsg("Stop slope measurement"); |
2042 MoyMath2 = 0.0; | 2046 MoyMath2 = 0.0; |
2043 Nratio = -1; | 2047 Nratio = -1; |
2044 CenterFrequencyCh2ToDetermine = TRUE ; | 2048 CenterFrequencyCh2ToDetermine = TRUE ; |
2045 appliedSlope = 0.0; | 2049 appliedSlope = 0.0; |
2046 SetCtrlVal(panel, PANEL_SLOPE_APPLIED, appliedSlope); | 2050 SetCtrlVal(panel, PANEL_SLOPE_APPLIED, appliedSlope); |
2047 DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); | 2051 DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); |
2048 logmsg("Reset slope measurement"); | 2052 logmsg("Reset slope measurement"); |
2049 break; | 2053 break; |
2050 } | 2054 } |
2051 return 0; | 2055 return 0; |
2052 } | 2056 } |
2270 SetCtrlVal(panel, PANEL_SLOPE_APPLIED, appliedSlope); | 2274 SetCtrlVal(panel, PANEL_SLOPE_APPLIED, appliedSlope); |
2271 // reset DDS | 2275 // reset DDS |
2272 DDSFox_Reset(&DDS1xAD9956); | 2276 DDSFox_Reset(&DDS1xAD9956); |
2273 DDSFox_SetProfile(&DDS1xAD9956); | 2277 DDSFox_SetProfile(&DDS1xAD9956); |
2274 DDSFox_SetDiv(&DDS1xAD9956, 1); | 2278 DDSFox_SetDiv(&DDS1xAD9956, 1); |
2275 DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); | 2279 DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); |
2276 break; | 2280 break; |
2277 } | 2281 } |
2278 return 0; | 2282 return 0; |
2279 } | 2283 } |
2280 | 2284 |
2314 GetCtrlVal(panel, control, &Signe3); | 2318 GetCtrlVal(panel, control, &Signe3); |
2315 break; | 2319 break; |
2316 } | 2320 } |
2317 return 0; | 2321 return 0; |
2318 } | 2322 } |
2323 | |
2324 int CVICALLBACK CB_SlopeX2 (int panel, int control, int event, | |
2325 void *callbackData, int eventData1, int eventData2) | |
2326 { | |
2327 switch (event) | |
2328 { | |
2329 case EVENT_COMMIT: | |
2330 GetCtrlVal(panel, control, &slopeX2); | |
2331 break; | |
2332 } | |
2333 return 0; | |
2334 } | |
2335 | |
2336 int CVICALLBACK CB_DedriftDDSFreq (int panel, int control, int event, | |
2337 void *callbackData, int eventData1, int eventData2) | |
2338 { | |
2339 switch (event) | |
2340 { | |
2341 case EVENT_COMMIT: | |
2342 GetCtrlVal(panel, control, &dedrift_DDS_freq); | |
2343 DDSFox_Set(&DDS1xAD9956, dedrift_DDS_freq, appliedSlope); | |
2344 break; | |
2345 } | |
2346 return 0; | |
2347 } |