Mercurial > hg > fxanalyse
changeset 1:a6fb5d3d0ec0
Indentation
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Tue, 03 Jul 2012 12:27:45 +0200 |
parents | d9aae7d7f2c6 |
children | bd7501b65f56 |
files | FXAnalyse.c |
diffstat | 1 files changed, 84 insertions(+), 85 deletions(-) [+] |
line wrap: on
line diff
--- a/FXAnalyse.c Tue Jul 03 10:38:59 2012 +0200 +++ b/FXAnalyse.c Tue Jul 03 12:27:45 2012 +0200 @@ -155,7 +155,7 @@ volatile bool FrequCorrec=FALSE,KeepFrequ=TRUE, KeepSlope=TRUE ; int Nratio=-1; -double MoyMath2=0.0,CenterFrequencyCh2=0.0; +double MoyMath2 = 0.0, CenterFrequencyCh2 = 0.0; volatile bool CenterFrequencyCh2ToDetermine=FALSE; double limitotakoff=70.0; @@ -1290,118 +1290,117 @@ - //Pour le Slope Cancelling + /* + * Slope Cancelling + */ - if (SlopeMeasuring==TRUE) - { - if (utc-SlopeMeasuringTimeBegin>TimetoSlope) + if (SlopeMeasuring == TRUE) + { + if (utc-SlopeMeasuringTimeBegin > TimetoSlope) { - Nratio=Nratio+1; + Nratio = Nratio + 1; - if (Nratio>=1) + if (Nratio >= 1) { - MoyMath2= MoyMath2+Moy_Math2slope; + MoyMath2 = MoyMath2 + Moy_Math2slope; } - SlopeMath2=SlopeMath2+Slope_Math2slope; - N_Math2slope=0.0; - Math2_slope=0.0; - Moy_Math2slope=0.0; - Slope_Math2slope=0.0; + SlopeMath2 = SlopeMath2 + Slope_Math2slope; + N_Math2slope = 0.0; + Math2_slope = 0.0; + Moy_Math2slope = 0.0; + Slope_Math2slope = 0.0; - - - if (Nratio==1 && CenterFrequencyCh2ToDetermine==TRUE) { - CenterFrequencyCh2= MoyMath2; - CenterFrequencyCh2ToDetermine=FALSE; - } + if (Nratio == 1 && CenterFrequencyCh2ToDetermine == TRUE) + { + CenterFrequencyCh2 = MoyMath2; + CenterFrequencyCh2ToDetermine = FALSE; + } - OnOffMessage="ON " ; - OnSlopeCancelling =TRUE; + OnOffMessage = "ON " ; + OnSlopeCancelling = TRUE; - // S'occupe du slope - // SweepSign =0 fait un slope + - // SweepSign =1 fait un slope - - - /* if (SlopeMath2<0) + FoxFrequ = ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate); + + if (Nratio == ratio) + { + if (FrequCorrec == TRUE) { - DDSFoxSweepSign=0; - SlopeMath2= -SlopeMath2; + SlopeCorrection = (MoyMath2/ratio-CenterFrequencyCh2)/TimetoSlope; + SlopeMath2 = SlopeMath2 + SlopeCorrection; } - else - { DDSFoxSweepSign=1; } */ - - FoxFrequ=ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate); - - if (Nratio==ratio) { - - if (FrequCorrec==TRUE) { - SlopeCorrection= (MoyMath2/ratio-CenterFrequencyCh2)/TimetoSlope; - SlopeMath2=SlopeMath2+ SlopeCorrection; - } - Nratio=0; - MoyMath2=0.0; - - } + Nratio = 0; + MoyMath2 = 0.0; + } LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,FoxFrequ,SlopeMath2,0); - nstabilisationSlopeMeasuring=0; - SlopeMeasuringTimeBegin=utc; - - + nstabilisationSlopeMeasuring = 0; + SlopeMeasuringTimeBegin = utc; } else { - if (nstabilisationSlopeMeasuring<5) + if (nstabilisationSlopeMeasuring < 5) + { + nstabilisationSlopeMeasuring = nstabilisationSlopeMeasuring + 1; + Math2_slope = Math2; + } + else + { + if ((Math2-Math2_slope) < limitotakoff && (Math2-Math2_slope) > -limitotakoff) { - nstabilisationSlopeMeasuring= nstabilisationSlopeMeasuring+1; - Math2_slope=Math2; + N_Math2slope = N_Math2slope + 1; + Math2_slope = Math2; + Moy_Math2slope = ((N_Math2slope-1)*Moy_Math2slope + Math2_slope)/N_Math2slope; + Slope_Math2slope = (Slope_Math2slope*(N_Math2slope-2) + 6*(Math2_slope-Moy_Math2slope)/N_Math2slope)/(N_Math2slope+1) ; } else { - if ((Math2-Math2_slope)<limitotakoff && (Math2-Math2_slope)>-limitotakoff ) - { - N_Math2slope=N_Math2slope+1; - Math2_slope=Math2; - Moy_Math2slope=((N_Math2slope-1)*Moy_Math2slope + Math2_slope)/N_Math2slope; - Slope_Math2slope= (Slope_Math2slope*(N_Math2slope-2) + 6*(Math2_slope-Moy_Math2slope)/N_Math2slope)/(N_Math2slope+1) ; - } - - else - { - if (AutoStopSlopeCancellingIfDelock) { - // S'occupe d'arreter le slope en cas de delockage - - if (KeepFrequ==TRUE) {ActualFrequ=ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate);} - else { ActualFrequ= DDSFoxFrequency;} - if (KeepSlope==TRUE) {ActualSlope= SlopeMath2; - } - else { ActualSlope= DDSFoxSweeprate; - OnSlopeCancelling =FALSE;} + + /* + * stop slope cancelling if the comb is not locked + */ + + if (KeepFrequ == TRUE) + { + ActualFrequ = ReadDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,DDSFoxFrequency,DDSFoxSweeprate); + } + else + { + ActualFrequ = DDSFoxFrequency; + } + + if (KeepSlope == TRUE) + { + ActualSlope = SlopeMath2; + } + else + { + ActualSlope = DDSFoxSweeprate; + OnSlopeCancelling = FALSE; + } + LaunchDDSFOX (DDSFoxName,DDSFoxip,DDSFoxPort,DDSFoxProfil,DDSFoxClock,DDSFoxDeltaT,ActualFrequ,ActualSlope,0); - SlopeMeasuring=FALSE; - OnOffMessage="OFF " ; - N_Math2slope=0.0; - Math2_slope=0.0; - MoyMath2=0.0; - Moy_Math2slope=0.0; - Slope_Math2slope=0.0; - CenterFrequencyCh2= 0.0; - CenterFrequencyCh2ToDetermine=TRUE; - Nratio=-1; - nstabilisationSlopeMeasuring=0; - SetCtrlVal(MainPanel, PANEL_STARTCANCEL, 0) ; - } + SlopeMeasuring = FALSE; + OnOffMessage = "OFF " ; + N_Math2slope = 0.0; + Math2_slope = 0.0; + MoyMath2 = 0.0; + Moy_Math2slope = 0.0; + Slope_Math2slope = 0.0; + CenterFrequencyCh2 = 0.0; + CenterFrequencyCh2ToDetermine = TRUE; + Nratio = -1; + nstabilisationSlopeMeasuring = 0; + + SetCtrlVal(MainPanel, PANEL_STARTCANCEL, 0); } - } - + } } - }