function TiltNStore () clc, clear, close all, format shortg , format compact % Given Values & Constraints Allowable_Stress = 36*1000; % psi Max_Tensile_Stress = 58*1000 % psi Allowable_Shear = 0.58*Max_Tensile_Stress % psi Density = 0.284 % lbs per inch cubed Bikes = 500/3; % lb g = 32.2; % ft/s^2 L1 = 72; % Length of Bar - in b1 = 1; % Width of Beam - in h1 = 3; % Height of Beam - in c1 = h1/2; % Distance between bar - in t1 = 0.12; % Thinkness of walls - in d1 = 1; % Position of Bolt from end of Beam - in b2 = 3; h2 = 3; t2 = 1/8; c2 = h2/2; d2 = 7; % in h3 = 3; b3 = 3; t4 = 1/8; c3 = h3/2; c4 = b3/2; L2 = 12; L3 = 24; b4 = 3; h4 = 3; t5 = 1/8; t6 = 1/8; c5 = h4/2; t3 = 1/8; L4 = (144-2*b1); r = 0.25/2; % Radius of Pin - in % Weight of each component W1 = Density*(b1*h1-(b1-2*t1)*(h1-2*t1))* L1; W2 = Density*(b2*h2-(b2-2*t2)*(h2-2*t2))*(36+h2); W3 = Density*(b2*h2-(b2-2*t2)*(h2-2*t2))*(d2); W4 = Density*(b3*h3-(b3-2*t4)*(h3-2*t4))*(48-h3+d1); W5 = Density*(b4*h3-(b4-2*t5)*(h3-2*t5))*(L2); W6 = Density*(b4*h4-(b4-2*t6)*(h4-2*t6))*(L3); W7 = Density*(b3*h3-(b3-2*t3)*(h3-2*t3))*(L4); TotalWeight = 3*W1+W2+W3+4*W4+2*W5+2*W6+W7 % Moment of Inertia For Different Beams I1 = (1/12 * b1 * h1^3 - 1/12*(b1-2*t1)*(h1-2*t1)^3); I2 = (1/12 * b2 * h2^3 - 1/12*(b2-2*t2)*(h2-2*t2)^3); I3 = (1/12 * h3 * b3^3 - 1/12*(h3-2*t4)*(b3-2*t4)^3); I4 = (1/12 * b4 * h4^3 - 1/12*(b4-2*t6)*(h4-2*t6)^3); I5 = (1/12 * b4 * h3^3 - 1/12*(b4-2*t5)*(h3-2*t5)^3); I6 = (1/12 * b3 * h3^3 - 1/12*(b3-2*t3)*(h3-2*t3)^3); Q1 = b1*t1*(h1/2-t1/2)+t1*((h1/2-t1)^2); Q2 = b2*t2*(h2/2-t2/2)+t2*((h2/2-t2)^2); Q3 = h3*t4*(b3/2-t4/2)+t4*((b3/2-t4)^2); Q4 = b4*t6*(h4/2-t6/2)+t6*((h4/2-t6)^2); Q5 = b4*t5*(h3/2-t5/2)+t5*((h3/2-t5)^2); Q6 = b3*t3*(h3/2-t3/2)+t3*((h3/2-t3)^2); alphadeg = 0:1:90; % Angle of Tilt N Store alpha = alphadeg *pi()/180; % Angle of Tilt N Store in Radians beta = atan((84-72*sin(alpha))./(72*cos(alpha)-d2/2)); Fp = (W1*(L1/2-d1)*cos(alpha)+(L1-d1-12-c1)*Bikes*cos(alpha)+(sqrt(2)+c1*sqrt(2))*Bikes*sin(alpha))./(c1*cos(beta+alpha)+(L1-d1)*sin(beta)); Rx1 = Fp.*(cos(beta)); Ry1 = W1 + Bikes - Fp.*sin(beta); Max_TiltNStoreWeight = max(Fp) % Load Force MA = 25; % Mechanical Advantage LoadForce = Fp/MA; Max_LoadForce = max(LoadForce) figure plot(alphadeg, Fp, 'r', alphadeg, LoadForce,'b') title('Mechanical Advantage Provided') xlabel('Anlge of Arm [degrees]') ylabel('Load Force [lb]') legend('Load without MA', 'Load with MA') y1 = linspace(0,L1-0.01,7200); ang = linspace(alpha(1,1)*180/pi(),alpha(1,91)*180/pi(),7200); for k = 1:length(alpha) l1(k,:) = y1; alp(k,:)=ang; a(k,:)=alpha*180/pi(); for j = 1:length(y1) % For Loop that goes from 1 to the number of components in x. % Shear Calculation - Defining shear as a vector Shear1(k,j) = -Rx1(1,k)*sin(alpha(1,k))*singFun(y1(j),0,0)+Ry1(1,k)*cos(alpha(1,k))*singFun(y1(j),0,0) -W1*cos(alpha(1,k))*singFun(y1(j),L1/2,0)-Bikes*cos(alpha(1,k))*singFun(y1(j),(L1-d1-c1-12),0)+Bikes*(sqrt(2)+c1*sqrt(2))*sin(alpha(1,k)+45)*singFun(y1(j),(L1-d1-c1-12),-1)+Fp(1,1)*sin(beta(1,k))-sin(alpha(1,k))*singFun(y1(j),(L1-d1),0); % Moment Calculation - Defining Moment as a vector Moment1(k,j) = -Rx1(1,k)*sin(alpha(1,k))*singFun(y1(j),0,1)+Ry1(1,k)*cos(alpha(1,k))*singFun(y1(j),0,1) -W1*cos(alpha(1,k))*singFun(y1(j),L1/2,1)-Bikes*cos(alpha(1,k))*singFun(y1(j),(L1-d1-c1-12),1)+Bikes*(sqrt(2)+c1*sqrt(2))*sin(alpha(1,k)+45)*singFun(y1(j),(L1-d1-c1-12),0)+Fp(1,1)*sin(beta(1,k))-sin(alpha(1,k))*singFun(y1(j),(L1-d1),1); end end figure plot(l1',Shear1') title('Shear Diagram - Arm') xlabel('Length of Bar [in]') ylabel('Shear Force [lb]') figure [M I] = max(Moment1); [MM II] = min(Moment1); plot(l1',Moment1') title('Moment Diagram - Arm') xlabel('Length of Bar [in]') ylabel('Moment [lb-in]') Max_Shear1(1,1)= (abs(max(max(Shear1)))*Q1/I1/(2*t1)); Max_Shear1(1,2)= (abs(min(min(Shear1)))*Q1/I1/(2*t1)); max(Max_Shear1) FA1_Shear = Allowable_Shear/max(Max_Shear1) Normal_Stress1(1,1) = (abs(max(max(Moment1)))* c1 / I1); % psi Normal_Stress1(1,2) = (abs(min(min(Moment1)))* c1 / I1); % psi max(Normal_Stress1)% psi FA1_Stress = Allowable_Stress/max(Normal_Stress1) %% Hinges/Pins % Arm Perpendicular to Frame R1 = sqrt(Rx1(1,1)^2+Ry1(1,1)^2); Tau_Max_1 = 4/3*R1/(pi()*r^2); % psi % Arm Vertical to Frame R2 = sqrt(Rx1(1,91)^2+Ry1(1,91)^2) Tau_Max_2 = 4/3*R2/(pi()*r^2) % psi Tau_Max_Hinge = max([Tau_Max_1 Tau_Max_2]) % psi Bearing_Stress = max([R1/(0.12*4*r) R2/(0.12*4*r)]) %% Pulley Support Bar Rx2 = -Fp.*sin(90-beta); Ry2 = W2+W3+Fp.*cos(90-beta); M2 = 36*Fp.*sin(90-beta)+(c2+d2/2)*Fp.*cos(90-beta)+(c2+d2/2)*W3; y2 = linspace(0,(36+h2),1000); for k = 1:length(alpha) l2(k,:) = y2; for j = 1:length(y2) % For Loop that goes from 1 to the number of components in x. % Shear Calculation - Defining shear as a vector Shear2(k,j) = -Rx2(1,k)*singFun(y2(j),0,0)-Fp(1,k)*sin(pi()/2-beta(1,k))*singFun(y2(j),36,0); % Moment Calculation - Defining Moment as a vector Moment2(k,j) = -Rx2(1,k)*singFun(y2(j),0,1)-Fp(1,k)*sin(pi()/2-beta(1,k))*singFun(y2(j),36,1)-M2(1,k)*singFun(y2(j),0,0)+(c2+d2/2)*Fp(1,k)*cos(pi()/2-beta(1,k))*singFun(y2(j),0,0); end end figure plot(l2',Shear2') title('Shear Diagram - Chain Hoist Support') xlabel('Length of Bar [in]') ylabel('Shear Force [lb]') figure plot(l2',Moment2') title('Moment Diagram - Chain Hoist Support') xlabel('Length of Bar [in]') ylabel('Moment [lb-in]') Max_Shear2(1,1)= (abs(max(max(Shear2)))*Q2/I2/(2*t2)); Max_Shear2(1,2)= (abs(min(min(Shear2)))*Q2/I2/(2*t2)); max(Max_Shear2) FA2_Shear = Allowable_Shear/max(Max_Shear2) Normal_Stress2(1,1) = (abs(max(max(Moment2)))* c2 / I2); % psi Normal_Stress2(1,2) = (abs(min(min(Moment2)))* c2 / I2); % psi max(Normal_Stress2)% psi FA2_Stress = Allowable_Stress/max(Normal_Stress2) %% Frame Legs Rwall = Rx1; % Castigliano Theorem Rx4 = Rx1-Rwall; Ry4 = W4 + Ry1; M4 = (48-h3)*Rx1 - (48-h3)*Rwall; y3 = linspace(0,(48+h3+d1),1000); for k = 1:length(alpha) l3(k,:) = y3; for j = 1:length(y3) % For Loop that goes from 1 to the number of components in x. % Shear Calculation - Defining shear as a vector Shear3(k,j) = Rx4(1,k)*singFun(y3(j),0,0)-Rx1(1,k)*singFun(y3(j),48-h3,0)+Rwall(1,k)*singFun(y3(j),48-h3,0); % Moment Calculation - Defining Moment as a vector Moment3(k,j) = Rx4(1,k)*singFun(y3(j),0,1)-Rx1(1,k)*singFun(y3(j),48-h3,1)+Rwall(1,k)*singFun(y3(j),48-h3,1) -M4(1,k)*singFun(y3(j),0,0); end end figure plot(l3',Shear3') title('Shear Diagram - Frame Leg') xlabel('Length of Bar [in]') ylabel('Shear Force [lb]') figure plot(l3',Moment3') title('Moment Diagram - Frame Leg') xlabel('Length of Bar [in]') ylabel('Moment [lb-in]') Max_Shear3(1,1)= (abs(max(max(Shear3)))*Q3/I3/(2*t4)); Max_Shear3(1,2)= (abs(min(min(Shear3)))*Q3/I3/(2*t4)); max(Max_Shear3) FA3_Shear = Allowable_Shear/max(Max_Shear3) Normal_Stress3(1,1) = (abs(max(max(Moment3)))* c4 / I3); % psi Normal_Stress3(1,2) = (abs(min(min(Moment3)))* c4 / I3); % psi max(Normal_Stress3)% psi FA3_Stress = Allowable_Stress/max(Normal_Stress3) %% Anchors Ax = -Rx2/2-2*Rx4; Ay = -Ry2/2-2*Ry4; Cx = Ax; By = W5+W6-Ay; Ma = 1/3*(L2-h4)*By-(L2/2)*W5-(L2-h4/2)*W6+(h3/2+1/3*L3)*Cx; y4 = linspace(0,L3,1000); for k = 1:length(alpha) l4(k,:) = y4; for j = 1:length(y4) % For Loop that goes from 1 to the number of components in x. % Shear Calculation - Defining shear as a vector Shear4(k,j) = Cx(1,k)*singFun(y4(j),0,0)-Cx(1,k)*singFun(y4(j),1/3*L3,0); % Moment Calculation - Defining Moment as a vector Moment4(k,j) = Cx(1,k)*singFun(y4(j),0,1)-Cx(1,k)*singFun(y4(j),1/3*L3,1)-(1/3*L3*Cx(1,k))*singFun(y4(j),0,0); end end figure plot(l4',Shear4') title('Shear Diagram - Anchor (Vertical)') xlabel('Length of Bar [in]') ylabel('Shear Force [lb]') figure plot(l4',Moment4') title('Moment Diagram - Anchor (Vertical)') xlabel('Length of Bar [in]') ylabel('Moment [lb-in]') Max_Shear4(1,1)= (abs(max(max(Shear4)))*Q4/I4/(2*t6)); Max_Shear4(1,2)= (abs(min(min(Shear4)))*Q4/I4/(2*t6)); max(Max_Shear4) FA4_Shear = Allowable_Shear/max(Max_Shear4) Normal_Stress4(1,1) = (abs(max(max(Moment4)))* c5 / I4); % psi Normal_Stress4(1,2) = (abs(min(min(Moment4)))* c5 / I4); % psi max(Normal_Stress4)% psi FA4_Stress = Allowable_Stress/max(Normal_Stress4) y5 = linspace(0,L2,1000); for k = 1:length(alpha) l5(k,:) = y5; for j = 1:length(y5) % For Loop that goes from 1 to the number of components in x. % Shear Calculation - Defining shear as a vector Shear5(k,j) = Ay(1,k)*singFun(y5(j),0,0)+By(1,k)*singFun(y5(j),(L2-h4),0)-W5*singFun(y5(j),(L2/2),0)-W6*singFun(y5(j),(L2/2-h4/2),0); % Moment Calculation - Defining Moment as a vector Moment5(k,j) = Ay(1,k)*singFun(y5(j),0,0)+By(1,k)*singFun(y5(j),(L2-h4),0)-W5*singFun(y5(j),(L2/2),0)-W6*singFun(y5(j),(L2/2-h4/2),0)-Ma(1,k)*singFun(y5(j),0,0)+Cx(1,k)*(h3/2+1/3*L3)*singFun(y5(j),0,0); end end figure plot(l5',Shear5') title('Shear Diagram - Anchor (Horizontal)') xlabel('Length of Bar [in]') ylabel('Shear Force [lb]') figure plot(l5',Moment5') title('Moment Diagram - Anchor (Horizontal)') xlabel('Length of Bar [in]') ylabel('Moment [lb-in]') Max_Shear5(1,1)= (abs(max(max(Shear5)))*Q5/I5/(2*t5)); Max_Shear5(1,2)= (abs(min(min(Shear5)))*Q5/I5/(2*t5)); max(Max_Shear5) FA5_Shear = Allowable_Shear/max(Max_Shear5) Normal_Stress5(1,1) = (abs(max(max(Moment5)))* c3 / I5); % psi Normal_Stress5(1,2) = (abs(min(min(Moment5)))* c3 / I5); % psi max(Normal_Stress5)% psi FA5_Stress = Allowable_Stress/max(Normal_Stress5) %% Frame y6 = linspace(0,L4,1000); for k = 1:length(alpha) l6(k,:) = y6; for j = 1:length(y6) % For Loop that goes from 1 to the number of components in x. % Shear Calculation - Defining shear as a vector Shear6(k,j) = -Ry4(1,k)*singFun(y6(j),0,0)-Ay(1,k)*singFun(y6(j),(L4/4-b1/2),0)-Ry4(1,k)*singFun(y6(j),(L4/2-b1),0)-Ry2(1,k)*singFun(y6(j),(L4/2),0)-Ry4(1,k)*singFun(y6(j),(L4/2+b1),0)-Ay(1,k)*singFun(y6(j),(L4/2+L4/4-b1/2),0)-Ry4(1,k)*singFun(y6(j),L4,0); % Moment Calculation - Defining Moment as a vector Moment6(k,j) = -Ry4(1,k)*singFun(y6(j),0,1)-Ay(1,k)*singFun(y6(j),(L4/4-b1/2),1)-Ry4(1,k)*singFun(y6(j),(L4/2-b1),1)-Ry2(1,k)*singFun(y6(j),(L4/2),1)-Ry4(1,k)*singFun(y6(j),(L4/2+b1),1)-Ay(1,k)*singFun(y6(j),(L4/2+L4/4-b1/2),1)-Ry4(1,k)*singFun(y6(j),L4,1); end end figure plot(l6',Shear6') title('Shear Diagram - Frame') xlabel('Length of Bar [in]') ylabel('Shear Force [lb]') figure plot(l6',Moment6') title('Moment Diagram - Frame') xlabel('Length of Bar [in]') ylabel('Moment [lb-in]') Max_Shear6(1,1)= (abs(max(max(Shear6)))*Q6/I6/(2*t3)); Max_Shear6(1,2)= (abs(min(min(Shear6)))*Q6/I6/(2*t3)); max(Max_Shear6) FA6_Shear = Allowable_Shear/max(Max_Shear6) Normal_Stress6(1,1) = (abs(max(max(Moment6)))* c3 / I6); % psi Normal_Stress6(1,2) = (abs(min(min(Moment6)))* c3 / I6); % psi max(Normal_Stress6)% psi FA6_Stress = Allowable_Stress/max(Normal_Stress6) a = 1 function f=singFun(x,a,n) if n > 0 if x >= a % For N > 0 If x is greater than a treat the function as a polynomial otherwise it equals zero f = (x-a)^n ; else f = 0 ; end end if n == 0 if x >= a % For N = 0 if x is greater than a the function equals 1 otherwise it equals zero. f = 1 ; else f = 0 ; end end if n < 0 f = 0 ; % If N < 0 the function equals 0 end end end