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.

double Alt, TempK, Press, Density, VSound, T0,P0;/* Function: mdlInitializeSizes ===============================================* Abstract:* Setup sizes of the various vectors.*/static void mdlInitializeSizes(SimStruct *S){ssSetNumSFcnParams(S, NUM_PARAMS);if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {return; /* Parameter mismatch will be reported by Simulink */}if (!ssSetNumInputPorts(S, 1)) return;ssSetInputPortWidth(S, 0, 1);ssSetInputPortDirectFeedThrough(S, 0, 1);if (!ssSetNumOutputPorts(S,1)) return;ssSetOutputPortWidth(S, 0, 4);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#if defined(MDL_START)/* Function: mdlstart* Initialize the state variables*/static void mdlStart(SimStruct *S){/***** Value <strong>for</strong> sea level TEMPERATURE in K. *****/T0=BASE_TEMP;/* T0=288.16; *//***** Value <strong>for</strong> sea level PRESSURE in N/m^2 *****/P0=BASE_PRESS;/* P0=101325.0; */Alt=1.0;}#endif /* MDL_START *//* Function: mdlOutputs =======================================================* Abstract: Using this the function as a gateway. Lookup is157

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

Saved successfully!

Ooh no, something went wrong!