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.

#endif /* MDL_INITIALIZE_CONDITIONS *//* Function: mdlOutputs =======================================================* Abstract:* simply passes states y[n] = x[n]**/static void mdlOutputs(SimStruct *S, int_T tid){InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);real_T *y = ssGetOutputPortRealSignal(S,0);float newVal;newVal = doConversion(&pitchPos,&aToD12);newVal = 0.4*newVal + 0.6*oldVals[0];oldVals[0] = newVal;y[0] = (int)newVal;newVal = doConversion(&rollPos,&aToD12);newVal = 0.4*newVal + 0.6*oldVals[1];oldVals[1] = newVal;y[1] = (int)(-newVal);newVal = doConversion(&rudderPos,&aToD12);newVal = 0.4*newVal + 0.6*oldVals[2];oldVals[2] = newVal;y[2] = (int)(-newVal);newVal = doConversion(&rThrottle,&aToD12);newVal = 0.4*newVal + 0.6*oldVals[2];oldVals[3] = newVal;y[3] = (int)newVal;}newVal = doConversion(&lThrottle,&aToD12);newVal = 0.4*newVal + 0.6*oldVals[2];oldVals[4] = newVal;y[4] = (int)newVal;#define MDL_UPDATE /* Change to #undef to remove function */#if defined(MDL_UPDATE)/* Function: mdlUpdate ======================================================* Abstract:* This function is called once <strong>for</strong> every major integration time step.* Discrete states are typically updated here, but this function is useful* <strong>for</strong> per<strong>for</strong>ming any tasks that should only take place once per* integration step.*/static void mdlUpdate(SimStruct *S, int_T tid){}#endif /* MDL_UPDATE */#define MDL_DERIVATIVES /* Change to #undef to remove function */#if defined(MDL_DERIVATIVES)/* Function: mdlDerivatives =================================================135

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

Saved successfully!

Ooh no, something went wrong!