4 real R = 22.16 * 12; /* in lbf / lbm (gas constant for ffff powder */
5 real T = 3307; /* combustion temperature for BP */
6 real d_mm; /* diameter(mm) */
7 real l_mm; /* length(mm) */
8 real f_N; /* force(N) */
10 real A_mm²; /* area of bulkhead (mm²) */
12 real V_mm³; /* free volume (mm³) */
14 real M_lb; /* mass of BP in lb */
16 real P_Nmm²; /* pressure (N/mm²) */
17 real P_lbin²; /* pressure (psi) */
21 "usage: %s diameter(mm) length(mm) force(N)\n",
26 d_mm = string_to_real(argv[1]);
27 l_mm = string_to_real(argv[2]);
28 f_N = string_to_real(argv[3]);
29 f_lb = f_N * 0.22480894;
31 A_mm² = pi * (d_mm/2) ** 2;
34 A_in² = A_mm² / (25.4**2);
35 V_in³ = V_mm³ / (25.4**3);
39 P_lbin² = P_Nmm² * 0.22480894 * (25.4 ** 2);
41 M_lb = (P_lbin² * V_in³) / (R * T);
42 M_g = M_lb * 453.59237;
44 printf ("Input parameters:\n");
45 printf (" Diameter: %.1g (mm) %.3g (in)\n",
47 printf (" Length: %.1g (mm) %.3g (in)\n",
49 printf (" Force: %.1g (N) %.3g (lb)\n",
52 printf ("Chamber values:\n");
53 printf (" Area: %.0f (mm²) %.3g (in²)\n",
55 printf (" Volume: %.0f (mm³) %.3g (in³)\n",
57 printf (" Pressure: %.2g (lb/in²) %.5g (N/mm²)\n",
60 printf ("Results:\n");
61 printf (" FFFF powder: %.3g (g)\n", M_g);