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.

* Abstract:* Specifiy that we inherit our sample time from the driving block.*/static void mdlInitializeSampleTimes(SimStruct *S){ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);ssSetOffsetTime(S, 0, 0.0);}#define MDL_START#if defined(MDL_START)/* Function: mdlstart* Initialize the state variables*/static void mdlStart(SimStruct *S){X = INIT_X; /* initial locations feet */YY = INIT_Y;Z = INIT_Z;/* negative altitude */Psi = INIT_PSI*Deg2Rad; /* euler yaw angle - input degs */Theta = INIT_THETA*Deg2Rad; /* euler angle */Phi = INIT_PHI*Deg2Rad;/* euler angle */}#endif /* MDL_START *//* Function: mdlOutputs =======================================================* Abstract:* inputs:* p = *uPtrs[0] body roll rate ***** Input in Deg/Sec ****** q = *uPtrs[1] body pitch rate* r = *uPtrs[2] body yaw rate* alpha = *uPtrs[3] angle of attack - set to 0 if supplying v & W* beta = *uPtrs[4] side slip - set to 0 if supplying v & W* u = *uPtrs[5] If letting this routine do alpha and beta* v = *uPtrs[6] then v and w whould be 0!!!!* w = *uPtrs[7] ***** Ft/Sec ******* outputs:* y[0] = x position FEET* y[1] = y position* y[2] = z altitude* y[3] = psi - euler yaw ***** OUTput in degrees ****** y[4] = theta - euler pitch* y[5] = phi - euler roll** states: not using s-function states* x position FEET* y position* z -altitude* psi - euler yaw ***** Keeps angles in RADIANS ******* theta - euler pitch* phi - euler roll*/static void mdlOutputs(SimStruct *S, int_T tid){int_T i;162

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

Saved successfully!

Ooh no, something went wrong!