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.

To confirm the program code, several complete stand alone simulators and IOfunctions were written to test the new code be<strong>for</strong>e incorporating them into S-functions.Where graphics and joystick input were required <strong>for</strong> verification, the Snoopy IO packagewas used. Virtually all of the stand alone program code that was created <strong>for</strong> use in the <strong>Cal</strong><strong>Poly</strong> simulation lab has been converted to S-functions. The components have becomepart of a simulation laboratory using the same hardware and software through theconversion of the pieces to S-functions.To verify the CMEX S-function, a first order Euler, then a second order numericalintegrator (using a Runge-Kutta 4 integration method) were placed into the S-functiontemplate and imported into Simulink blocks. The Euler block was tested against aSimulink first order transfer function using the Euler integration scheme. The RK4integrator test code uses three different damping ratios corresponding to the commandedpitch, roll, and yaw angles. The test sent three step input signals to the integrators. Theresults were compared to the same system set up using second order transfer functionsand the built in Simulink RK4 integrators. Both functions matched with the Simulinkfunctions with less than 0.5% difference.The next step was to create a transfer function model of the same system as thecustom S-function block. The values were entered into the block, the time step was set tothe same value, and Runge-Kutta was selected <strong>for</strong> integration.To verify the process and accuracy of the code generated by RTW, the RK4numerical integrators created to test the S-functions were placed in a new model and autocoded in batch mode. The program was run and the results were automatically saved to atext file <strong>for</strong> analysis. The results from the output file were compared with the output fromthe PhEagle I numerical integrators, the original output from the S-function run in the41

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

Saved successfully!

Ooh no, something went wrong!