-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHohmannManuver.java
131 lines (112 loc) · 3.33 KB
/
HohmannManuver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import java.lang.Math;
import java.lang.*;
public class HohmannManuver
{
public double initHeight;
public double finalHeight;
protected final void ChangeInitHeight(double newInitHeight)
{
this.initHeight = newInitHeight;
}
protected final double DryMass()
{
return this.initHeight;
}
protected final void ChangeFinalHeight(double newFinalHeight)
{
this.finalHeight = newFinalHeight;
}
protected final double FinalHeight()
{
return this.finalHeight;
}
public HohmannManuver(double initHeight, double finalHeight)
{
this.ChangeInitHeight(initHeight);
this.ChangeFinalHeight(finalHeight);
}
public HohmannManuver()
{
}
public double DeltaV()
{
long earthGM = 398600441800000L;
/*Delta-V calculation 1*/
double periapsis;
double apoapsis;
if(initHeight < finalHeight)
{
periapsis = initHeight;
apoapsis = finalHeight;
}
else
{
periapsis = finalHeight;
apoapsis = initHeight;
}
//Lower orbit calculation set
double semiMajorOneOne = periapsis * 2;
double semiMajorOne = semiMajorOneOne / 2;
double lowerOneOne = 2 / periapsis;
double lowerOneTwo = 1 / semiMajorOne;
double lowerOneThree = lowerOneOne - lowerOneTwo;
double lowerOneFour = earthGM * lowerOneThree;
double lowerOne = Math.sqrt(lowerOneFour);
double semiMajorTwoOne = periapsis + apoapsis;
double semiMajorTwo = semiMajorTwoOne / 2;
double lowerTwoOne = 2 / periapsis;
double lowerTwoTwo = 1 / semiMajorTwo;
double lowerTwoThree = lowerTwoOne - lowerTwoTwo;
double lowerTwoFour = earthGM * lowerTwoThree;
double lowerTwo = Math.sqrt(lowerTwoFour);
//Higher orbit calculation set
double semiMajorThreeOne = periapsis + apoapsis;
double semiMajorThree = semiMajorThreeOne / 2;
double upperOneOne = 2 / apoapsis;
double upperOneTwo = 1 / semiMajorThree;
double upperOneThree = upperOneOne - upperOneTwo;
double upperOneFour = earthGM * upperOneThree;
double upperOne = Math.sqrt(upperOneFour);
double semiMajorFourOne = apoapsis * 2;
double semiMajorFour = semiMajorFourOne / 2;
double upperTwoOne = 2 / apoapsis;
double upperTwoTwo = 1 / semiMajorFour;
double upperTwoThree = upperTwoOne - upperTwoTwo;
double upperTwoFour = earthGM * upperTwoThree;
double upperTwo = Math.sqrt(upperTwoFour);
double lower = lowerTwo - lowerOne;
double upper = upperTwo - upperOne;
double deltaV = upper + lower;
return deltaV;
}
public double BurnTime(double initMass, double deltaV, double specificImpulse, double engineThrust, double craftDeltaV)
{
double ve = specificImpulse * 9.81;
double k = 0;
if(deltaV < ve * .1)
{
k = 1;
}else if(deltaV < ve * .35 && deltaV >= ve * .1)
{
k = 0.9;
}else if(deltaV < ve * .65 && deltaV >= ve * .35)
{
k = 0.8;
}else if(deltaV < ve * .85 && deltaV >= ve * .65)
{
k = 0.7;
}else if(deltaV >= ve * .85)
{
k = 0.6;
}
double burnTimeOne = initMass / engineThrust;
double burnTimeTwo = k * deltaV;
double burnTime = burnTimeOne * burnTimeTwo;
double deltaVRemaining = craftDeltaV - deltaV;
double deltaVUsed = deltaV / craftDeltaV * 100;
double deltaVRemainingPercent = 100 - deltaVUsed;
System.out.println("\n" + deltaVRemaining + "m/s Delta V remaining");
System.out.println(deltaVUsed + "% of Delta V used, " + deltaVRemainingPercent + "% remaining\n");
return burnTime;
}
}