Extension of AssignmentDemo to include collision monitoring.
Since version 7.
------------------------------------------------------------------------
See also AC, Plot2D, Plot3D, CollisionSurvey, Plot3DEllipsoids,
VerifyCollStruct, ImpulsiveManeuver, RotateState, State_Structure,
Window_Structure, FFEccDiscreteHills, SetupAssignmentProblem,
DeltaElem2Hills, ManeuverStruct2AccelVector, Alfriend2El, OrbRate
------------------------------------------------------------------------
Contents
dGoals = load('AssignmentResults');
IDs = dGoals.relIDs;
optOrder = dGoals.order1;
optPhi = dGoals.phi1;
window = dGoals.window;
teamGoals = dGoals.teamGoals;
dEl = dGoals.dEl;
mass = 170;
fNom = 1.0*1e-3;
dTMax = 300;
dVMax = fNom/mass*dTMax;
Parameters
parameters = [];
parameters.fNom = fNom;
parameters.dTMin = 0.0;
parameters.maxDeltaV = dVMax;
parameters.horizon = 300;
parameters.eTol = 1e-4;
parameters.nSPOCoarse = 300;
parameters.nSPOFine = 6000;
state = State_Structure;
state.elA = dGoals.el0;
state.el = Alfriend2El(state.elA);
state.tM = 0;
state.mass = mass;
window = Window_Structure;
window.nManeuvers = 3;
window.timeWeightExp = 0.5;
dColl = [];
dColl.hRef = dGoals.el0(1)-6378;
dColl.eRef = 0;
dColl.dR = 0.2;
dColl.initBounds = [0.1 0.1 0.1 0.0005 0.0005 0.0005]/1000;
dColl.scalev = 1;
dColl.mSC = 100;
dColl.lenSC = 7.0;
dColl.diaSC = 1.0;
dColl.Cd = 2;
dColl.Cr = 1.5;
dColl.el0 = state.el;
dColl.rate = OrbRate(state.el(1));
dColl = VerifyCollStruct(dColl);
map goals to satellites
goals = [];
scID = [];
[N,M,P,Pu,Q,phi,u] = SetupAssignmentProblem( teamGoals );
assign the target states
for j=1:N
if( j <= M )
index = j;
else
index = M + u(j-M);
end
geomGoals = teamGoals.geometry(index);
if( j > M )
geomGoals = RotateState( geomGoals, optPhi(j) );
end
if( isempty(goals) )
goals = geomGoals;
else
goals(end+1) = geomGoals;
end
scID(end+1) = IDs(optOrder(j));
end
xH = zeros(6,8);
for k = 1:8
xH(:,k) = DeltaElem2Hills(state.elA,dGoals.dEl(k,:));
state.xH = xH(:,k);
mvr(k) = ImpulsiveManeuver(state,goals(k),window,parameters);
end
tic
[probC, dMin, xhat, Shat, tProp] = CollisionSurvey( dColl, 0, xH(:,2:8)-repmat(xH(:,1),1,7), mvr(1), [mvr(2:end)] );
toc
whos('mvr')
[aC,t] = ManeuverStruct2AccelVector( mvr(1), tProp );
[xS1,nu] = FFEccDiscreteHills( dColl.eRef, dColl.rate, xH(:,1), dEl(1,2), aC, t );
Plot3D(xS1(1:3,:),'X - zenith','Y - along-track','Z - cross-track','Hills Trajectories'); hold on;
colors = {'r','g','c','y','m','k','b'};
for k = 1:7
xHsc = xhat{k}(1:3,:)+xS1(1:3,:);
plot3(xHsc(1,:),xHsc(2,:),xHsc(3,:),colors{k});
end
axis tight
axis equal
view(-130,20)
Plot2D(tProp/3600,cell2mat(dMin)','Time (hr)','Minimum Distance (km)','Collision Proximity Metric')
nPts = size(xhat{1},2);
el1 = zeros(3,nPts);
for k = 1:nPts
S1 = Shat{1}(1:3,1:3,k);
[u,s,v] = svd(S1);
el1(:,k) = sqrt(diag(s));
end
Plot2D(tProp/3600,[el1],'Time (hr)',{'Target'},'Ellipsoid Semimajor Axes, km')
Plot3DEllipsoids(xhat{1},Shat{1},50);
Elapsed time is 0.459538 seconds.
Name Size Bytes Class Attributes
mvr 1x8 34368 struct