%***********************************************************************************
% 
% Side Force Subfunction
% Primary authors: Kacie Burton, Kevin Dahya, Mellisa Glaser, Kerem Koray
% Wael Nour, and Tanya Tunistra
% AAE 421 Design Project Spring 2001
%
%***********************************************************************************

function [Cyo,Cy_Beta,Cy_da,Cy_dr,Cy_p,Cy_r,Cy_Beta_v,Cl_alpha_v,K_prime,Kb]=sideforce(gamma,Sref,S_ver,lambda,A,Z_v,b_horz,l_v,b)

% These equations were given in Roskam, Methods for Estimating Stability and Control Derivative os Conventional Subsonic Airplanes

Cyo=0;																	
gamma=.0349;													%dihedral angle of the wing taken from the Boiler Xpress 451 Final Report (rad)													
Cy_Beta_w=-0.0001*abs(gamma)*57.3;						%Eqn 7.2 of Roskam Handout  (rad-1)
ki=1;																%Fig. 7.1 of Roskam Handout
So=(3.5/12)*0.5;												%cross-sectional area of fusealge taken from Boiler Xpress 451 Final Report (ft^2)
Cy_Beta_b=-2*ki*(So/Sref);									%Eqn 7.4 of Roskam Handout (rad-1)
k=0.75; 															%Figure 7.3 of Roskam Handout
z_W=0;															%vert. distance from wing root quarterchord to fuselage centerline, positive downward (ft)
d=0.5; 															%Fuselage diameter in feet, assumption from 6" height and 3.5" width
Cl_alpha_v=0.27217;											%lift coeff. for vertical tail, taken from the Boiler Xpress 451 Final Report
global Cy_Beta_v
Cy_Beta_v=-k*Cl_alpha_v*(0.724+3.06*((S_ver/Sref)/(1+cos(lambda)))+0.4*(z_W/d)+0.009*A)*(S_ver/Sref);	%Eqn 7.4 of Roskam Handout
Cy_Beta=Cy_Beta_w+Cy_Beta_b+Cy_Beta_v					%Eqn 7.1 of Roskam Handout
Cy_da=0	 														%Ref 11.1 of Roskam Handout
global K_prime													%No flaps Fig 10.7 from Roskam Handout
K_prime=1;
global Kb
Kb=1; 															%No flaps Fig 10.3 from Roskam Handout
alpha_d_CL_alpha_d_cl=1;									%Fig 10.1 from Roskam Handout
global Cy_dr
Cy_dr=Cl_alpha_v*(alpha_d_CL_alpha_d_cl)*(S_ver/Sref)*(K_prime)*(Kb);	%
Cl_pv=2*Cy_Beta_v*(Z_v/b)^2;								%Eqn 8.5 of Roskam Handout
Cy_p=2*Z_v*Cy_Beta_v/b_horz								%Eqn 8.1 of Roskam Handout (rad-1)
Cy_r=-2*l_v*Cy_Beta_v/b_horz								%Eqn 9.1 of Roskam Handout (non-dim)
