Based on the original Rocket Workbench on SourceForge in CVS at: https://sourceforge.net/projects/rocketworkbench
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.5 KiB

  1. /* cpropep.c - Calculation of Complex Chemical Equilibrium */
  2. /* Copyright (C) 2000 */
  3. /* Antoine Lefebvre <antoine.lefebvre@polymtl.ca> */
  4. /* This program is free software; you can redistribute it and/or modify*/
  5. /* it under the terms of the GNU General Public License as published by*/
  6. /* the Free Software Foundation; either version 2 of the License, or */
  7. /* (at your option) any later version. */
  8. /* This program is distributed in the hope that it will be useful, */
  9. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  10. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  11. /* GNU General Public License for more details. */
  12. /* You should have received a copy of the GNU General Public License */
  13. /* along with this program; if not, write to the Free Software */
  14. /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. #if !defined (rocket_h)
  16. #define rocket_h 1
  17. #include <iostream>
  18. #include "c++rocket.h"
  19. // enumeration for data
  20. typedef enum
  21. {
  22. pression_sol, // ground pressure in Pa
  23. masse_molaire, // molar mass of the atmosphere
  24. temperature, // temperature of the atmosphere
  25. ATM_DATA_LAST
  26. } AtmData;
  27. typedef enum
  28. {
  29. masse, // mass of the plenet in Kg
  30. rayon, // radius of the planet in m
  31. PLANETE_DATA_LAST
  32. } PlaneteData;
  33. typedef enum
  34. {
  35. Kdrag, // drag coefficient
  36. Kdd, // Kd variation with delta
  37. Klift, // lift coefficient
  38. Kspin, // cross-spin coefficient
  39. Kmoment, // moment coefficient
  40. Kdamping, // damping coefficient
  41. dmoment, // restoring moment asymetry
  42. dlift, // lift asymetry
  43. Diameter, // diameter of the rocket in m
  44. Mass, // rocket mass in kg (without booster)
  45. rcm_throat, // distance between mass center and throat throat
  46. rcm_exit, // distance between mass center and 'exit area'
  47. k, // radius of geryration about a transverse axis in meter
  48. // this field should become a function of time
  49. dt, // angle of the thrust about the rocket axis
  50. PARA_ROCKET_LAST
  51. } ParaRocket;
  52. // Classes ********************************************
  53. class propulseur {
  54. char name[32];
  55. double diameter;
  56. double length;
  57. double masse_poudre;
  58. double masse_totale;
  59. double **thrust; // table of thrust in function of time
  60. int check(void); // function to verify if there is data loaded
  61. public:
  62. double burntime;
  63. int ndata; // number of point in **thrust
  64. int load_data(char*); // char* is the file name
  65. int print_data(void);
  66. //#ifdef WITH_GTK
  67. //int plot_data(void); //plot a graph of the thrust as a fonction of time
  68. //#endif
  69. propulseur(void) { ndata = 0; }
  70. ~propulseur(void);
  71. double T(double time); // thrust in function of time
  72. double M(double time); // mass in function of time
  73. // to be verify
  74. double impulse(void); // total impulse of the motor
  75. double favg(void); // mean thrust of the motor
  76. double vg(void); // gaz speed at the exit
  77. double isp(void); // specific impulse
  78. double propellant_mass_fraction(void);
  79. double impulse_to_weight(void);
  80. };
  81. class rocket
  82. {
  83. int nprop; // nomber of stage
  84. public:
  85. char name[32]; // name of the rocket
  86. double r_data[PARA_ROCKET_LAST];
  87. class propulseur prop[MAXPROP];
  88. // set a stage of the rocket (file is the path name of the data file)
  89. int set_propulseurs(int stage, char file[128]);
  90. int n_prop(void) { return nprop; }
  91. rocket(void);
  92. rocket(double *);
  93. ~rocket() { cout << "Destroying rocket\n"; }
  94. };
  95. class atmosphere
  96. {
  97. public:
  98. double a_data[ATM_DATA_LAST];
  99. atmosphere(void);
  100. atmosphere(double *);
  101. ~atmosphere() { cout << "Destroying atmosphere\n";}
  102. };
  103. class planete : public atmosphere
  104. {
  105. public:
  106. double p_data[PLANETE_DATA_LAST];
  107. double densiteatm(double); // g/cm^3
  108. planete(void);
  109. planete(double *);
  110. planete(double *planete_data, double *atm_data);
  111. ~planete() { cout << "Destroying planete\n"; }
  112. };
  113. class flight_program
  114. {
  115. public:
  116. double ta[MAXPROP]; //temps de l'allumage (depuis le largage du pr�c�dent)
  117. double tl[MAXPROP]; //temps du largage (apr�s la fin de la combustion)
  118. int set_prog(int stage, double allumage, double largage);
  119. flight_program(void);
  120. ~flight_program(void) { }
  121. };
  122. #endif