changeset 159:07153c41ba16

Code cleanup
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 03 Feb 2014 17:32:47 +0100
parents 9154291658ef
children f609fb29536b
files FXAnalyse.c FXAnalyse.h FXAnalyse.uir
diffstat 3 files changed, 78 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- a/FXAnalyse.c	Mon Feb 03 15:22:35 2014 +0100
+++ b/FXAnalyse.c	Mon Feb 03 17:32:47 2014 +0100
@@ -186,25 +186,19 @@
 
 double f0_DDS1 = 110000000.0, f0_DDS2, f0_DDS3;
 
-double Slope_1=0.0, Slope_2=0.0, Slope_3=0.0, Beatslope_2=0.0;
-double SlopeTime1=40.0, SlopeTime2=40.0, SlopeTime3=40.0;
-double Ch4Slope = 0.0;
-
 double N_1=0.0, N_2=0.0, N_3=0.0;
-double DeltaT_1=20.0, DeltakHz_1=500.0, t1_1=0.0, t2_1=0.0, t3_1=0.0, Frepplus_1=0.0, Frepminus_1=0.0;
-double DeltaT_2=20.0, DeltakHz_2=500.0, t1_2=0.0, t2_2=0.0, t3_2=0.0, Frepplus_2=0.0, Frepminus_2=0.0;
-double DeltaT_3=20.0, DeltakHz_3=500.0, t1_3=0.0, t2_3=0.0, t3_3=0.0;
+double SlopeTime1=40.0, DeltaT_1=20.0, delta_f_lock_1=500.0, t1_1=0.0, t2_1=0.0, t3_1=0.0;
+double SlopeTime2=40.0, DeltaT_2=20.0, delta_f_lock_2=500.0, t1_2=0.0, t2_2=0.0, t3_2=0.0;
+double SlopeTime3=40.0, DeltaT_3=20.0, delta_f_lock_3=500.0, t1_3=0.0, t2_3=0.0, t3_3=0.0;
 
 int n_1=0, n_2=0, n_3=0;
 
-double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0;
+double DeltaDDS3=0.0;
 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6;  
 
 double f_rep_slope, f_beat_slope;
 double f_rep_plus, f_rep_minus;
-double f_beat_Sr_plus, f_beat_Sr_minus;
-
-double Ch4Plus=0.0,Ch4Minus=0.0;
+double f_beat_plus, f_beat_minus;
 
 double Frequencystep1=10000.0, tbegin1=0.0, Frepbefore1=0.0, Frequency1=0.0;
 double Frequencystep2=10.0, tbegin2=0.0, Frepbefore2=0.0, Ch2before=0.0, Frequency2=0.0;
@@ -214,7 +208,7 @@
 double Sign1=1.0, Sign2=1.0, Sign3=0.0;
 
 
-struct stat stat_math1, stat_ch2, stat_ch3, stat_ch4, freq;
+struct stat stat_math1, stat_ch2, stat_ch3, freq;
 struct rollmean rollmean_ch1, rollmean_ch2, rollmean_ch3, rollmean_ch4;
 
 
@@ -722,8 +716,8 @@
 				for (struct adev *adev = adevs; adev->data; adev++)
 					adev_update(adev);
 				
-				// Calcul de N
-				
+				// N measurement
+
 				switch (Measuring_1) {
 					
 					case N_MEASUREMENT_NONE:
@@ -734,14 +728,13 @@
 						// initialization step
 						
 						// set DDS1 to nominal frequency
-						DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1);
+						DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1);
 						
 						f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
 						t1_1 = utc;
 						t2_1 = 0.0;
 						t3_1 = 0.0;
 						stat_zero(&stat_math1);
-						stat_zero(&stat_ch4);
 						
 						// next step
 						Measuring_1 += 1;
@@ -751,14 +744,12 @@
 						// slope measurement
 						
 						stat_accumulate(&stat_math1, Math1);
-						stat_accumulate(&stat_ch4, Ch4);
 						
 						if ((utc - t1_1) > SlopeTime1) {
-							Slope_1 = stat_math1.slope;
-							Ch4Slope =  stat_ch4.slope;
+							f_rep_slope = stat_math1.slope;
 							
 							// frep positive step
-							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + DeltakHz_1 * 1000.0, FREP_STEP_SIZE);
+							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_1, FREP_STEP_SIZE);
 							
 							// allow counter to settle
 							settling = 3;
