% Josh Closson % MSD Selection Code clear clc %% Assign Variables velocity=30; % Velocity in MPH rBall=4.325; %Radius of Soccer Ball in massBall=430; %Mass of Soccer Ball g xinitial=7; %Initial spring length in xfinal=12; %Final spring length in SF=1.15; %Factor of Safety k=22.00; %Spring Constant of selected spring lbf/in Torquemotor=600; %Servo Torque in oz-in SpeedMotor=44; %Servo Speed RPM rmotor=.5; %Radius of motor gear in' %% Conversions v=velocity*1.4667; %Convert from MPH to ft/s r=rBall/12; %Convert from in to ft m=massBall*.00220462; %Convert from g to lbm m=m/32.174; %Convert from lbm to lbf %% Assign Formulas I=(2/3)*m*r^2; %MOI:Hollow Thin Wall Sphere w=(v/r); %Rotational speed %% Energy in Spring Calculation Espring=(1/2)*m*v^2+(1/2)*I*w^2; %Calculate Energy needed from Spring disp('Spring Energy - ft-lbf'); disp(Espring); Espring=Espring*12; %Convert ft-lbf to lbf-in %% Spring Constant Calculation kmin=Espring/((xfinal-xinitial)^2); %Calculate minimum needed spring constant disp('Minimum Spring Constant - lbf/in'); disp(kmin); % kminSF=SF*kmin; %Add in Factor of Safety % disp('Minimum Spring Constant w/Safety Factor - lbf/in'); % disp(kminSF); maxload=SF*kmin*(xfinal-xinitial); %Calculate anticipated Max Load disp('Max Spring Load w/Safety Factor - lb'); disp(maxload); %% Find Gear Size of X Fspring=k*(xfinal-xinitial); %Find Spring force lbf Fspring=Fspring*16; %Convert lbf to oz RackGearRadius=.5*((xfinal-xinitial)/(pi*0.75)); %Calculate rack and pinion gear radius GearSize=(rmotor*Fspring)/Torquemotor; %Calculate middle gear size disp('Motor Gear Diameter - in'); disp(rmotor*2); disp('Middle Drive Gear Diameter - in'); disp(GearSize*2); disp('Rack and Pinion Gear Diameter - in'); disp(RackGearRadius*2); %% Find Output Speed MechAdv=RackGearRadius/rmotor; %Find Mechanical Advantage disp('Gear Ratio'); disp(MechAdv); SpeedOut=SpeedMotor/MechAdv; %Calculate output speed in RPM disp('Output Speed - RPM'); disp(SpeedOut);