A very simple 'XYZ' spacecraft with six panels and axes.

The axes follow the order of MATLAB's default colors: x - blue y - green x - red

The model is stored in XYZSat.mat in SCModels/ ------------------------------------------------------------------------- See also BuildCADModel, CreateBody, CreateComponent, QLVLH, FindDirectory, SaveStructure -------------------------------------------------------------------------

Contents

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

Data

%-----
r                  = 7000;
v                  = sqrt(3.98600436e5/r);
rECI               = [r;0;0];
vECI               = [0;v;0];
qLVLH              = QLVLH( rECI, vECI );
q                  = [1;0;0;0];
omega              = [0;-v/r;0];

Core box

%---------
coreX              = 1.0;
coreY              = 1.0;
coreZ              = 1.0;
corePosition       = [0; 0; 0];

Set mass properties

%-----------------------------------
mass.mass    = 20;
mass.cM      = [0;0;0];
mass.inertia = 10/3*eye(3);

Initialize

%-----------
BuildCADModel( 'initialize' );

% Add spacecraft properties
%--------------------------
BuildCADModel( 'set name' ,      'Cube Spacecraft' );
BuildCADModel( 'set units',      'mks'  );
BuildCADModel( 'set rECI' ,      rECI   );
BuildCADModel( 'set vECI' ,      vECI   );
BuildCADModel( 'set qLVLH',      qLVLH  );
BuildCADModel( 'set qECIToBody', q      );
BuildCADModel( 'set omega',      omega  );
BuildCADModel( 'set mass',       mass   );

Create bodies first

%--------------------

% Core Body
%-----------
m = CreateBody( 'make', 'name', 'Core' );
BuildCADModel('add body', m );

% This creates the connections between the bodies
%------------------------------------------------
BuildCADModel( 'compute paths' );

Add Components

%----------------

% Core
%------
m = CreateComponent( 'make', 'box', 'x', coreX, 'y', coreY, 'z', coreZ,...
                     'faceColor', 'gold foil','inside',0,...
                     'rA', corePosition, 'mass', 20, 'name', 'Core', 'body', 1 );
BuildCADModel( 'add component', m );

% Components representing axes
%-----------------------------
m = CreateComponent( 'make', 'box', 'x', coreX, 'y', 0.03, 'z', 0.03,...
                      'faceColor', [0 0 1],'inside',0,...
                     'rA', [coreX;0;0], 'mass', 0, 'name', 'X Axis', 'body', 1 );
BuildCADModel( 'add component', m );
m = CreateComponent( 'make', 'box', 'x', 0.03, 'y', coreY, 'z', 0.03,...
                     'faceColor', [0 1 0],'inside',0,...
                     'rA', [0;coreY;0], 'mass', 0, 'name', 'Y Axis', 'body', 1 );
BuildCADModel( 'add component', m );
m = CreateComponent( 'make', 'box', 'x', 0.03, 'y', 0.03, 'z', coreZ,...
                     'faceColor', [1 0 0],'inside',0,...
                     'rA', [0;0;coreZ], 'mass', 0, 'name', 'Z Axis', 'body', 1 );
BuildCADModel( 'add component', m );

Get the finished model

%------------------------
g = BuildCADModel( 'get cad model' );
BuildCADModel('show spacecraft');

dName = FindDirectory('SCModels');
if( isempty( dName ) ), dName = []; end
SaveStructure( g, fullfile(dName,'XYZSat') )


%--------------------------------------