@@ -772,10 +763,8 @@
 					case N_MEASUREMENT_ADJUST_FREQ_MINUS:
 						// adjust DDS frequency to keep beatnote within the bandpass filter
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
 						DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2 + 275000 - Ch4);
@@ -790,25 +779,21 @@
 					case N_MEASUREMENT_FREP_PLUS:
 						// frep positive step
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						if (t2_1 == 0.0)
 							t2_1 = utc;
 						
-						Frepplus_1 = Frepplus_1 + Math1 - Slope_1 * (utc - t2_1);
-						Ch4Plus = Ch4Plus + Ch4 - Ch4Slope * (utc - t2_1);
+						f_rep_plus += Math1 - f_rep_slope * (utc - t2_1);
 						n_1 += 1;
 						
 						if ((utc - t2_1) > DeltaT_1) {
-							Frepplus_1 = Frepplus_1 / n_1;
-							Ch4Plus = Ch4Plus / n_1; 
+							f_rep_plus = f_rep_plus / n_1;
 							n_1 = 0;
 							
 							// frep negative step
-							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - DeltakHz_1 * 1000.0, FREP_STEP_SIZE);
+							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_1, FREP_STEP_SIZE);
 							
 							// allow counter to settle
 							settling = 3;
@@ -821,32 +806,26 @@
 					case N_MEASUREMENT_FREP_MINUS:
 						// frep negative step
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						if (t3_1 == 0.0)
 							t3_1 = utc;
 						
-						Frepminus_1 = Frepminus_1 + Math1 - Slope_1 * (utc - t3_1);
-						Ch4Minus = Ch4Minus + Ch4 - Ch4Slope * (utc - t3_1);
+						f_rep_minus += Math1 - f_rep_slope * (utc - t2_1);
 						n_1 += 1;
 						
 						if ((utc - t3_1) > DeltaT_1) {
-							Frepminus_1 = Frepminus_1 / n_1;
-							Ch4Minus = Ch4Minus / n_1;
+							f_rep_minus = f_rep_minus / n_1;
 							n_1 = 0;
 							
 							// compute N1
-							N_1 = Sign1 * (2*Ndiv * DeltakHz_1 * 1000)/(Frepminus_1 - Frepplus_1 - Slope_1 * (t3_1 - t2_1));
+							double delta_f_rep = f_rep_minus - f_rep_plus;
+							N_1 = Sign1 * 2 * Ndiv * delta_f_lock_1 / delta_f_rep;
 							SetCtrlVal(CalcNPanel, CALCN_N, N_1);
 						
-							t1_1 = 0.0;
-							t2_1 = 0.0;
-							t3_1 = 0.0;
-							Frepminus_1 = 0.0;
-							Frepplus_1 = 0.0;
+							t1_1 = t2_1 = t3_1 = 0.0;
+							f_rep_minus = f_rep_plus = 0.0;
 							
 							// back to nominal frep
 							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
@@ -889,15 +868,15 @@
 						stat_accumulate(&stat_ch2, Ch2);
 
 						if ((utc - t1_2) > SlopeTime2) {
-							Slope_2 = stat_math1.slope;
-							Beatslope_2 = stat_ch2.slope;
+							f_rep_slope = stat_math1.slope;
+							f_beat_slope = stat_ch2.slope;
 							
 							// frep positive step
-							double fDDS1 = f0_DDS1 + DeltakHz_2 * 1000;
+							double fDDS1 = f0_DDS1 + delta_f_lock_2;
 							DDS4xAD9912_RampFrequency(&DDS4xAD9912,1, fDDS1, FREP_STEP_SIZE);
 							
 							// adjust DDS3 to keep beatnote within the bandpass filter. prediction
-							double fDDS3 = f0_DDS3 - DeltakHz_2*1000*(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2);
+							double fDDS3 = f0_DDS3 - delta_f_lock_2 *(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1) - f_beat_slope * (utc-t1_2);
 							DeltaDDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 						
@@ -913,10 +892,8 @@
 					case N_MEASUREMENT_ADJUST_FREQ_MINUS:
 						// adjust DDS frequency to keep beatnote within the bandpass filter
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4;
 						DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2);
@@ -935,29 +912,27 @@
 					case N_MEASUREMENT_FREP_PLUS:
 						// frep positive step
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 
 						if (t2_1 == 0.0)
 							t2_1 = utc;
 
-						Frepplus_2 = Frepplus_2 + Math1 + 250000000 - Slope_2 * (utc - t2_2);
-						Delta10K_Plus = Delta10K_Plus + 10000 - (Ch2 - Beatslope_2 * (utc - t2_2));
+						f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t2_2);
+						f_beat_plus += Ch2 - f_beat_slope * (utc - t2_2);
 						n_2 += 1;
 						
 						if ((utc - t2_2) > DeltaT_2) {
-							Frepplus_2 = Frepplus_2 / n_2;
-							Delta10K_Plus = Delta10K_Plus / n_2;
+							f_rep_plus = f_rep_plus / n_2;
+							f_beat_plus = f_beat_plus / n_2;
 							n_2 = 0;
 
 							// negative frequency step
-							double fDDS1 = f0_DDS1 - DeltakHz_2 * 1000;
+							double fDDS1 = f0_DDS1 - delta_f_lock_2;
 							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE);
 							
 							// adjust DDS3 to keep beatnote within the bandpass filter. prediction
