Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 32:3ea9fb26ecdf
Fix N1 measurement code after cleanup
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 03 Oct 2012 11:20:48 +0200 |
parents | 56095062acd4 |
children | 09ed37e1da04 |
comparison
equal
deleted
inserted
replaced
31:4a1378ac1b8b | 32:3ea9fb26ecdf |
---|---|
88 N_MEASUREMENT_FREP_MINUS, | 88 N_MEASUREMENT_FREP_MINUS, |
89 }; | 89 }; |
90 | 90 |
91 int settling = 0; | 91 int settling = 0; |
92 | 92 |
93 volatile bool Measuring_1 = FALSE,Step1_1 = FALSE,Step2_1 = FALSE,Step3_1 = FALSE, Measuring_2 = FALSE,Step1_2 = FALSE,Step2_2 = FALSE,Step3_2 = FALSE; | 93 int Measuring_1 = FALSE; |
94 volatile bool Measuring_3 = FALSE,Step1_3 = FALSE,Step2_3 = FALSE,Step3_3 = FALSE; | 94 bool Measuring_2 = FALSE, Step1_2 = FALSE, Step2_2 = FALSE, Step3_2 = FALSE; |
95 volatile bool TimetoBegin=FALSE; | 95 int Measuring_3 = FALSE; |
96 | 96 |
97 double FrequDDS1=110000000.0, FrequDDS2=15300000.0, FrequDDS3=150400000.0, FrequDDS4=110000000.0; | 97 double FrequDDS1=110000000.0, FrequDDS2=15300000.0, FrequDDS3=150400000.0, FrequDDS4=110000000.0; |
98 double Slope_1=0.0,Slope_2=0.0,Slope_3=0.0,Beatslope_2=0.0; | 98 double Slope_1=0.0,Slope_2=0.0,Slope_3=0.0,Beatslope_2=0.0; |
99 double SlopeTime1=40.0, SlopeTime2=40.0; SlopeTime3=40.0; | 99 double SlopeTime1=40.0, SlopeTime2=40.0; SlopeTime3=40.0; |
100 | 100 |
800 Slope_Ch4slope_1 = (Slope_Ch4slope_1*(N_slope_1-2) + 6*(Ch4_slope-Moy_Ch4slope_1)/N_slope_1)/(N_slope_1+1); | 800 Slope_Ch4slope_1 = (Slope_Ch4slope_1*(N_slope_1-2) + 6*(Ch4_slope-Moy_Ch4slope_1)/N_slope_1)/(N_slope_1+1); |
801 | 801 |
802 if ((utc - t1_1) > SlopeTime1) { | 802 if ((utc - t1_1) > SlopeTime1) { |
803 Slope_1 = Slope_slope_1; | 803 Slope_1 = Slope_slope_1; |
804 Ch4Slope = Slope_Ch4slope_1; | 804 Ch4Slope = Slope_Ch4slope_1; |
805 SetCtrlVal(CalcN1Panel, CALCN1_SLOPE, Slope_1); | |
805 | 806 |
806 N_slope_1 = 0; | 807 N_slope_1 = 0; |
807 Frequ_slope_1 = 0.0; | 808 Frequ_slope_1 = 0.0; |
808 Moy_slope_1 = 0.0; | 809 Moy_slope_1 = 0.0; |
809 Slope_slope_1 = 0.0; | 810 Slope_slope_1 = 0.0; |
831 if (settling > 0) { | 832 if (settling > 0) { |
832 settling--; | 833 settling--; |
833 break; | 834 break; |
834 } | 835 } |
835 | 836 |
836 double fDDS2 = FrequencyDDSBesInit + 275000 - Ch4; | 837 double fDDS2; |
837 SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2) ; | 838 GetCtrlVal(MainPanel, PANEL_DDS2, &fDDS2); |
839 fDDS2 += 275000 - Ch4; | |
840 SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2); | |
838 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); | 841 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); |
839 | 842 |
840 // allow counter to settle | 843 // allow counter to settle |
841 settling = 3; | 844 settling = 3; |
842 | 845 |
843 // next step | 846 // next step |
844 Measuring_1 += 1; | 847 Measuring_1 += 1; |
845 break; | 848 break; |
846 | 849 |
847 | |
848 case N_MEASUREMENT_FREP_PLUS: | 850 case N_MEASUREMENT_FREP_PLUS: |
849 // frep positive step | 851 // frep positive step |
850 | 852 |
851 if (settling > 0) { | 853 if (settling > 0) { |
852 settling--; | 854 settling--; |
896 if ((utc - t3_1) > DeltaT_1) { | 898 if ((utc - t3_1) > DeltaT_1) { |
897 Frepminus_1 = Frepminus_1 / n_1; | 899 Frepminus_1 = Frepminus_1 / n_1; |
898 Ch4Minus = Ch4Minus / n_1; | 900 Ch4Minus = Ch4Minus / n_1; |
899 n_1 = 0; | 901 n_1 = 0; |
900 | 902 |
903 // compute N1 | |
904 N_1 = Signe1 * (2*Ndiv * DeltakHz_1 * 1000)/(Frepminus_1 - Frepplus_1 - Slope_1 * (t3_1 - t2_1)); | |
905 SetCtrlVal(CalcN1Panel, CALCN1_N, N_1); | |
906 | |
901 t1_1 = 0.0; | 907 t1_1 = 0.0; |
902 t2_1 = 0.0; | 908 t2_1 = 0.0; |
903 t3_1 = 0.0; | 909 t3_1 = 0.0; |
904 Frepminus_1 = 0.0; | 910 Frepminus_1 = 0.0; |
905 Frepplus_1 = 0.0; | 911 Frepplus_1 = 0.0; |
906 | 912 |
907 // compute N1 | 913 // back to nominal frep |
908 N_1 = Signe1 * (2*Ndiv * DeltakHz_1 * 1000)/(Frepminus_1 - Frepplus_1 - Slope_1 * (t3_1 - t2_1)); | |
909 | |
910 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912, 1, FrequDDS1-DeltakHz_1*1000,FrequDDS1, Step1/Ndiv ); | 914 DDS4xAD9912_FrequencyRampe(&DDS4xAD9912, 1, FrequDDS1-DeltakHz_1*1000,FrequDDS1, Step1/Ndiv ); |
911 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); | 915 SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); |
912 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); | 916 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); |
913 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); | 917 SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); |
914 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); | 918 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); |
2102 if (panel == CalcN1Panel) { | 2106 if (panel == CalcN1Panel) { |
2103 GetPanelAttribute (CalcN1Panel, ATTR_VISIBLE, &PanelIsVisible); | 2107 GetPanelAttribute (CalcN1Panel, ATTR_VISIBLE, &PanelIsVisible); |
2104 if (PanelIsVisible) | 2108 if (PanelIsVisible) |
2105 HidePanel(CalcN1Panel); | 2109 HidePanel(CalcN1Panel); |
2106 | 2110 |
2107 Measuring_1=FALSE; | 2111 Measuring_1 = FALSE; |
2108 Step1_1=FALSE ; | |
2109 Step2_1=FALSE ; | |
2110 Step3_1=FALSE ; | |
2111 Frepminus_1=0.0; | 2112 Frepminus_1=0.0; |
2112 Frepplus_1=0.0; | 2113 Frepplus_1=0.0; |
2113 t1_1=0.0; | 2114 t1_1=0.0; |
2114 t2_1=0.0; | 2115 t2_1=0.0; |
2115 t3_1=0.0; | 2116 t3_1=0.0; |