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.

its similarity to other structured languages students have been exposed to allows lessexperienced programmers to maintain the code and create new functions. Since S-functions are functions instead of programs, the development and testing process issimplified.Expanding the PossibleThe process of separating the IO and modeling functions into Simulink S-functions without adding other functions provides greater flexibility to the researchers.The ability to select and set up model components one at a time allows a simulation to bebuilt up and tested systematically to the level required <strong>for</strong> each kind of data collection.Output - D to AStarting with the c++ code created <strong>for</strong> PhEagle I, a Simulink D/A S-function wascreated to provide input to a simulation from the PheEagle stick, pedals, and throttles.The code had to be converted to c code to function inside the S-function template. Theprocess of converting the D/A driver to c necessitated several changes to the originalcode. C++ uses classes as a structure to construct programs. C++ provides flexibility byallowing generalized functions to be created. Since c++ is an extension of the c language,all of the extensions had to be duplicated within the scope of the c language. Since theflexibility (and complexity) of overloaded classes were not required <strong>for</strong> simulation, thespecific cases required <strong>for</strong> the S-functions were cut and pasted from the c++ classes.Creating the D/A S-function required a new data structure, simplification of thefunction structure, separation of the D/A and A/D functionality from a single function,and simplified error trapping. To keep the functions as simple as possible the A/D andD/A functions were separated into an input block and an output block respectivly. The43

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

Saved successfully!

Ooh no, something went wrong!