#include #include /* delta-G - J/mol K Formula - Name - Delta-G N2O - Nitrous Oxide - 103.7 (gas) C3H8 - Propane - -23.4 (gas) CO2 - Carbon Dioxide - -394.4 (gas) H2O - Water - -228.6 (gas) N2 - Nitrogen - 0 */ int H2 = 0; int H2O = 1; int CO = 2; int CO2 = 3; int O2 = 4; int N2 = 5; int N2O = 6; int C3H8 = 7; float dG[10]; /* Table comes from page 170 of Space Propulsion Analysis and Design First index times 100 is temp Kelvin Second index are first 6 chemical compounds above */ float Enthalpy[41][6]= /* 0 */ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 300 */ {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {2.909, 3.395, 2.926, 3.943, 3.018, 2.918}, /* 500 */ {5.831, 6.869, 5.877, 8.246, 6.057, 5.856}, {8.761, 10.448, 8.895, 12.859, 9.222, 8.841}, {11.704, 14.149, 11.980, 17.715, 11.851, 11.888}, {14.659, 17.966, 15.132, 22.776, 15.815, 14.994}, {17.631, 21.910, 18.360, 28.013, 19.230, 18.180}, /* 1000 */ {20.641, 25.987, 21.646, 33.388, 22.692, 21.424}, {23.68, 30.185, 25.003, 38.892, 26.280, 24.727}, {26.761, 34.522, 28.402, 44.493, 29.867, 28.084}, {29.880, 38.980, 31.839, 50.186, 33.446, 31.479}, {33.048, 43.530, 35.317, 55.954, 37.034, 34.920}, {36.628, 48.219, 38.825, 61.785, 40.621, 38.398}, {39.512, 52.995, 42.362, 67.679, 44.338, 41.898}, {42.806, 57.858, 45.929, 73.619, 48.059, 45.435}, {46.142, 62.815, 49.516, 79.605, 51.777, 48.989}, {49.512, 67.838, 53.116, 85.625, 55.494, 52.568}, /* 2000 */ {52.928, 72.937, 56.737, 91.682, 59.215, 56.164}, {56.369, 78.106, 60.375, 97.776, 63.045, 59.772}, {59.839, 83.339, 64.021, 103.896, 66.867, 63.388}, {63.343, 88.622, 67.683, 110.050, 70.697, 67.030}, {66.871, 93.959, 71.350, 116.203, 74.519, 70.672}, {70.438, 99.346, 75.026, 122.407, 78.349, 74.335}, {74.021, 104.780, 78.726, 128.632, 82.293, 78.010}, {77.617, 110.251, 82.426, 134.864, 86.236, 81.694}, {81.250, 115.768, 86.131, 141.118, 90.179, 85.390}, {84.900, 121.310, 89.848, 147.393, 94.126, 89.095}, /* 3000 */ {88.578, 126.899, 93.570, 153.676, 98.065, 92.804}, {92.264, 132.520, 97.291, 159.997, 102.071, 96.521}, {95.972, 138.163, 101.033, 166.326, 106.090, 100.242}, {99.702, 143.839, 104.767, 172.647, 110.125, 103.968}, {103.444, 149.536, 108.514, 179.010, 114.177, 107.702}, {107.208, 155.267, 112.260, 185.360, 118.242, 111.440}, {110.979, 161.019, 116.015, 191.752, 122.311, 115.182}, {114.763, 166.791, 119.774, 198.132, 126.409, 118.933}, {118.573, 172.593, 123.537, 204.536, 130.511, 122.679}, {122.759, 178.403, 127.305, 210.949, 134.638, 126.438}, {126.220, 184.226, 131.076, 217.379, 138.778, 130.201}}; /* 10-N2O + 1 C3H8 => 10-N2 + 3-CO2 + 4-H2O */ main() { float reactants, products, deltaG; float temp, Qreq, lastQ; int Ti; /* Temp Index */ float diff, scale, extra, portion, deltaT; dG[N2O]= 103.7; dG[C3H8]= -23.4; dG[CO2]= -394.4; dG[H2O] = -228.6; dG[N2] = 0; reactants = 10 * dG[N2O] + 1*dG[C3H8]; products = 10 * dG[N2] + 3* dG[CO2] + 4 * dG[H2O]; deltaG = abs(reactants - products); printf("reactants %f products %f net energy %f \n", reactants, products, deltaG); printf("Enthalpy[20][H2O] %f \n", Enthalpy[20][H2O]); printf("Enthalpy[35][CO2] %f \n", Enthalpy[35][CO2]); Qreq=0; Ti = 3; while (Qreq < deltaG) { lastQ=Qreq; Ti++; temp=Ti*100; Qreq = 10 * Enthalpy[Ti][N2] + 3 * Enthalpy[Ti][CO2] + 4 * Enthalpy[Ti][H2O]; } scale = Qreq-lastQ; extra = deltaG - lastQ; portion = extra/scale; temp = 100.0 * (Ti-1 + portion); printf("Ti %d \n", Ti); printf("Qreq %f lastQ %f \n", Qreq, lastQ); printf("scale %f extra %f \n", scale, extra); printf("portion %f \n", portion); printf("Temp %f \n", temp); }