Demonstrates how to use the thermal modeling package
The spacecraft is a cube with two solar wings.
------------------------------------------------------------------------
See also SpaceCamera, SpaceThermalCamera, SpacecraftThermal,
PlotThermal, DrawSCPlanPlugIn, QForm, QLVLH, QPose, TimeGUI,
FindSolsticeOrEquinox, RVFromKepler, SolarFlx, SunV1, AutoPoint,
CameraDatabase, ThermalImager
------------------------------------------------------------------------
Contents
Load the CAD model
g = load('SCForImaging');
DrawSCPlanPlugIn(g);
g.body(2).bHinge.angle = 0;
g.body(2).bHinge.axis = 2;
g.body(3).bHinge.angle = 0;
g.body(3).bHinge.axis = 2;
Set up the simulation
global simulationAction
simulationAction = 'Do Nothing';
jD0 = FindSolsticeOrEquinox('spring equinox',2002);
nDays = 2;
nSamp = 300;
t = linspace(0,nDays,nSamp)*86400;
jD = jD0 + t/86400;
dTSim = t(2)-t(1);
[rECI, vECI] = RVFromKepler( [42167 0 0 0 0 0], t );
camera = CameraDatabase('256 square');
camera.up = [0;-1;0];
camera.focalLength = 0.05;
qECIToLVLH = QLVLH( rECI(:,1), vECI(:,1) );
g.body(1).bHinge.q = QPose(qECIToLVLH);
g.rECI = rECI(:,1);
g.qLVLH = qECIToLVLH;
g.name = 'Satellite';
d = struct('position',[]);
d.planetName = 'Earth';
d.camera = camera;
tagVisibleCameraWindow = SpaceCamera( 'initialize', d, g, jD(1) );
figH = findobj( 'tag', tagVisibleCameraWindow );
h = get( figH, 'UserData' );
d.position = get(h.fig3D,'position') + [camera.xPixels 0 0 0];
d.planetName = 'Earth';
d.camera = camera;
d.imagerFunction = @ThermalImager;
d.colorMap = hot;
d.tempMax = 700;
g.temperature = 300*ones(length(g.component),1);
d.name = 'SpaceThermalCamera';
tagInfraredCameraWindow = SpaceCamera( 'initialize', d, g, jD(1) );
e = struct;
flux0 = SolarFlx(1);
e.planet = 'earth';
e.planetRadius = 6378.165;
e.s = flux0*SunV1(jD(1));
e.tSamp = dTSim;
e.shadow = 0;
e.showScans = 0;
e.nScanLines = 10;
e.units = 'm';
q = zeros(length(g.component),nSamp);
temp = zeros(length(g.component),nSamp);
qLVLHToBody = Mat2Q([0 0 -1;0 1 0;1 0 0]);
[ ratioRealTime, tToGoMem ] = TimeGUI( nSamp, 0 );
Loop through the disturbances
for k = 1:nSamp
[ ratioRealTime, tToGoMem ] = TimeGUI( nSamp, k, tToGoMem, ratioRealTime, dTSim );
[uSun, rSun] = SunV1(jD(k));
e.s = flux0*uSun;
e.r = rECI(:,k);
e.v = vECI(:,k);
e.rSun = rSun*uSun;
qLVLH = QLVLH( rECI(:,k), vECI(:,k) );
uSunLVLH = QForm( qLVLH, uSun );
theta = atan2( uSunLVLH(1), uSunLVLH(3) );
g.body(1).bHinge.q = QPose(QMult(qLVLH,qLVLHToBody));
g.body(2).bHinge.angle = theta;
g.body(3).bHinge.angle = theta;
g.rECI = rECI(:,k);
g.qLVLH = qLVLH;
p = SpacecraftThermal( 'run', g, e );
[qCamera,rCamera,distance] = AutoPoint( 'above', camera, g );
camera.rBody = rCamera;
camera.qBody = qCamera;
camera.distance = distance;
g.temperature = p.temperature;
SpaceCamera( 'update camera', tagVisibleCameraWindow, camera, jD(k) );
SpaceCamera( 'update spacecraft', tagVisibleCameraWindow, g, jD(k) );
SpaceCamera( 'update camera', tagInfraredCameraWindow, camera, jD(k) );
SpaceCamera( 'update spacecraft', tagInfraredCameraWindow, g, jD(k) );
q(:,k) = p.qTotal;
temp(:,k) = p.temperature;
switch simulationAction
case 'pause'
pause
simulationAction = ' ';
case 'stop'
return;
case 'plot'
break;
end
end
Plot the results
PlotThermal( q(:,1:k), temp(:,1:k), t(1:k), g );