/* * pfn.c -- calc capacitance, voltage, and inductance for a PFN. * * compile: cc -o pfn pfn.c -lm * * Copyright (c) 2000, Eddie Kovelan and Sam Goldwasser */ #include #include main() { float C, L, V, E, T, K; printf("\n \ ************************************************************\n \ * This program finds a capacitor (uF), voltage (V), *\n \ * and inductor (uH) for a given energy (J), pulse *\n \ * duration (us), and flashlamp impedance Ko (ohms-A^.5): *\n \ ************************************************************\n"); /* E = 10.0; */ /* Energy (Joules) */ /* T = 500.0;*/ /* Duration in (us) */ /* K = 13.0;*/ /* Lamp Impedance (ohms-A^.5) */ printf("\nEnter Energy (J): "); scanf("%f", &E); printf("Enter Pulse Duration (us): "); scanf("%f", &T); printf("Enter Lamp Impedance Ko (ohms-A^.5): "); scanf("%f", &K); C = cbrt( (.09102 * E * ((T * 1e-6) * (T * 1e-6)) / pow(K, 4.0)) ); /* C = cbrt( (.091 * E * ((T * 1e-6) * (T * 1e-6)) /(K*K*K*K)) );*/ L = (((T * 1e-6) * (T * 1e-6)) / (9 * (C * 1e-6))); V = sqrt((2 * E) / C); printf("\n"); printf("C = %.9f F -or- %.3f uF\n", C, C * 1e6); printf("V = %.3f volts\n", V); printf("L = %.3f uH\n\n", L); }