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.

}if (0 != (i = delay)) { /* delay? */tt = 1234;<strong>for</strong> (i *= 10; i-- > 0;)tt *= 19;}js = m | ~mask;s->a[0] = (js & 0x01) ? 0 : minx1; /* analog 1 */s->a[1] = (js & 0x02) ? 0 : miny1; /* analog 2 */s->a[2] = (js & 0x04) ? 0 : minx2; /* analog 3 */s->a[3] = (js & 0x08) ? 0 : miny2; /* analog 4 */js = ~JS_READ;s->b[0] = !!(js & 0x10); /* button 1 */s->b[1] = !!(js & 0x20); /* button 2 */s->b[2] = !!(js & 0x40); /* button 3 */s->b[3] = !!(js & 0x80); /* button 4 */}return (m);/* Function: mdlOutputs =======================================================* Abstract:* simply passes states y[n]**/static void mdlOutputs(SimStruct *S, int_T tid){real_T *y = ssGetOutputPortRealSignal(S,0);int i;double XOut, YOut;Ulong testno;STICK s[1];i = 3;/* <strong>for</strong> (testno = 1;;) { */i = readjoy (s, 0, 3, 1, 0);/* This section calibrates the output <strong>for</strong> a Kraft KC3 stick *//* and normalizes the outputs */XOut=1-s->a[0]/290.0;YOut=1-s->a[1]/290.0;if (XOut < 0.0) XOut/=2.3;if (XOut > 0.0) XOut*=1.048;if (YOut < 0.0) YOut/=2.3;if (YOut > 0.0) YOut*=1.048;y[0] = XOut;y[1] = YOut;/* } */}#define MDL_UPDATE /* Change to #undef to remove function */#if defined(MDL_UPDATE)/* Function: mdlUpdate ======================================================* Abstract:171

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

Saved successfully!

Ooh no, something went wrong!