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.

vSquared = u*u+w*w;AlphaSpeed = sqrt(vSquared);combo = -v/(AlphaSpeed*AirSpeed);Fx += FxWind*u/AirSpeed+FyWind*u*combo-FzWind*w/AlphaSpeed;Fy += FxWind*v/AirSpeed+FyWind*AlphaSpeed/AirSpeed;Fz += FxWind*w/AirSpeed+FyWind*w*combo+FzWind*u/AlphaSpeed;}/****************************************************************************/void read_derivs(char *fname, double *dp){FILE *f;char *c;int i;if (!(f = fopen(fname, "rt"))) {free(c); printf("Could Not open file");}if (!(c = (char *)malloc(N_COLS*sizeof(char))));{ printf("Memory not dynamically allocated");}<strong>for</strong> (i = 0; i < 48; i++, dp++){readline(c,f);*dp = atof(c);}}free(c);fclose(f);/****************************************************************************//* Function: mdlUpdate =====================================================* Abstract:* per<strong>for</strong>m action at major integration time step*/static void mdlUpdate(SimStruct *S, int_T tid){}/* Function: mdlTerminate =====================================================* Abstract:* No termination needed, but we are required to have this routine.*/static void mdlTerminate(SimStruct *S){}#ifdef MATLAB_MEX_FILE /* Is this file being compiled as a MEX-file? */#include "simulink.c" /* MEX-file interface mechanism */#else#include "cg_sfun.h" /* Code generation registration function */#endif151

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

Saved successfully!

Ooh no, something went wrong!