Skip to content

Commit c6bca5c

Browse files
committed
Added more Halo orbit presets
1 parent e05cacc commit c6bca5c

File tree

3 files changed

+181
-71
lines changed

3 files changed

+181
-71
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ docs/build/
1010
docs/problems/
1111

1212
.DS_Store
13+
tests/octave-workspace
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
classdef HaloOrbit < otp.cr3bp.CR3BPProblem
2+
% This preset builds a halo orbit preset for the CR3BP based on
3+
% a table of reference initial conditions and periods. There are four
4+
% possible different orbits given by this preset, $L_2$, $P2HO_1$,
5+
% $P2HO_2$, $P4HO_1$, and $P4HO_2$. The tables contain $20$ entries, and
6+
% thus there are $100$ different possible orbits given by this preset.
7+
% The tables of $L_2$ halo orbits are given as Table A.1--A.5 on pages
8+
% 218--222 of :cite:p:`Spr21`.
9+
10+
methods
11+
function obj = HaloOrbit(varargin)
12+
% Create the NRHO CR3BP problem object.
13+
%
14+
% Parameters
15+
% ----------
16+
% OrbitType : string
17+
% One of the following:
18+
% a. 'L2' for the L2 Orbit family (default)
19+
% b. 'P2HO1' for the period doubling halo orbit of type 1
20+
% c. 'P2HO2' for the period doubling halo orbit of type 2
21+
% d. 'P4HO1' for the period quadrupling halo orbit of type 1
22+
% e. 'P4HO2' for the period quadrupling halo orbit of type 2
23+
% Index : numeric(1, 1)
24+
% An integer index between 1 and 20.
25+
26+
p = inputParser();
27+
p.addParameter('OrbitType', 'L2', ...
28+
@(x) strcmp(x, 'L2') || strcmp(x, 'P2HO1') || strcmp(x, 'P2HO2') ...
29+
|| strcmp(x, 'P4HO1') || strcmp(x, 'P4HO2'));
30+
p.addParameter('Index', 1, @(x) mod(x, 1) == 0 && x > 0 && x <= 20);
31+
p.parse(varargin{:});
32+
results = p.Results;
33+
34+
T = gethalotable(results.OrbitType);
35+
36+
pic = T(results.Index, :);
37+
38+
orbitalperiod = pic(1);
39+
ic = pic(2:end);
40+
41+
mE = otp.utils.PhysicalConstants.EarthMass;
42+
mL = otp.utils.PhysicalConstants.MoonMass;
43+
G = otp.utils.PhysicalConstants.GravitationalConstant;
44+
45+
% derive mu
46+
muE = G*mE;
47+
muL = G*mL;
48+
mu = muL/(muE + muL);
49+
50+
y0 = [ic(1); 0; ic(2); 0; ic(3); 0];
51+
tspan = [0, orbitalperiod];
52+
params = otp.cr3bp.CR3BPParameters('Mu', mu, 'SoftFactor', 0);
53+
obj = obj@otp.cr3bp.CR3BPProblem(tspan, y0, params);
54+
end
55+
end
56+
end
57+
58+
59+
function T = gethalotable(orbittype)
60+
% create internal table of halo orbit initial conditions
61+
% The first entry of each row is the orbital period, the second entry is
62+
% the $x$ initial condition, the third entry is the $z$ initial condition
63+
% and the fourth entry is the $y'$ intial condition.
64+
switch orbittype
65+
case 'L2'
66+
T = [ ...
67+
1.3632096570 1.0110350588 -0.1731500000 -0.0780141199; ...
68+
1.4748399512 1.0192741002 -0.1801324242 -0.0971927950; ...
69+
1.5872714606 1.0277926091 -0.1858044184 -0.1154896637; ...
70+
1.7008482705 1.0362652156 -0.1904417454 -0.1322667493; ...
71+
1.8155211042 1.0445681848 -0.1942338538 -0.1473971442; ...
72+
1.9311168544 1.0526805665 -0.1972878310 -0.1609628828; ...
73+
2.0474562565 1.0606277874 -0.1996480091 -0.1731020372; ...
74+
2.1741533495 1.0691059976 -0.2014140887 -0.1847950147; ...
75+
2.2915829886 1.0768767277 -0.2022559057 -0.1943508955; ...
76+
2.4093619266 1.0846726654 -0.2022295078 -0.2027817501; ...
77+
2.5273849254 1.0925906981 -0.2011567058 -0.2101017213; ...
78+
2.6455248145 1.1007585320 -0.1987609769 -0.2162644440; ...
79+
2.7635889805 1.1093498794 -0.1946155759 -0.2211327592; ...
80+
2.8909903824 1.1194130163 -0.1873686594 -0.2246002627; ...
81+
3.0073088423 1.1297344316 -0.1769810336 -0.2254855800; ...
82+
3.1205655022 1.1413664663 -0.1612996515 -0.2229158600; ...
83+
3.2266000495 1.1542349115 -0.1379744940 -0.2147411949; ...
84+
3.3173903769 1.1669663066 -0.1049833863 -0.1984458292; ...
85+
3.3833013605 1.1766385512 -0.0621463948 -0.1748356762; ...
86+
3.4154433338 1.1808881373 -0.0032736457 -0.1559184478];
87+
case 'P2HO1'
88+
T = [ ...
89+
2.7486723000 1.0124213729 -0.1739463747 -0.0801103670; ...
90+
2.8235719903 0.9686100061 -0.1684646845 -0.0555868296; ...
91+
2.9470915455 0.9428902766 -0.1621459176 -0.0367463465; ...
92+
3.0718373938 0.9280339523 -0.1570215893 -0.0278535009; ...
93+
3.2098634414 0.9177532010 -0.1525284780 -0.0253346758; ...
94+
3.3390119532 0.9116052635 -0.1492702168 -0.0275809790; ...
95+
3.4781621508 0.9074818076 -0.1466452811 -0.0334316688; ...
96+
3.6071172693 0.9053614223 -0.1449312614 -0.0411597104; ...
97+
3.7456075513 0.9044951611 -0.1437576475 -0.0512886367; ...
98+
3.8738428281 0.9047472035 -0.1431979716 -0.0619366228; ...
99+
4.0115944839 0.9059473646 -0.1430690015 -0.0743674595; ...
100+
4.1392474276 0.9077780758 -0.1433117179 -0.0865211750; ...
101+
4.2765261366 0.9103912789 -0.1438936424 -0.0999906823; ...
102+
4.4039019522 0.9133170339 -0.1446839313 -0.1126257931; ...
103+
4.5410586110 0.9169169198 -0.1457671148 -0.1261483024; ...
104+
4.6684708483 0.9206100089 -0.1469654829 -0.1384542728; ...
105+
4.8057987675 0.9249032213 -0.1484447194 -0.1512842987; ...
106+
4.9334592177 0.9291366414 -0.1499785567 -0.1627035911; ...
107+
5.0711130707 0.9339173119 -0.1517856322 -0.1743951579; ...
108+
5.2089533970 0.9388868141 -0.1537336561 -0.1854168651];
109+
case 'P2HO2'
110+
T = [ ...
111+
4.5243776465 0.9902279661 0.0392479429 0.7431504374; ...
112+
4.3364693699 0.9913034068 0.0386425658 0.7476198379; ...
113+
4.3344588357 0.9925765901 0.0404028452 0.7275812069; ...
114+
4.3322427233 0.9936999422 0.0418211289 0.7119297395; ...
115+
4.3274956856 0.9956999819 0.0440891033 0.6876036122; ...
116+
4.3154119806 0.9997963248 0.0479397591 0.6474122281; ...
117+
4.2966706889 1.0050420842 0.0517347036 0.6074272113; ...
118+
4.2610464740 1.0135348381 0.0559827198 0.5575089518; ...
119+
4.2236953788 1.0214960279 0.0583763748 0.5199524066; ...
120+
4.2114971687 1.0239852380 0.0588603231 0.5093886860; ...
121+
4.2066140086 1.0249716121 0.0590196996 0.5053259810; ...
122+
4.2037569181 1.0255464522 0.0591042680 0.5029882761; ...
123+
4.2014068389 1.0260181267 0.0591691271 0.5010860112; ...
124+
4.1989300286 1.0265141820 0.0592329594 0.4991004650; ...
125+
4.1953346327 1.0272324868 0.0593174846 0.4962518855; ...
126+
4.1879862293 1.0286948426 0.0594609346 0.4905454113; ...
127+
4.1645925208 1.0333161410 0.0596666029 0.4732448565; ...
128+
4.0891753953 1.0483318888 0.0577756525 0.4227218693; ...
129+
3.9680003798 1.0758753256 0.0417283774 0.3430241217; ...
130+
3.9102015266 1.0926153718 0.0005492180 0.2990655449];
131+
case 'P4HO1'
132+
T = [ ...
133+
8.2676291788 1.0619393673 -0.1999741894 -0.1749961447; ...
134+
8.3305139834 1.0681129545 -0.1976100673 -0.1868722998; ...
135+
8.3392497293 1.0738246899 -0.1946216607 -0.1984738200; ...
136+
8.3519917053 1.0786654098 -0.1919984087 -0.2083581121; ...
137+
8.3693678945 1.0833295002 -0.1893927253 -0.2179310067; ...
138+
8.3878867600 1.0871892065 -0.1871812140 -0.2258888455; ...
139+
8.4096026243 1.0909131908 -0.1850039744 -0.2335944979; ...
140+
8.4309304649 1.0940376079 -0.1831478491 -0.2400766927; ...
141+
8.4547978250 1.0971075676 -0.1813014490 -0.2464568317; ...
142+
8.4775801091 1.0997316965 -0.1797082140 -0.2519152440; ...
143+
8.5026193458 1.1023550439 -0.1781043165 -0.2573726538; ...
144+
8.5262347341 1.1046324969 -0.1767049403 -0.2621078568; ...
145+
8.5519768095 1.1069405119 -0.1752821493 -0.2669009993; ...
146+
8.5761129683 1.1089683638 -0.1740297442 -0.2711051374; ...
147+
8.6023105873 1.1110450669 -0.1727463692 -0.2754011052; ...
148+
8.6267952587 1.1128866230 -0.1716087730 -0.2792006165; ...
149+
8.6533063618 1.1147879601 -0.1704357869 -0.2831115888; ...
150+
8.6780368548 1.1164862743 -0.1693902247 -0.2865931191; ...
151+
8.7047739081 1.1182510772 -0.1683067141 -0.2901975105; ...
152+
8.7316043012 1.1199566179 -0.1672632043 -0.2936663490];
153+
case 'P4HO2'
154+
T = [ ...
155+
9.0487552928 1.0749349573 -0.2021215571 -0.1920690379; ...
156+
9.0396341760 1.0578442875 -0.2047569352 -0.1678532831; ...
157+
9.0542791209 1.0524484578 -0.2047233749 -0.1606194256; ...
158+
9.0601028655 1.0505487899 -0.2045610040 -0.1581773718; ...
159+
9.0646190673 1.0491368344 -0.2043821958 -0.1564064537; ...
160+
9.0707205473 1.0472961590 -0.2040685317 -0.1541623227; ...
161+
9.0786237393 1.0450028327 -0.2035390634 -0.1514838937; ...
162+
9.0888613168 1.0421535217 -0.2026443039 -0.1483728351; ...
163+
9.1037491359 1.0382266494 -0.2009270031 -0.1445796433; ...
164+
9.1306372229 1.0319435819 -0.1968531223 -0.1401578788; ...
165+
9.2021506431 1.0215863525 -0.1864218292 -0.1399647167; ...
166+
9.3830140082 1.0126738542 -0.1723454500 -0.1560887631; ...
167+
9.5440425474 1.0113733655 -0.1648460585 -0.1739113299; ...
168+
9.6990195652 1.0129644895 -0.1593270671 -0.1918297866; ...
169+
10.2961547121 1.0286792032 -0.1457428883 -0.2522546927; ...
170+
11.7792576999 1.0624281188 -0.1343562748 -0.3275531781; ...
171+
13.7831848966 1.0850769369 -0.1379181777 -0.3653699405; ...
172+
16.0024825055 1.0955445136 -0.1591111395 -0.3767847569; ...
173+
18.1058513583 1.0954718438 -0.1988427540 -0.3675757435; ...
174+
20.0406128078 1.0829659022 -0.2591580427 -0.3388198392];
175+
otherwise
176+
error('OTP:InvalidInput: %s is not a valid orbit family; try L2, P2HO1, P2HO2, P4HO1, or P4HO2', ...
177+
orbittype)
178+
end
179+
180+
end

toolbox/+otp/+cr3bp/+presets/L2NRHO.m

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)