PaGMO  1.1.5
misc4Tandem.cpp
1 // ------------------------------------------------------------------------ //
2 // This source file is part of the 'ESA Advanced Concepts Team's //
3 // Space Mechanics Toolbox' software. //
4 // //
5 // The source files are for research use only, //
6 // and are distributed WITHOUT ANY WARRANTY. Use them on your own risk. //
7 // //
8 // Copyright (c) 2004-2007 European Space Agency //
9 // ------------------------------------------------------------------------ //
10 
11 
12 #include "misc4Tandem.h"
13 #include "math.h"
14 #include <vector>
15 
16 //The following data refer to the Launcher Atlas501 performances as given by NASA
17  static const double x_atl[9] = {2.5,3,3.5,4,4.5,5,5.5,5.75,6};
18  static const double y_atl[15] = {-90,-40, -30,-29,-28.5, -20, -10, 0, 10, 20,28.5,29,30, 40, 90};
19  static const double data_atl[15][9] = {
20  {1e-1,1e-1,1e-1,1e-1,1e-1,1e-1,1e-1,1e-1,1e-1},
21  {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
22  {10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0},
23  {1160,1100,1010,930,830,740,630,590,550},
24  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
25  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
26  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
27  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
28  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
29  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
30  {2335.0 ,2195.0,2035.0,1865.0,1675.0,1480.0,1275.0,1175.0,1075.0},
31  {1160,1100,1010,930,830,740,630,590,550},
32  {10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0},
33  {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
34  {1e-1,1e-1,1e-1,1e-1,1e-1,1e-1,1e-1,1e-1,1e-1}
35 };
36 
37 //The following data refer to the Launcher Soyuz-Fregat performances as given by ESOC. The data here and consider
38 // an elaborated five impulse strategy to exploit the launcher performances as much as possible.
39 static const double x_sf[5] = {1,2,3,4,5};
40 static const double y_sf[15] = {-90, -65, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50, 65, 90};
41 static const double data_sf[15][5] = {
42  {1e-3,1e-3,1e-3,1e-3,1e-3},
43  {100.00000,100.00000,100.00000,100.00000,100.00000},
44  {1830.50000,1815.90000,1737.70000,1588.00000,1344.30000},
45  {1910.80000,1901.90000,1819.00000,1636.40000,1369.30000},
46  {2001.80000,1995.30000,1891.30000,1673.90000,1391.90000},
47  {2108.80000,2088.60000,1947.90000,1708.00000,1409.50000},
48  {2204.00000,2167.30000,1995.50000,1734.50000,1419.60000},
49  {2270.80000,2205.80000,2013.60000,1745.10000,1435.20000},
50  {2204.70000,2133.60000,1965.40000,1712.80000,1413.60000},
51  {2087.90000,2060.60000,1917.70000,1681.10000,1392.50000},
52  {1979.17000,1975.40000,1866.50000,1649.00000,1371.70000},
53  {1886.90000,1882.20000,1801.00000,1614.60000,1350.50000},
54  {1805.90000,1796.00000,1722.70000,1571.60000,1327.60000},
55  {100.00000,100.00000,100.00000,100.00000,100.00000},
56  {1e-3,1e-3,1e-3,1e-3,1e-3}
57  };
58 
59 int xant(const double &x) {
60  int i;
61  for(i=1; i<4; i++) {
62  if (x_sf[i]>x) break;
63  }
64  return i-1;
65 }
66 
67 int yant(const double &y) {
68  int i;
69  for(i=1; i<14; i++) {
70  if (y_sf[i]>y) break;
71  }
72  return i-1;
73 }
74 
75 int xantA5(const double &x) {
76  int i;
77  for(i=1; i<8; i++) {
78  if (x_atl[i]>x) break;
79  }
80  return i-1;
81 }
82 
83 int yantA5(const double &y) {
84  int i;
85  for(i=1; i<14; i++) {
86  if (y_atl[i]>y) break;
87  }
88  return i-1;
89 }
90 
91 
92 
93 double interp2SF(const double &VINF, const double &declination) {
94 
95  double retval;
96  int v_indx=xant(VINF);
97  int dec_indx=yant(declination);
98  if (fabs(declination)>=90) return 1e-3;
99  if ((VINF<1)||(VINF>5)) return 1e-3;
100 
101  double dx = x_sf[v_indx+1]-x_sf[v_indx];
102  double dydx = dx * (y_sf[dec_indx+1]-y_sf[dec_indx]);
103  retval = data_sf[dec_indx][v_indx] / dydx * (x_sf[v_indx+1]-VINF) * (y_sf[dec_indx+1]-declination);
104  retval += data_sf[dec_indx][v_indx+1] / dydx * (VINF - x_sf[v_indx]) * (y_sf[dec_indx+1]-declination);
105  retval += data_sf[dec_indx+1][v_indx] / dydx * (x_sf[v_indx+1]-VINF) * (declination - y_sf[dec_indx]);
106  retval += data_sf[dec_indx+1][v_indx+1] / dydx * (VINF - x_sf[v_indx]) * (declination - y_sf[dec_indx]);
107  return retval;
108 }
109 
110 
111 double interp2A5(const double &VINF, const double &declination) {
112 
113  double retval;
114  int v_indx=xantA5(VINF);
115  int dec_indx=yantA5(declination);
116  if ((VINF<2.5)||(VINF>6)) return 1e-1;
117  if (fabs(declination)>=90) return 1e-1;
118 
119  double dx = x_atl[v_indx+1]-x_atl[v_indx];
120  double dydx = dx * (y_atl[dec_indx+1]-y_atl[dec_indx]);
121  retval = data_atl[dec_indx][v_indx] / dydx * (x_atl[v_indx+1]-VINF) * (y_atl[dec_indx+1]-declination);
122  retval += data_atl[dec_indx][v_indx+1] / dydx * (VINF - x_atl[v_indx]) * (y_atl[dec_indx+1]-declination);
123  retval += data_atl[dec_indx+1][v_indx] / dydx * (x_atl[v_indx+1]-VINF) * (declination - y_atl[dec_indx]);
124  retval += data_atl[dec_indx+1][v_indx+1] / dydx * (VINF - x_atl[v_indx]) * (declination - y_atl[dec_indx]);
125  return retval;
126 }
127 
128 
129 double SoyuzFregat (const double &VINF, const double &declination) {
130 //This function returns the mass that a Soyuz-Fregat launcher can inject
131 //into a given escape velocity and asymptote declination. The data here
132 //refer to ESOC WP-521 and consider an elaborated five impulse strategy to
133 //exploit the launcher performances as much as possible.
134  return interp2SF(VINF,declination);
135 }
136 
137 
138 double Atlas501 (const double &VINF, const double &declination) {
139 //This function returns the mass that a Atlas501 Launcher
140  return interp2A5(VINF,declination);
141 }
142 void ecl2equ (double (&ecl)[3],double (&equ)[3]){
143  static const double incl=0.409072975;
144  double temp[3];
145  temp[0]=ecl[0];
146  temp[1]=ecl[1];
147  temp[2]=ecl[2];
148  equ[0]=temp[0];
149  equ[1]=temp[1]*cos(incl)-temp[2]*sin(incl);
150  equ[2]=temp[1]*sin(incl)+temp[2]*cos(incl);
151 }
152 
153