Guided 3D simulation of an example 4 stage rocket

The rocket is simulated using a fixed-timestep integration. Pitchover occurs at a predetermined time.

See also GuidedLaunch3D, GuidedLaunch3DRHS.

%--------------------------------------------------------------------------
%	 Copyright (c) 2014 Princeton Satellite Systems, Inc.
%  All rights reserved.
%--------------------------------------------------------------------------

% Rocket
rocket = RocketDatabase('examplerocket');

% Launch site - latitude, longitude, altitude
lla0   = [0;-pi/2;11];

% Initial velocity (km/s) and flight path angle (rad)
vg0    = [.237; 81*pi/180];

% Target conditions, altitude, inclination, right ascension.
altDes = 350;         % km
incDes = 51.6*pi/180; % rad
raDes  = 0;           % rad
jD0 = JD2000;

% Parameters
% Specify pitchover angle and time, and whether to use J2 perturbations
params = GuidedLaunch3D;
params.fControl{1} = @ThrustControlGravityTurn;
params.fControl{2} = @ThrustControlConstantAngle;
params.fControl{3} = @ThrustControlConstantAngle;
params.fControl{4} = @ThrustControlRaiseApogee;
params.fParams{1} = struct('minAlt',0);
params.fParams{2} = struct('minAlt',0,'angle',0);
params.fParams{3} = struct('minAlt',0,'angle',5*pi/180);
params.fParams{4} = struct('rA',6378+altDes);

% Simulation
sim = GuidedLaunch3D( rocket, lla0, vg0, altDes, incDes, raDes, jD0, params )


%--------------------------------------
% PSS internal file version information
%--------------------------------------
Predicted burnout velocity: 9.174282 km/s, time: 480.189447 s
Stage 1, Alt 11.0 km, Vel 0.536 km/s, FPA 81.000 deg, VBar 0.068
Flight path angle after pitchover: 80.590901 deg, Alt 11.259 km, Vel 0.538 km/s
Stage 2, Alt 62.4 km, Vel 2.027 km/s, FPA 36.998 deg, VBar 0.258
Stage 3, Alt 124.6 km, Vel 4.397 km/s, FPA 5.671 deg, VBar 0.562
Stage 4, Alt 152.6 km, Vel 7.744 km/s, FPA 2.201 deg, VBar 0.991
Max altitude of 349.047318 km reached at 1341.300000 seconds.

sim = 

        input: [1x1 struct]
          VBO: [2.03103518349312 4.40064593571958 7.74732312447597]
      gammaBO: [0.575375139166721 0.09604583981044 0.0420481735909777]
      thetaBO: [-0.0110590935642422 -0.0474921217499283 -0.12953976204687]
        altBO: [62.4411271654208 124.63100089882 152.601326530009]
      rangeBO: [-70.5364470258358 -302.911401418087 -826.222737901625]
          kBO: [962 1796 2729]
       timeBO: [96.0999999999988 179.499999999994 272.799999999994]
        range: [1x27461 double]
          alt: [1x27461 double]
         time: [1x27461 double]
           xs: [10x27461 double]
          rOP: [3x27461 double]
          rEF: [3x27461 double]
        gamma: [1x27461 double]
        mFuel: [4x27461 double]
    thrustDir: [3x27461 double]
    thrustMag: [1x27461 double]