Mercurial > hg > fxanalyse
diff FXAnalyse.c @ 2:bd7501b65f56
Implement reference selection (microwave or Hg cavity) for slope cancelling
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Tue, 03 Jul 2012 13:11:40 +0200 |
parents | a6fb5d3d0ec0 |
children | 7028b7982af3 |
line wrap: on
line diff
--- a/FXAnalyse.c Tue Jul 03 12:27:45 2012 +0200 +++ b/FXAnalyse.c Tue Jul 03 13:11:40 2012 +0200 @@ -160,8 +160,12 @@ double limitotakoff=70.0; +enum { + SLOPE_REFERENCE_MICROWAVE = 0, + SLOPE_REFERENCE_HG_CAVITY = 1, +}; - +int slopeReference = SLOPE_REFERENCE_MICROWAVE; ////////////////////////////////// // Keep Centered Variables @@ -634,7 +638,7 @@ if (LogFileSize > OldLogFilePtr+2*FXLINELENGTH-2) { // if a complete newline has been written - SuspendTimerCallbacks ; + SuspendTimerCallbacks() ; // Open Log file and get to the beginning of newly completed line LogFile = OpenFile(LogFileName, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII) ; @@ -1296,6 +1300,18 @@ if (SlopeMeasuring == TRUE) { + double currentFreq; + + /* select reference */ + switch (slopeReference) { + case SLOPE_REFERENCE_MICROWAVE: + currentFreq = Math2; + break; + case SLOPE_REFERENCE_HG_CAVITY: + currentFreq = Math3; + break; + } + if (utc-SlopeMeasuringTimeBegin > TimetoSlope) { Nratio = Nratio + 1; @@ -1343,14 +1359,14 @@ if (nstabilisationSlopeMeasuring < 5) { nstabilisationSlopeMeasuring = nstabilisationSlopeMeasuring + 1; - Math2_slope = Math2; + Math2_slope = currentFreq; } else { - if ((Math2-Math2_slope) < limitotakoff && (Math2-Math2_slope) > -limitotakoff) + if ((currentFreq-Math2_slope) < limitotakoff && (currentFreq-Math2_slope) > -limitotakoff) { N_Math2slope = N_Math2slope + 1; - Math2_slope = Math2; + Math2_slope = currentFreq; 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) ; } @@ -1540,7 +1556,7 @@ OldLogFilePtr = 2; } - ResumeTimerCallbacks ; + ResumeTimerCallbacks() ; } ; @@ -2870,3 +2886,15 @@ } return 0; } + +int CVICALLBACK SlopeReference_cb (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + GetCtrlVal(MainPanel, PANEL_SLOPE_REFERENCE, &slopeReference); + break; + } + return 0; +}