-							double fDDS3 = f0_DDS3 + DeltakHz_2*1000*(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1);
+							double fDDS3 = f0_DDS3 + delta_f_lock_2 *(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1);
 							DeltaDDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 
@@ -972,39 +947,34 @@
 					case N_MEASUREMENT_FREP_MINUS:
 						// frep negative step
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						if (t3_1 == 0.0)
 							t3_1 = utc;
 
-						Frepminus_2 = Frepminus_2 + Math1 + 250000000 - Slope_2 * (utc - t3_2);
-						Delta10K_Minus =  Delta10K_Minus + 10000 - (Ch2 - Beatslope_2 * (utc - t3_2));
+						f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t2_2);
+						f_beat_minus += Ch2 + f_beat_slope * (utc - t2_2);
 						n_2 += 1;
 
 						if ((utc -t3_2) > DeltaT_2) {
-							Frepminus_2 = Frepminus_2 / n_2;
-							Delta10K_Minus = Delta10K_Minus / n_2;
+							f_rep_minus = f_rep_minus / n_2;
+							f_beat_minus = f_beat_minus / n_2;
 							n_2 = 0;
 
 							// compute N2
-							N_2 = Sign2*(-DeltaDDS3+Delta10K_Plus-Delta10K_Minus-Beatslope_2*(t3_2-t2_2) )/(Frepminus_2-Frepplus_2-Slope_2*(t3_2-t2_2));
+							double delta_f_rep = f_rep_minus - f_rep_plus;
+							N_2 = -Sign2 * (DeltaDDS3 + f_beat_minus - f_beat_plus) / delta_f_rep;
 							SetCtrlVal(CalcNPanel, CALCN_N, N_2);
 							
 							// back to nominal frequency
 							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2);
-							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3 - Beatslope_2 * (utc - t1_2));
+							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3);
 							
-							t1_2 = 0.0;
-							t2_2 = 0.0;
-							t3_2 = 0.0;
-							Frepminus_2 = 0.0;
-							Frepplus_2 = 0.0;
-							Delta10K_Minus = 0.0;
-							Delta10K_Plus = 0.0;
+							t1_2 = t2_2 = t3_2 = 0.0;
+							f_rep_minus = f_rep_plus = 0.0;
+							f_beat_minus = f_beat_plus = 0.0;
 
 							// done
 							Measuring_2 = N_MEASUREMENT_NONE;
@@ -1028,7 +998,7 @@
 						stat_zero(&stat_math1);
 						stat_zero(&stat_ch3);
 						f_rep_plus = f_rep_minus = 0.0;
