Create a mass budget from a CAD file (SCwRWA.mat).
------------------------------------------------------------------------
See also SCwRWA.mat, StringMatch
------------------------------------------------------------------------
fName = 'SCwRWA';
g = load(fName);
type = {g.component(:).class};
types = unique(type);
labels = char(types);
disp('----------------------------------------')
disp(['Mass Budget for ' fName])
disp('----------------------------------------')
mTotal = 0;
for k = 1:length(types)
n = StringMatch(types{k},type);
m = 0;
for j = 1:length(n)
m = m + g.component(n(j)).mass.mass;
end
mTotal = mTotal + m;
fprintf('%s: %5.1f kg\n',labels(k,:),m);
end
fprintf('\nTarget spacecraft mass: %5.1f kg\n',g.mass.mass)
fprintf( 'Mass margin : %3.2f%%\n',(g.mass.mass-mTotal)/g.mass.mass*100)
----------------------------------------
Mass Budget for SCwRWA
----------------------------------------
battery : 1.0 kg
box : 946.0 kg
magnetic_torquer : 3.0 kg
magnetometer : 1.0 kg
reaction_wheel : 5.2 kg
solar_array_back : 20.0 kg
solar_array_front : 20.0 kg
star_camera : 2.8 kg
two_axis_sun_sensor: 1.0 kg
Target spacecraft mass: 1000.0 kg
Mass margin : 0.00%