Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 1:a6fb5d3d0ec0
Indentation
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Tue, 03 Jul 2012 12:27:45 +0200 |
parents | d9aae7d7f2c6 |
children | bd7501b65f56 |
comparison
equal
deleted
inserted
replaced
0:d9aae7d7f2c6 | 1:a6fb5d3d0ec0 |
---|---|
153 | 153 |
154 int ratio=10; //Recentre la frequence tous les ratios | 154 int ratio=10; //Recentre la frequence tous les ratios |
155 | 155 |
156 volatile bool FrequCorrec=FALSE,KeepFrequ=TRUE, KeepSlope=TRUE ; | 156 volatile bool FrequCorrec=FALSE,KeepFrequ=TRUE, KeepSlope=TRUE ; |
157 int Nratio=-1; | 157 int Nratio=-1; |
158 double MoyMath2=0.0,CenterFrequencyCh2=0.0; | 158 double MoyMath2 = 0.0, CenterFrequencyCh2 = 0.0; |
159 volatile bool CenterFrequencyCh2ToDetermine=FALSE; | 159 volatile bool CenterFrequencyCh2ToDetermine=FALSE; |
160 | 160 |
161 double limitotakoff=70.0; | 161 double limitotakoff=70.0; |
162 | 162 |
163 | 163 |
1288 } | 1288 } |
1289 | 1289 |
1290 | 1290 |
1291 | 1291 |
1292 | 1292 |
1293 //Pour le Slope Cancelling | 1293 /* |
1294 | 1294 * Slope Cancelling |
1295 if (SlopeMeasuring==TRUE) | 1295 */ |
1296 { | 1296 |
1297 if (utc-SlopeMeasuringTimeBegin>TimetoSlope) | 1297 if (SlopeMeasuring == TRUE) |
1298 { | |
1299 if (utc-SlopeMeasuringTimeBegin > TimetoSlope) | |
1298 { | 1300 { |
1299 Nratio=Nratio+1; | 1301 Nratio = Nratio + 1; |
1300 | 1302 |
1301 if (Nratio>=1) | 1303 if (Nratio >= 1) |
1302 { | 1304 { |
1303 MoyMath2= MoyMath2+Moy_Math2slope; | 1305 MoyMath2 = MoyMath2 + Moy_Math2slope; |
1304 } | 1306 } |
1305 SlopeMath2=SlopeMath2+Slope_Math2slope; | 1307 SlopeMath2 = SlopeMath2 + Slope_Math2slope; |
1306 N_Math2slope=0.0; | 1308 N_Math2slope = 0.0; |
1307 Math2_slope=0.0; | 1309 Math2_slope = 0.0; |
1308 Moy_Math2slope=0.0; | 1310 Moy_Math2slope = 0.0; |
1309 Slope_Math2slope=0.0; | 1311 Slope_Math2slope = 0.0; |
1310 | 1312 |
1311 | 1313 if (Nratio == 1 && CenterFrequencyCh2ToDetermine == TRUE) |
1314 { | |
1315 CenterFrequencyCh2 = MoyMath2; | |
1316 CenterFrequencyCh2ToDetermine = FALSE; | |
1317 } | |
1318 | |
1319 OnOffMessage = "ON " ; | |
1320 OnSlopeCancelling = TRUE; | |
1321 | |
1322 FoxFrequ = ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate); | |
1312 | 1323 |
1313 if (Nratio==1 && CenterFrequencyCh2ToDetermine==TRUE) { | 1324 if (Nratio == ratio) |
1314 CenterFrequencyCh2= MoyMath2; | 1325 { |
1315 CenterFrequencyCh2ToDetermine=FALSE; | 1326 if (FrequCorrec == TRUE) |
1327 { | |
1328 SlopeCorrection = (MoyMath2/ratio-CenterFrequencyCh2)/TimetoSlope; | |
1329 SlopeMath2 = SlopeMath2 + SlopeCorrection; | |
1316 } | 1330 } |
1317 | 1331 Nratio = 0; |
1318 OnOffMessage="ON " ; | 1332 MoyMath2 = 0.0; |
1319 OnSlopeCancelling =TRUE; | 1333 } |
1320 | |
1321 // S'occupe du slope | |
1322 // SweepSign =0 fait un slope + | |
1323 // SweepSign =1 fait un slope - | |
1324 | |
1325 /* if (SlopeMath2<0) | |
1326 { | |
1327 DDSFoxSweepSign=0; | |
1328 SlopeMath2= -SlopeMath2; | |
1329 } | |
1330 else | |
1331 { DDSFoxSweepSign=1; } */ | |
1332 | |
1333 FoxFrequ=ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate); | |
1334 | |
1335 if (Nratio==ratio) { | |
1336 | |
1337 if (FrequCorrec==TRUE) { | |
1338 SlopeCorrection= (MoyMath2/ratio-CenterFrequencyCh2)/TimetoSlope; | |
1339 SlopeMath2=SlopeMath2+ SlopeCorrection; | |
1340 } | |
1341 Nratio=0; | |
1342 MoyMath2=0.0; | |
1343 | |
1344 } | |
1345 | 1334 |
1346 LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,FoxFrequ,SlopeMath2,0); | 1335 LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,FoxFrequ,SlopeMath2,0); |
1347 | 1336 |
1348 nstabilisationSlopeMeasuring=0; | 1337 nstabilisationSlopeMeasuring = 0; |
1349 SlopeMeasuringTimeBegin=utc; | 1338 SlopeMeasuringTimeBegin = utc; |
1350 | |
1351 | |
1352 | 1339 |
1353 } | 1340 } |
1354 else | 1341 else |
1355 { | 1342 { |
1356 if (nstabilisationSlopeMeasuring<5) | 1343 if (nstabilisationSlopeMeasuring < 5) |
1344 { | |
1345 nstabilisationSlopeMeasuring = nstabilisationSlopeMeasuring + 1; | |
1346 Math2_slope = Math2; | |
1347 } | |
1348 else | |
1349 { | |
1350 if ((Math2-Math2_slope) < limitotakoff && (Math2-Math2_slope) > -limitotakoff) | |
1357 { | 1351 { |
1358 nstabilisationSlopeMeasuring= nstabilisationSlopeMeasuring+1; | 1352 N_Math2slope = N_Math2slope + 1; |
1359 Math2_slope=Math2; | 1353 Math2_slope = Math2; |
1354 Moy_Math2slope = ((N_Math2slope-1)*Moy_Math2slope + Math2_slope)/N_Math2slope; | |
1355 Slope_Math2slope = (Slope_Math2slope*(N_Math2slope-2) + 6*(Math2_slope-Moy_Math2slope)/N_Math2slope)/(N_Math2slope+1) ; | |
1360 } | 1356 } |
1361 else | 1357 else |
1362 { | 1358 { |
1363 if ((Math2-Math2_slope)<limitotakoff && (Math2-Math2_slope)>-limitotakoff ) | |
1364 { | |
1365 N_Math2slope=N_Math2slope+1; | |
1366 Math2_slope=Math2; | |
1367 Moy_Math2slope=((N_Math2slope-1)*Moy_Math2slope + Math2_slope)/N_Math2slope; | |
1368 Slope_Math2slope= (Slope_Math2slope*(N_Math2slope-2) + 6*(Math2_slope-Moy_Math2slope)/N_Math2slope)/(N_Math2slope+1) ; | |
1369 } | |
1370 | |
1371 else | |
1372 { | |
1373 | |
1374 if (AutoStopSlopeCancellingIfDelock) | 1359 if (AutoStopSlopeCancellingIfDelock) |
1375 { | 1360 { |
1376 // S'occupe d'arreter le slope en cas de delockage | 1361 |
1377 | 1362 /* |
1378 if (KeepFrequ==TRUE) {ActualFrequ=ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate);} | 1363 * stop slope cancelling if the comb is not locked |
1379 else { ActualFrequ= DDSFoxFrequency;} | 1364 */ |
1380 if (KeepSlope==TRUE) {ActualSlope= SlopeMath2; | 1365 |
1381 } | 1366 if (KeepFrequ == TRUE) |
1382 else { ActualSlope= DDSFoxSweeprate; | 1367 { |
1383 OnSlopeCancelling =FALSE;} | 1368 ActualFrequ = ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate); |
1369 } | |
1370 else | |
1371 { | |
1372 ActualFrequ = DDSFoxFrequency; | |
1373 } | |
1374 | |
1375 if (KeepSlope == TRUE) | |
1376 { | |
1377 ActualSlope = SlopeMath2; | |
1378 } | |
1379 else | |
1380 { | |
1381 ActualSlope = DDSFoxSweeprate; | |
1382 OnSlopeCancelling = FALSE; | |
1383 } | |
1384 | |
1384 LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,ActualFrequ,ActualSlope,0); | 1385 LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,ActualFrequ,ActualSlope,0); |
1385 SlopeMeasuring=FALSE; | |
1386 OnOffMessage="OFF " ; | |
1387 N_Math2slope=0.0; | |
1388 Math2_slope=0.0; | |
1389 MoyMath2=0.0; | |
1390 Moy_Math2slope=0.0; | |
1391 Slope_Math2slope=0.0; | |
1392 CenterFrequencyCh2= 0.0; | |
1393 CenterFrequencyCh2ToDetermine=TRUE; | |
1394 Nratio=-1; | |
1395 nstabilisationSlopeMeasuring=0; | |
1396 SetCtrlVal(MainPanel, PANEL_STARTCANCEL, 0) ; | |
1397 | 1386 |
1387 SlopeMeasuring = FALSE; | |
1388 OnOffMessage = "OFF " ; | |
1389 N_Math2slope = 0.0; | |
1390 Math2_slope = 0.0; | |
1391 MoyMath2 = 0.0; | |
1392 Moy_Math2slope = 0.0; | |
1393 Slope_Math2slope = 0.0; | |
1394 CenterFrequencyCh2 = 0.0; | |
1395 CenterFrequencyCh2ToDetermine = TRUE; | |
1396 Nratio = -1; | |
1397 nstabilisationSlopeMeasuring = 0; | |
1398 | |
1399 SetCtrlVal(MainPanel, PANEL_STARTCANCEL, 0); | |
1398 } | 1400 } |
1399 } | |
1400 | |
1401 } | 1401 } |
1402 | 1402 } |
1403 } | 1403 } |
1404 | |
1405 } | 1404 } |
1406 | 1405 |
1407 | 1406 |
1408 //// For re-centering | 1407 //// For re-centering |
1409 | 1408 |