CoCalc Shared FilesASYS 631 - Spacecraft Engineering / Homework-04-Lab-03-MOI / HW04_Lab03MOI.sagews
Author: Jordan Ziegler
Views : 3
########### General Use Constants ###########
mu_E_km  = 3.98601e5; mu_E1 = 1.;   #Mu for Earth in km^3 s^-2 #Mu for Earth in canonical units
mu_S_km  = 1.32715e11; mu_S1 = 1.;  #Mu for Sun in km^3 s^-2 #Mu for Sun in canonical units
R_E_km = 6378.1366;  R_E1 = 1.;      #Earth radius in km #Earth radius in canonical units
pii = RealField(30)(pi);     #Pi to a certain precision
SiderealDay_s = 86164.09054; #Sidereal day in seconds
SiderealYear_s = 365.25636*SiderealDay_s; #Sidereal year in seconds
AU_km = 1.49599e8;           #Astronomical Unit in km
AU_m = 1.49599e11;           #Astronomical Unit in m
c = 299792458;               #Speed of light in m/s
k = 1.38064852e-23;          #Boltzmann constant in SI units
def RF(r): #Give me a friggin number
return RealField(30)(r)
return degree*2*pi/360
#############################################


########### MOI Lab Constants ###########
M_sr = 680.1e-3;    #Measured Mass of the steel ring in KKgrams
M_gpc = 386.7e-3;   #Measured Mass of the gray plastic cylinder in Kgrams
M_slac = 715.3e-3;  #Measured Mass of the "SLA Cylinder" in Kgrams
Ixx_sr = 1912.2;    #Calculated Ixx of steel ring Kg-mm^2
Ixx_gpc = 703.6;    #Calculated Ixx of gray plastic cylinder Kg-mm^2
Ixx_slac = 1090.5;  #Calculated Ixx of SLA cylinder Kg-mm^2
Iyy_sr = 1912.2;    #Calculated Iyy of steel ring Kg-mm^2
Iyy_gpc = 703.6;    #Calculated Iyy of gray plastic cylinder Kg-mm^2
Iyy_slac = 1090.5;  #Calculated Iyy of SLA cylinder Kg-mm^2
Izz_sr = 3602;      #Calculated Izz of steel ring Kg-mm^2
Izz_gpc = 1209.3;   #Calculated Izz of gray plastic cylinder Kg-mm^2
Izz_slac = 1950.4;  #Calculated Izz of SLA cylinder Kg-mm^2
Do_sr = 150;        #Measured Outer diameter of steel ring in mm
Do_gpc = 152;       #Measured Outer diameter of gray plastic cylinder in mm
Do_slac = 152;      #Measured Outer diameter of "SLA cylinder" in mm
DI_sr = 142;        #Measured INNER diameter of steel ring in mm
DI_gpc = 0;         #Measured INNER diameter of gray plastic cylinder in mm
DI_slac = 138;      #Measured INNER diameter of "SLA cylinder" in mm
WT_sr = 4;          #Measured Wall thinkness of steel ring in mm
WT_gpc = 0;         #Measured Wall thinkness of gray plastic cylinder in mm
WT_slac = 7;        #Measured Wall thinkness of SLA cylinder in mm
h_sr = 50;          #Measured Height of steel ring in mm
h_gpc = 51;         #Measured Height of gray plastic cylinder in mm
h_slac = 42;        #Measured Height of "SLA Cylinder" in mm
###########################################



########### MOI Lab Question 1 ###########

#The steel ring:
MOI_sr_xx = MOI_sr_yy = (M_sr/16)*( Do_sr^2 + DI_sr^2 ) + (M_sr*h_sr^2)/12;
MOI_sr_zz = (M_sr/8)*(Do_sr^2 + DI_sr^2);
print 'The MOI of the steel ring about x and y is: ', MOI_sr_xx, 'kg mm^2';
print 'The MOI of the steel ring about the z axis: ', MOI_sr_zz, 'kg mm^2';