-						f_beat_Sr_plus = f_beat_Sr_minus = 0.0;
+						f_beat_plus = f_beat_minus = 0.0;
 						
 						// record current DDS frequencies
 						f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2);
@@ -1041,10 +1011,8 @@
 					case N_MEASUREMENT_SLOPE:
 						// slope measurement
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						stat_accumulate(&stat_math1, Math1);
 						stat_accumulate(&stat_ch3, Ch3);
@@ -1059,10 +1027,10 @@
 							t2_3 = utc;
 							
 							// frep positive step
-							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + DeltakHz_3 * 1000, FREP_STEP_SIZE);
+							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_3, FREP_STEP_SIZE);
 							
 							// adjust DDS3 to keep beatnote within the bandpass filter
-							double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000;
+							double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3;
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 							
 							// allow counter to settle
@@ -1077,10 +1045,8 @@
 					case N_MEASUREMENT_ADJUST_FREQ_MINUS:
 						// adjust DDS frequency to keep beatnote within the bandpass filter
 
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						// adjust DDS frequency to keep 55 MHz tracker oscillator locked
 						double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4;
@@ -1096,28 +1062,26 @@
 					case N_MEASUREMENT_FREP_PLUS:
 						// frep positive step
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						n_3++;
 						f_rep_plus += Math1 + 250000000 - f_rep_slope * (utc - t3_2);
-						f_beat_Sr_plus += Ch3 - f_beat_slope * (utc - t3_2);
+						f_beat_plus += Ch3 - f_beat_slope * (utc - t3_2);
 						
 						if (utc - t2_3 > DeltaT_3) {
 							// positive step measurement
 							f_rep_plus = f_rep_plus / n_3;
-							f_beat_Sr_plus = f_beat_Sr_plus / n_3;
+							f_beat_plus = f_beat_plus / n_3;
 							
 							n_3 = 0;
 							t3_3 = utc;
 							
 							// frep negative step
-							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - DeltakHz_3 * 1000, FREP_STEP_SIZE);
+							DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_3, FREP_STEP_SIZE);
 
 							// adjust DDS3 to keep beatnote within the bandpass filter
-							double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000;
+							double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3;
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 							
 							// allow counter to settle
@@ -1131,35 +1095,33 @@
 					case N_MEASUREMENT_FREP_MINUS:
 						// frep negative step
 						
-						if (settling > 0) {
-							settling--;
+						if (settling-- > 0)
 							break;
-						}
 						
 						n_3++;
 						f_rep_minus += Math1 + 250000000 - f_rep_slope * (utc - t3_2);
-						f_beat_Sr_minus += Ch3 - f_beat_slope * (utc - t3_2);
+						f_beat_minus += Ch3 - f_beat_slope * (utc - t3_2);
 						
 						if (utc - t3_3 > DeltaT_3) {
 							// negative step measurement
 							f_rep_minus = f_rep_minus / n_3;
-							f_beat_Sr_minus = f_beat_Sr_minus / n_3;
+							f_beat_minus = f_beat_minus / n_3;
 							
 							// check delta frep
 							double delta_f_rep_m = f_rep_plus - f_rep_minus;
-							double delta_f_rep = Sign1 * Ndiv * 2.0 * DeltakHz_3 * 1000.0 / N1;
+							double delta_f_rep = Sign1 * Ndiv * 2.0 * delta_f_lock_3 / N1;
 							logmsg("delta frep: measured=%.12e Hz expected=%.12e Hz difference=%.12e", 
 								delta_f_rep_m, delta_f_rep, delta_f_rep_m - delta_f_rep);
 							
-							logmsg("f_beat_Sr_minus=%.12e", f_beat_Sr_minus);
-							logmsg("f_beat_Sr_plus =%.12e", f_beat_Sr_plus);
+							logmsg("f_beat_minus=%.12e", f_beat_minus);
+							logmsg("f_beat_plus =%.12e", f_beat_plus);
 							
 							// compute N3
-							double delta_f_beat_Sr = f_beat_Sr_plus - f_beat_Sr_minus + 2.0 * Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000;
-							double delta_f_beat_Sr_expected = delta_f_rep * N3;
+							double delta_f_beat = f_beat_plus - f_beat_minus + 2.0 * Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3;
+							double delta_f_beat_expected = delta_f_rep * N3;
 							logmsg("delta fbeat: measured=%.12e expected=%.12e difference=%.12e",
-								delta_f_beat_Sr, delta_f_beat_Sr_expected, delta_f_beat_Sr - delta_f_beat_Sr_expected);
-							N_3 = delta_f_beat_Sr / delta_f_rep;
+								delta_f_beat, delta_f_beat_expected, delta_f_beat - delta_f_beat_expected);
+							N_3 = delta_f_beat / delta_f_rep;
 							logmsg("measured N3=%.3f", N_3);
 							SetCtrlVal(CalcNPanel, CALCN_N, N_3);
 							
