13.07.2015 Views

An Integrated, Modular Simulation System for Education ... - Cal Poly

An Integrated, Modular Simulation System for Education ... - Cal Poly

An Integrated, Modular Simulation System for Education ... - Cal Poly

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

***** Compute the rolling moment excluding controls. *****/RollingMoment+=(ClBeta*Beta_Pert+Clp*pHat+Clr*rHat)*QS*Span;/***** Compute the yawing moment excluding controls. *****/YawingMoment+=(CnBeta*Beta_Pert+Cnp*pHat+Cnr*rHat)*QS*Span;/***** Compute the <strong>for</strong>ces and moments due to controls deflections and* rates. This includes throttle setting effects. This routine* modifies the already computed values of the <strong>for</strong>ces and moments in* wind axis. ******//***** Controls done here *****/Cy = CyDelR*Deflect_Rudder;Cz = CLDelE*Deflect_Elevator;Cl = ClDelA*Deflect_Aileron+ClDelR*Deflect_Rudder;Cm = CmDelE*Deflect_Elevator;Cn = CnDelA*Deflect_Aileron+CnDelR*Deflect_Rudder;/*Fx=Fx+Cx*QS;*/ /*****dimensionalize and add the control <strong>for</strong>ces *****/FyWind +=Cy*QS;FzWind -=Cz*QS; /***** Lift caused by elevator - Lift is negative z *****/RollingMoment+=Cl*QS*Span;PitchingMoment+=Cm*QS*Chord;YawingMoment+=Cn*QS*Span;Wind2Body(FxWind, FyWind, FzWind, AirSpeed);Fx=Fx + Thrust; /***** Thrust <strong>for</strong>ce Body axis *****/}void Accelerate( ){/* load deltaVect struct with delta change values <strong>for</strong> roll, pitch, andyaw based on control position and airspeed */uDot=Fx/Mass-g*STheta-q*w+r*v;vDot=Fy/Mass+g*CTheta*SPhi-r*u+p*w;wDot=Fz/Mass+g*CTheta*CPhi-p*v+q*u;/***** tau=I*Thetadot -> Thetadot=tau/I - w x H *****/pDot=(q*r*(Iyy-Izz)/Ixx+(RollingMoment/Ixx)+(Ixz/Ixx)*(q*(p*((Ixx-Iyy)/Izz)-r*(Ixz/Izz)+p)+YawingMoment/Izz))*(1/(1-(Ixz/Ixx)*(Ixz/Izz)));qDot=p*r*(Izz-Ixx)/Iyy + PitchingMoment/Iyy+(r*r-p*p)*Ixz/Iyy;rDot=p*q*(Ixx-Iyy)/Izz+(pDot-q*r)*(Ixz/Izz)+YawingMoment/Izz;}/* This function applies the current angular rates of change to the148

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!