#The plain cylinder (gray plastic cylinder):
MOI_gpc_xx = MOI_gpc_yy =  (M_gpc*Do_gpc^2)/16  +  (M_gpc*h_gpc^2)/12 ;
MOI_gpc_zz = (M_gpc*Do_gpc^2)/8;
print '\nThe MOI of the gray plastic cylinder about x and y is: ', MOI_gpc_xx, 'kg mm^2';
print 'The MOI of the gray plastic cylinder about the z axis: ', MOI_gpc_zz, 'kg mm^2';

#differences / errors for steel ring:
Error_sr_xx = 100*abs(MOI_sr_xx - Ixx_sr)/MOI_sr_xx;    #% error for the steel ring about x or y (against measured)
Error_sr_zz = 100*abs(MOI_sr_zz - Izz_sr)/MOI_sr_zz;    #% error for the steel ring about z (against measured)
print '\nThe error % for the steel ring about X or Y: ', Error_sr_xx;
print 'The error % for the steel ring about Z axis: ', Error_sr_zz;

#differences / errors for plastic cylinder:
Error_gpc_xx = 100*abs(MOI_gpc_xx - Ixx_gpc)/MOI_gpc_xx;    #% error for the plastic cylinder about x or y (against measured)
Error_gpc_zz = 100*abs(MOI_gpc_zz - Izz_gpc)/MOI_gpc_zz;    #% error for the plastic cylinder about z (against measured)
print '\nThe error % for the plastic cylinder about X or Y: ', Error_gpc_xx;
print 'The error % for the plastic cylinder about Z axis: ', Error_gpc_zz;

The MOI of the steel ring about x and y is: 1955.17415000000 kg mm^2 The MOI of the steel ring about the z axis: 3626.97330000000 kg mm^2 The MOI of the gray plastic cylinder about x and y is: 642.212025000000 kg mm^2 The MOI of the gray plastic cylinder about the z axis: 1116.78960000000 kg mm^2 The error % for the steel ring about X or Y: 2.19797044677580 The error % for the steel ring about Z axis: 0.688543805933176 The error % for the plastic cylinder about X or Y: 9.55883300378874 The error % for the plastic cylinder about Z axis: 8.28360149485632


########### Homework Question 1 ###########
P_transmit_w = 2;    #Transmit power of satellite in watts
P_transmit_dB = 10*log(P_transmit_w/1, 10);  #Transmit power of satellite in dB referenced to 1 w
G_sat_dB = 8;           #Satellite antenna gain in dB
Loss_f   = 1;           #Antenna loss/gain as a fraction
Loss_dB  = 0;           #Antenna loss/gain as dB
G_sat_rat = 10^(8/10);  #Satellite antenna gain as fraction
EIRP = P_transmit_w*G_sat_rat*Loss_f;
EIRP_dB = 10*log(P_transmit_w,10) + G_sat_dB;
print 'EIRB as a fraction is: ', RF(EIRP);
print 'EIRB in dB is: ', RF(EIRP_dB);

EIRB as a fraction is: 12.619147 EIRB in dB is: 11.010300

########### Homework Question 2 ###########
f = 2.2e9;     #Carrier freq in hz
wavelength = c/f;  #Wavelength of carrier freq
alt = 400e3;   #Altitude in meters (given as 400km)
Ls = (4*pii*alt/wavelength)^(-2);
Ls_dB = 10*log(Ls,10);  #In dB
print 'Free Space Loss L_s: ', Ls;
Ls_dB

Free Space Loss L_s: 7.3494753e-16 -151.33744


########### Homework Question 3 ###########
G_rec_dB = 20;          #Receiver gain in dB
G_rec_rat = 10^(20/10); #Receiver gain as fraction
Tnoise = 1000;          #Receiver noise temp in kelvin
GT_Ratio = G_rec_rat/Tnoise;
GT_Ratio_dB = G_rec_dB - 10*log(Tnoise,10);
print 'Receiver G/T ratio: ', GT_Ratio;
print 'Receiver G/T dB:    ', GT_Ratio_dB;