@@ -1629,8 +1591,7 @@
 						SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Lo");
 						SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_1);
 						SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime1);
-						SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, DeltakHz_1);
-						SetCtrlVal(CalcNPanel, CALCN_SLOPE, 0.0);
+						SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, delta_f_lock_1 / 1000.0);
 						SetCtrlVal(CalcNPanel, CALCN_N, 0.0);
 						DisplayPanel(CalcNPanel);
 					}
@@ -1642,8 +1603,7 @@
 						SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Hg");
 						SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_2);
 						SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime2);
-						SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, DeltakHz_2);
-						SetCtrlVal(CalcNPanel, CALCN_SLOPE, 0.0);
+						SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, delta_f_lock_2 / 1000.0);
 						SetCtrlVal(CalcNPanel, CALCN_N, 0.0);
 						DisplayPanel(CalcNPanel);
 					} 
@@ -1655,8 +1615,7 @@
 						SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Sr");
 						SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_3);
 						SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime3);
-						SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, DeltakHz_3);
-						SetCtrlVal(CalcNPanel, CALCN_SLOPE, 0.0);
+						SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, delta_f_lock_3 / 1000.0);
 						SetCtrlVal(CalcNPanel, CALCN_N, 0.0);
 						DisplayPanel(CalcNPanel);
 					}
@@ -1676,19 +1635,25 @@
 				case MEASURING_N_Lo:
 					GetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, &DeltaT_1);
 					GetCtrlVal(CalcNPanel, CALCN_SLOPETIME, &SlopeTime1);
-					GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &DeltakHz_1);
+					GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &delta_f_lock_1);
+					// convert from kHz to Hz
+					delta_f_lock_1 = delta_f_lock_1 * 1000.0;
 					Measuring_1 = TRUE;
 					break;
 				case MEASURING_N_Hg:
 					GetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, &DeltaT_2);
 					GetCtrlVal(CalcNPanel, CALCN_SLOPETIME, &SlopeTime2);
-					GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &DeltakHz_2);
+					GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &delta_f_lock_2);
+					// convert from kHz to Hz
+					delta_f_lock_2 = delta_f_lock_2 * 1000.0;
 					Measuring_2 = TRUE;
 					break;
 				case MEASURING_N_Sr:
 					GetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, &DeltaT_3);
 					GetCtrlVal(CalcNPanel, CALCN_SLOPETIME, &SlopeTime3);
-					GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &DeltakHz_3);
+					GetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, &delta_f_lock_3);
+					// convert from kHz to Hz
+					delta_f_lock_3 = delta_f_lock_3 * 1000.0;
 					Measuring_3 = TRUE;
 					break;
 			}
--- a/FXAnalyse.h	Mon Feb 03 15:22:35 2014 +0100
+++ b/FXAnalyse.h	Mon Feb 03 17:32:47 2014 +0100
@@ -22,7 +22,6 @@
 #define  CALCN_DELTAFREQ                  6       /* control type: numeric, callback function: (none) */
 #define  CALCN_START                      7       /* control type: command, callback function: CB_OnStartNCalculus */
 #define  CALCN_ACCEPTN                    8       /* control type: command, callback function: CB_OnAcceptN */
-#define  CALCN_SLOPE                      9       /* control type: numeric, callback function: (none) */
 
 #define  ESTIMATEN3                       2
 #define  ESTIMATEN3_N                     2       /* control type: numeric, callback function: (none) */
Binary file FXAnalyse.uir has changed