comparison FXAnalyse.c @ 61:37075b60408b

Fix N2 measurement after cleanup. Further simplification
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 18 Oct 2012 12:24:31 +0200
parents cd7b5903f168
children 53dbce5f0745
comparison
equal deleted inserted replaced
60:cd7b5903f168 61:37075b60408b
81 double Frequ_slope_1=0.0,Moy_slope_1=0.0,Slope_slope_1=0.0,Frequ_slope_2=0.0,Moy_slope_2=0.0,Slope_slope_2=0.0,Frequ_slope_3=0.0,Moy_slope_3=0.0,Slope_slope_3=0.0; 81 double Frequ_slope_1=0.0,Moy_slope_1=0.0,Slope_slope_1=0.0,Frequ_slope_2=0.0,Moy_slope_2=0.0,Slope_slope_2=0.0,Frequ_slope_3=0.0,Moy_slope_3=0.0,Slope_slope_3=0.0;
82 int N_slope_1=0,N_slope_2=0,N_slope_3=0; 82 int N_slope_1=0,N_slope_2=0,N_slope_3=0;
83 double Beat_slope_2=0.0 ,Moy_Beatslope_2=0.0,Slope_Beatslope_2=0.0; 83 double Beat_slope_2=0.0 ,Moy_Beatslope_2=0.0,Slope_Beatslope_2=0.0;
84 double Ch4_slope=0.0,Moy_Ch4slope_1=0.0,Slope_Ch4slope_1=0.0,Ch4Slope=0.0; 84 double Ch4_slope=0.0,Moy_Ch4slope_1=0.0,Slope_Ch4slope_1=0.0,Ch4Slope=0.0;
85 85
86 double FrequencyDDSBes=0.0,FrequencyDDSBesInit=0.0; 86 double FrequencyDDSBesInit = 0.0;
87 double FrequencyDDS3=0.0,FrequencyDDS3Init=0.0; 87 double FrequencyDDS3Init = 0.0;
88 88
89 double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0; 89 double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0;
90 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6; 90 double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6;
91 91
92 double Step1=800000.0,Step2=800000.0; 92 double Step1=800000.0,Step2=800000.0;
886 Slope_Beatslope_2 = 0.0; 886 Slope_Beatslope_2 = 0.0;
887 Beat_slope_2 = 0.0; 887 Beat_slope_2 = 0.0;
888 888
889 // frep positive step 889 // frep positive step
890 double fDDS1 = FrequDDS1 + DeltakHz_2 * 1000; 890 double fDDS1 = FrequDDS1 + DeltakHz_2 * 1000;
891 printf("fDDS1 = %g\n", fDDS1);
891 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, FrequDDS1, fDDS1, Step2/Ndiv); 892 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, FrequDDS1, fDDS1, Step2/Ndiv);
892 SetCtrlVal(MainPanel, PANEL_DDS1, fDDS1); 893 SetCtrlVal(MainPanel, PANEL_DDS1, fDDS1);
893 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, fDDS1); 894 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, fDDS1);
895 // adjust DDS3 to keep beatnote within the bandpass filter. prediction
894 DeltaDDS3 = -DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2); 896 DeltaDDS3 = -DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2);
897 printf("deltaDDS3 = %g\n", DeltaDDS3);
895 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init + DeltaDDS3); 898 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init + DeltaDDS3);
896 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init + DeltaDDS3); 899 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init + DeltaDDS3);
897 900
898 // allow counter to settle 901 // allow counter to settle
899 settling = 3; 902 settling = 3;
909 912
910 if (settling > 0) { 913 if (settling > 0) {
911 settling--; 914 settling--;
912 break; 915 break;
913 } 916 }
914 917
915 double DeltaFrep275 = 275000 - Ch4; 918 double fDDS2 = DDS4xAD9912.Frequency2 + 275000 - Ch4;
916 double DeltaFrep10 = 10000 - Ch2; 919 SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2);
917 920 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2);
918 DeltaDDS3 = DeltaDDS3 + DeltaFrep10; 921
919 FrequencyDDSBes = FrequencyDDSBes + DeltaFrep275; 922 double fDDS3 = DDS4xAD9912.Frequency3 + 10000 - Ch2;
920 FrequencyDDS3 = FrequencyDDS3 + DeltaDDS3; 923 DeltaDDS3 = DeltaDDS3 + 10000 - Ch2;
921 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBes); 924 SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3);
922 DDS4xAD9912_SetFrequency(&DDS4xAD9912,2,FrequencyDDSBes); 925 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
923 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3);
924 DDS4xAD9912_SetFrequency(&DDS4xAD9912,3,FrequencyDDS3);
925 926
926 // allow counter to settle 927 // allow counter to settle
927 settling = 3; 928 settling = 3;
928 929
929 // next step 930 // next step
952 953
953 // negative frequency step 954 // negative frequency step
954 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, (FrequDDS1+DeltakHz_2*1000),(FrequDDS1-DeltakHz_2*1000), Step2/Ndiv); 955 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, (FrequDDS1+DeltakHz_2*1000),(FrequDDS1-DeltakHz_2*1000), Step2/Ndiv);
955 SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1-DeltakHz_2*1000)); 956 SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1-DeltakHz_2*1000));
956 DDS4xAD9912_SetFrequency(&DDS4xAD9912,1, (FrequDDS1-DeltakHz_2*1000)); 957 DDS4xAD9912_SetFrequency(&DDS4xAD9912,1, (FrequDDS1-DeltakHz_2*1000));
957 DeltaDDS3 = (FrequencyDDS3Init+DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1)) - FrequencyDDS3; 958 double fDDS3 = FrequencyDDS3Init+DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1);
958 SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3+DeltaDDS3); 959 DeltaDDS3 = fDDS3 - DDS4xAD9912.Frequency3;
959 DDS4xAD9912_SetFrequency(&DDS4xAD9912,3, FrequencyDDS3+DeltaDDS3); 960 SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3);
961 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
960 962
961 // allow counter to settle 963 // allow counter to settle
962 settling = 3; 964 settling = 3;
963 965
964 // next step 966 // next step
1006 t3_2 = 0.0; 1008 t3_2 = 0.0;
1007 Frepminus_2 = 0.0; 1009 Frepminus_2 = 0.0;
1008 Frepplus_2 = 0.0; 1010 Frepplus_2 = 0.0;
1009 Delta10K_Minus = 0.0; 1011 Delta10K_Minus = 0.0;
1010 Delta10K_Plus = 0.0; 1012 Delta10K_Plus = 0.0;
1011 FrequencyDDSBes = 0.0;
1012 1013
1013 // done 1014 // done
1014 Measuring_2 = N_MEASUREMENT_NONE; 1015 Measuring_2 = N_MEASUREMENT_NONE;
1015 } 1016 }
1016 break; 1017 break;