|
| 1 | +classdef CircularEarthOrbit < otp.cr3bp.CR3BPProblem |
| 2 | + % This preset builds a circular earth orbit in CR3BP based on |
| 3 | + % the equations derived in :cite:p:She20. |
| 4 | + |
| 5 | + methods |
| 6 | + function obj = CircularEarthOrbit(varargin) |
| 7 | + % Create the CircularEarthOrbit CR3BP problem object. |
| 8 | + % |
| 9 | + % Parameters |
| 10 | + % ---------- |
| 11 | + % OrbitalRadius : numeric(1, 1) |
| 12 | + % The radius of the orbit above Earth's surface in km. |
| 13 | + |
| 14 | + p = inputParser(); |
| 15 | + p.addParameter('OrbitalRadius', 6556, @isnumeric); |
| 16 | + p.parse(varargin{:}); |
| 17 | + results = p.Results; |
| 18 | + |
| 19 | + equatorialRadius = 6378; |
| 20 | + earthMoonDist = 385000; |
| 21 | + orbitalradius = results.OrbitalRadius; |
| 22 | + |
| 23 | + delta = (equatorialRadius + orbitalradius)/earthMoonDist; |
| 24 | + |
| 25 | + mE = otp.utils.PhysicalConstants.EarthMass; |
| 26 | + mL = otp.utils.PhysicalConstants.MoonMass; |
| 27 | + G = otp.utils.PhysicalConstants.GravitationalConstant; |
| 28 | + |
| 29 | + % derive mu |
| 30 | + muE = G*mE; |
| 31 | + muL = G*mL; |
| 32 | + mu = muL/(muE + muL); |
| 33 | + |
| 34 | + % set initial distance to Earth |
| 35 | + x0 = -mu + delta; |
| 36 | + |
| 37 | + % derive the initial velocity |
| 38 | + y0 = -sqrt((1 - mu)/delta); |
| 39 | + |
| 40 | + % derive the orbital period |
| 41 | + period = sqrt(((abs(delta))^3)/(1 - mu))*2*pi; |
| 42 | + |
| 43 | + y0 = [x0; 0; 0; 0; y0; 0]; |
| 44 | + tspan = [0, period]; |
| 45 | + params = otp.cr3bp.CR3BPParameters('Mu', mu, 'SoftFactor', 1e-3, varargin{:}); |
| 46 | + obj = obj@otp.cr3bp.CR3BPProblem(tspan, y0, params); |
| 47 | + end |
| 48 | + end |
| 49 | +end |
0 commit comments