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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

* Setup sizes of the various vectors.*/static void mdlInitializeSizes(SimStruct *S){ssSetNumSFcnParams(S, 0);if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {return; /* Parameter mismatch will be reported by Simulink */}/* ssSetNumContStates(S, 0);ssSetNumDiscStates(S, 0); */ssSetNumInputPorts(S, 0);/* ssSetInputPortWidth(S, 0, 0); *//* ssSetInputPortDirectFeedThrough(S, 0, 1); */if (!ssSetNumOutputPorts(S,1)) return;ssSetOutputPortWidth(S, 0, 16);/* Stick, rudder, and throttles */ssSetNumSampleTimes(S, 1);}/* Take care when specifying exception free code - see sfuntmpl.doc */ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);/* Function: mdlInitializeSampleTimes =========================================* 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 /* Change to #undef to remove function */#if defined(MDL_START)/* Function: mdlStart ========================================* Abstract:* Initialize the da cards.*/static void mdlStart(SimStruct *S){unsigned short int addr;addr=0x220;aToD12.addr=0x220;aToD12.maxADCount=4095;aToD12.minADVoltage=-5.0;aToD12.maxADVoltage=5.0;aToD12.nADChannels=16;aToD12.nDAChannels=2;aToD12.base= addr;aToD12.cnt0= addr + 0;aToD12.cnt1=addr + 1;aToD12.cnt2=addr + 2;117

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

Saved successfully!

Ooh no, something went wrong!