/* Created: 15-AUG-1995 This program is used to analyze the resonant frequency of a parallel LC circuit. The idea is to find the high frequency (i.e. the operating frequency) effective L and the inherent parasitic parallel C of the coil by measuring its parallel resonant frequency under two conditions. 1. First the resonant frequency is measured with a capacitor of value "Cf" accross the coil. Cf stands for C fixed. 2. Then the resonant frequency is measured with both "Cf" and "Cd" across the coil. Cd stands for C delta. Now we know that the parallel resonant frequency (by one definition is: 1 or solve 1 F = ------------------ for C C = ---------------- 2 pi sqrt( LC ) and it is 4 pi^2 F^2 L In case one above the C is the parallel compination of Cf and "Cp" where Cp is the inherent parasitic capacitance of the coil. So case one can be written: 1 ( Cp + Cf ) = ------------------ 4 pi^2 F1^2 L In case two above the C is the parallel compination of Cf, Cd, and "Cp". So case one can be written: 1 ( Cp + Cf + Cd ) = ------------------ 4 pi^2 F2^2 L We know the values of Cf and Cd and we measured the two resonant frequencies F1 and F2, so we can now solve the two equations for the two unknowns Cp and L. To get Cp solve both of the equations for 1/L and set them equal: K F1^2 (Cp+Cf) = 1/L = K F2^2 (Cp+Cf+Cd) where K is 4 pi^2 Solve for Cp in terms of: Cf, Cd, F1, and F2: F2^2 Cd Cp = ----------------- - Cf ( F1^2 - F2^2 ) Now we can solve either of the original equations for L 1 L = ---------------------------- 4 pi^2 F1^2 ( Cp + Cf ) or 1 L = --------------------------------- 4 pi^2 F2^2 ( Cp + Cf + Cd ) Recall that if "F" is in MHz and "L" is in uH and "C" is in pF Then this is: 1,000,000 L = ------------------ 4 pi^2 F2^2 C */ #include #include #define PI 3.1415926 float c_parasitic( float freq_parasitic_fixed, float freq_pasasitic_fixed_delta, float C_fixed, float C_delta ) ; float half_diff( float this_term, float that_term ) ; main() { float freq_1, freq_2, Cp, Cf, Cd, four_pi_sqrd, wk ; float L_from_f1, L_from_f2 ; float Cf_high, Cf_low ; float Cp_Cf_high, Cp_Cf_low, Cp_Cf_Sens ; float L_Cf_high, L_Cf_low, L_Cf_sens ; float Cd_high, Cd_low ; float Cp_Cd_high, Cp_Cd_low, Cp_Cd_Sens ; float L_Cd_high, L_Cd_low, L_Cd_sens ; float freq_1_high, freq_1_low ; float Cp_freq_1_high, Cp_freq_1_low, Cp_freq_1_sens ; float L_f1_high, L_f1_low, L_freq_1_sens ; float freq_2_high, freq_2_low ; float Cp_freq_2_high, Cp_freq_2_low, Cp_freq_2_sens ; float L_f2_high, L_f2_low, L_freq_2_sens ; /* Get the various parameters that will be used for this run */ printf(" \n \n \n ") ; printf("Enter F1, the resonant frequency (MHz) with Cp + Cf : "); scanf( "%f", &freq_1 ) ; printf(" \n ") ; printf("Enter F2, the resonant frequency (MHz) with Cp + Cf + Cd : "); scanf( "%f", &freq_2 ) ; printf(" \n ") ; printf("Enter Cf, (in pF) the fixed capacitor in the parallel LC : "); scanf( "%f", &Cf ) ; printf(" \n ") ; printf("Enter Cd, (in pF) the delta capacitor in the parallel LC : "); scanf( "%f", &Cd ) ; printf(" \n ") ; four_pi_sqrd = 4.0 * PI * PI ; /* First calculate the parasitic parallel capacitance of the coil, Cp. */ Cp = c_parasitic( freq_1, freq_2, Cf, Cd ) ; printf( "\n \n" ) ; printf( "\n The coils parasitic capacitance, Cp = %7.2f pF \n", Cp ) ; /* Now calculate the coil's inductance from Frequency 1 and Cp + Cf. */ wk = Cp + Cf ; L_from_f1 = 1000000.0 / (four_pi_sqrd * (freq_1 * freq_1) * wk) ; printf( "\n The coils inductance from F1, Cp and Cf is = %7.2f uH \n", L_from_f1 ) ; /* Now calculate the coil's inductance from Frequency 2 and Cp + Cf + Cd. */ wk = Cp + Cf + Cd ; L_from_f2 = 1000000.0 / (four_pi_sqrd * (freq_2 * freq_2) * wk) ; printf( "\n The coils inductance from F1, Cp, Cf and Cd is = %7.2f uH \n", L_from_f2 ) ; /* Now calculate the coil's self resonant frequency from its L and Cp. */ wk = 1000.0 / ( 2.0 * PI * sqrt( L_from_f1 * Cp )) ; printf( "\n This coil's parallel LC self resonant freq. is = %9.3f MHz \n", wk ) ; /* Now calculate a whole matrix of sensitivities of Cp and L to changes */ /* in the values of Cf and Cd and the measured frequencies F1 and F2. */ /* First calculate the sensitive of Cp and L to an error in freq_1 */ freq_1_high = freq_1 + 0.10 ; freq_1_low = freq_1 - 0.10 ; Cp_freq_1_high = c_parasitic( freq_1_high, freq_2, Cf, Cd ) ; Cp_freq_1_low = c_parasitic( freq_1_low, freq_2, Cf, Cd ) ; Cp_freq_1_sens = half_diff( Cp_freq_1_high, Cp_freq_1_low ) ; printf( "\n" ) ; printf( "\n Change in Cp for a plus 100 kHz change in freq_1 = %7.2f pF \n", Cp_freq_1_sens ) ; wk = Cp + Cf ; L_f1_high = 1000000.0 / (four_pi_sqrd * (freq_1_high * freq_1_high) * wk); L_f1_low = 1000000.0 / (four_pi_sqrd * (freq_1_low * freq_1_low ) * wk); L_freq_1_sens = half_diff( L_f1_high, L_f1_low ) ; printf( " Change in L for a plus 100 kHz change in freq_1 = %7.2f uH \n", L_freq_1_sens ) ; /* Now calculate the sensitive of Cp and L to an error in freq_2 */ freq_2_high = freq_2 + 0.10 ; freq_2_low = freq_2 - 0.10 ; Cp_freq_2_high = c_parasitic( freq_1, freq_2_high, Cf, Cd ) ; Cp_freq_2_low = c_parasitic( freq_1, freq_2_low, Cf, Cd ) ; Cp_freq_2_sens = half_diff( Cp_freq_2_high, Cp_freq_2_low ) ; printf( "\n Change in Cp for a plus 100 kHz change in freq_2 = %7.2f pF \n", Cp_freq_2_sens ) ; wk = Cp + Cf + Cd ; L_f2_high = 1000000.0 / (four_pi_sqrd * (freq_2_high * freq_2_high) * wk); L_f2_low = 1000000.0 / (four_pi_sqrd * (freq_2_low * freq_2_low ) * wk); L_freq_2_sens = half_diff( L_f2_high, L_f2_low ) ; printf( " Change in L for a plus 100 kHz change in freq_2 = %7.2f uH \n", L_freq_2_sens ) ; /* Now calculate the sensitive of Cp and L to an error in Cf */ Cf_high = Cf + 1.0 ; Cf_low = Cf - 1.0 ; Cp_Cf_high = c_parasitic( freq_1, freq_2, Cf_high, Cd ) ; Cp_Cf_low = c_parasitic( freq_1, freq_2, Cf_low, Cd ) ; Cp_Cf_Sens = half_diff( Cp_Cf_high, Cp_Cf_low ) ; printf( "\n Change in Cp for a plus 1 pF change in Cf = %7.2f pF \n", Cp_Cf_Sens ) ; L_Cf_high = 1000000.0 / (four_pi_sqrd * (freq_1 * freq_1) * (Cp + Cf_high)); L_Cf_low = 1000000.0 / (four_pi_sqrd * (freq_1 * freq_1) * (Cp + Cf_low )); L_Cf_sens = half_diff( L_Cf_high, L_Cf_low ) ; printf( " Change in L for a plus 1 pF change in Cf = %7.2f uH \n", L_Cf_sens ) ; /* Now calculate the sensitive of Cp and L to an error in Cd */ Cd_high = Cd + 1.0 ; Cd_low = Cd - 1.0 ; Cp_Cd_high = c_parasitic( freq_1, freq_2, Cf, Cd_high ) ; Cp_Cd_low = c_parasitic( freq_1, freq_2, Cf, Cd_low ) ; Cp_Cd_Sens = half_diff( Cp_Cd_high, Cp_Cd_low ) ; printf( "\n Change in Cp for a plus 1 pF change in Cd = %7.2f pF \n", Cp_Cd_Sens ) ; L_Cd_high = 1000000.0 / (four_pi_sqrd * (freq_2*freq_2)*(Cp + Cf + Cd_high)); L_Cd_low = 1000000.0 / (four_pi_sqrd * (freq_2*freq_2)*(Cp + Cf + Cd_low )); L_Cd_sens = half_diff( L_Cd_high, L_Cd_low ) ; printf( " Change in L for a plus 1 pF change in Cd = %7.2f uH \n", L_Cd_sens ) ; } /* This is the c_parasitic function. It calculates and returns the value of Cp. Its input parameters are: resonant frequency with Cp + Cf, resonant frequency with Cp + Cf + Cd, value of Cf, and the value of Cd. */ float c_parasitic( float freq_1, float freq_2, float Cf, float Cd ) { float wrk, Cp ; wrk = (freq_2 * freq_2) * Cd / ((freq_1 * freq_1) - (freq_2 * freq_2)) ; Cp = wrk - Cf ; return (Cp) ; } /* This is the half_diff function. It calculates and returns a value that is one half of the difference between its two floating point agruments. */ float half_diff( float this, float that ) { float work ; work = (this - that) / 2.0 ; return (work) ; }