########### Homework Question 4 ###########
R = 2e6;      #Data rate given in bps
EbNo_rat = EIRP*Ls*G_rec_rat*(1/k)*(1/Tnoise)*(1/R);
EbNo_dB = EIRP_dB + Ls_dB + G_rec_dB - 10*log(k*Tnoise,10) - 10*log(R,10)
print 'EbNo as ratio: ', RF(EbNo_rat);
print 'EbNo in dB:    ', RF(EbNo_dB);

EbNo as ratio: 33.587153 EbNo in dB: 15.261732

########### Homework Question 6 ###########
M_prop_dry = 5;         #Mass of dry propulion system in kg
M_without_prop = 1000;  #Mass without propulsion system
DeltaV_req = 500;       #Total delta-v required for lifetime in m/s
Orbit_Alt = 600;        #Orbit altitude in km
Thrust = 200;           #200N thrust
Isp = 220;              #Isp in seconds
M_0 = M_prop_dry + M_without_prop;   #Total Mass of system without propellant
g = 9.81;               #Graviational acceleration near Earth surface

M_p = M_0*(e^(DeltaV_req/(Isp*g)) - 1)
print 'Propellant mass required: ', M_p, 'kg';
print 'Total system mass: ', M_p + M_0, 'kg';

Propellant mass required: 262.012902906327 kg Total system mass: 1267.01290290633 kg

########### Homework Question 7 ###########
HT_Isp = 1500;          #Hall thruster Isp in seconds
HT_Thrust = 50e-3;      #Hall thruster thrust in N
HT_Thruster_mass = 2;   #Hall thruster mass in kg
HT_PwrSys_mass = 10;    #Hall thruster power system mass in kg
HT_Tank_mass = 3;       #Hall thruster tank mass in kg
HT_M_0 = HT_Thruster_mass + HT_PwrSys_mass + HT_Tank_mass + M_without_prop; #Mass of system (including hall thruster) without propellant

HT_M_p = HT_M_0*(e^(DeltaV_req/(HT_Isp*g)) - 1);
print 'HT Propellant mass required: ', HT_M_p, 'kg';
print 'Total system mass: ', HT_M_p + HT_M_0, 'kg';

HT Propellant mass required: 35.0812535988290 kg Total system mass: 1050.08125359883 kg


########### Homework Question 9 ###########
mdot_hyd = Thrust/(g*Isp);     #Mass flow rate for the hydrazine system
hyd_time = M_p/mdot_hyd;       #Burn time for the hydrazine system
print 'Burn time for full delta V of hydrazine system: ', hyd_time, 'seconds';
print '                                                ', hyd_time/60, 'minutes';
print '                                                ', hyd_time/60/60, 'hours';
print '                                                ', hyd_time/60/60/24, 'days';
print '                                                ', hyd_time/60/60/24/365, 'years';

mdot_hall = HT_Thrust/(g*HT_Isp);
hall_time = HT_M_p/mdot_hall;
print '\nBurn time for full delta V of hall system:      ', hall_time, 'seconds';
print '                                                ', hall_time/60, 'minutes';
print '                                                ', hall_time/60/60, 'hours';
print '                                                ', hall_time/60/60/24, 'days';
print '                                                ', hall_time/60/60/24/365, 'years';

Burn time for full delta V of hydrazine system: 2827.38123526217 seconds 47.1230205877029 minutes 0.785383676461715 hours 0.0327243198525714 days 0.0000896556708289629 years Burn time for full delta V of hall system: 1.03244129341354e7 seconds 172073.548902256 minutes 2867.89248170427 hours 119.495520071011 days 0.327384986495921 years


########### Homework Question 10 ###########
mission_life = 4*SiderealYear_s;   #Mission life in seconds (4 years)
percent_mx_life_hyd = hyd_time/mission_life*100;
percent_mx_life_hall = hall_time/mission_life*100;
print '% mission life hydrazine: ', percent_mx_life_hyd, '%';
print '% mission life hall     : ', percent_mx_life_hall, '%';

% mission life hydrazine: 0.00224595104041468 % % mission life hall : 8.20127320712797 %