5.1 Hardware
All of the schematics for the sensors are described in this section. Each sensor is briefly described to explain its use and operation needs. As a common note for all of the schematics, the electrical engineer followed a certain continuous layout in each schematic, where practical: all power inputs are set on the top or left side of the schematic, other inputs on the left, output signals to the right and ground to the bottom. The first schematic is the various power supplies shown in Figure . The figures of schematics span from Figure : Power Supplies to Figure : Altitude Sensor.
Figure : Power Supplies
Figure : Accelerometer
Figure : Gyroscope
Figure : Angle Sensors
Figure : Force Sensors Circuit
Figure : Humidity Sensor
Figure : Microcontroller
Figure : SD Card Connector
Figure : Altitude Sensor
5.2 Software
5.2.1 Program Overview
The program is designed as a method to take the data off of the storage device used on the sensor array. Then to take the data points and condense them to average values to allow for computation. Next the program runs mathematical functions to find any remaining values that need to be found. and finally output the results to a file.
The retrieval portion of the design first copies all the data from the file and save it. This is to avoid any problems with the file closing unexpectedly. With all the information stored the next step is to take that information and put it into meaningful structures. The program parses though the data and fill each structure with the appropriate values in the correct places. The order of the data is impotent to where everything goes in the structure. After the structures are filled the reduction isgin.
For this part a function fill a new data structure with the average values of the given data points. a series of loops achieve this easily. On top of this, some of the values needed are derivatives so in addition to finding the average values of the raw data this function find the average of the derivatives needed for calculations. All of these values is stored in a single structure for easy access later on in the program.
The next step is to compute the values needed by the client from the values collected. This is achieved through a series of functions that is specifically made to do these mathematical processes. The values is stored in the program as a structure at this point would be cumbersome. After all these values are found, with the relatively simple mathematical computation, the output is put to the user’s specified file. The format is used to make the output file look as much like the client’s simulator output file as possible. This allows for easy comparison.
5.2.2 Class Overview
Considering classes for this project there could reasonably be up to six classes. in deciding how many classes to use for this project consideration is given to complexity of the program, complexity of each class, and how much simpler a class made the building process of program. As for the classes, the ones considered potentially reasonable are a main class to call the GUI, a class counting the GUI, a class for the function calls, and a class for each of the three data structure.
The project is not considering other classes because there is no need. Every possible class cannot be discussed because there is an infinite amount of classes that could apply; granted most would do little or nothing to contribute to the project. So the six classes mentioned above are considered the most that are needed without needlessly making wasted classes.
The classes that were picked were picked to be discussed were picked because the class has potential to contribute to the program. The main class and the GUI program is automatically generated when a form is created. The functions class would make it easier to swap out functions if desired in the future. And each of the data structures could be classes to make computation easier.
5.2.3 Function Overview
There are a total of five different types of functions that is used in this program. Four have been mentioned already, the loading, computing, finding, and saving. The fifth type is the GUI functions. These are things that happen when you click buttons.
Starting with the GUI functions there is three of them. One for each browse button and one for the compute button. The compute button is going to start the main part of the program. There is two loading function. The first opens the file and load the raw data. The second takes the raw data and parse it. There is one computing function. it takes all the parsed data and average it into the one values data structure. This function is longer than it sounds. There is many finding functions, one for each value that needs to be found. Each one takes different values to find different things. The last function is the saving function. It prints the parsed and found data onto a file for the user to compare.
5.2.4 Data Structure Overview
There could reasonable be up to four data structures. In determining if a structure should be include this project has chosen to focus on if and how a structure help simplify the program, and how easy it would be to add or remove data structures if the client chooses to change the program in the future. The four structures in question is a load structure, a parse structure, a values structure, and a results structure.
5.2.5 Program Structure Overview
The program is structured in a way that allows for easy manipulation and reading. Comments is spread throughout the program. There is 3 data structures one for the file input to be saved and one for the variables in the file. The third data structure is used for the average values and derivatives found. there in the main part of the program there is a series of function calls. Each call does one specific calculation and return the answer to a variable stored in the main part of the program. After all the functions are called the program creates a file that the client can then use to compare with the simulator.
For reading the file first the client has to enter or browse for the file. This is done with as simple GUI consisting of a place for a source file, destination file, and a create button. When both the source and destination files are selected the user then clicks the create button and the program runs.
The first thing the program does is check to see if the files exist. if the source file doesn’t exist it informs the user. If the destination file does exist it asks the user if he/she wants to overwrite the file. From here the source file is opened. Once open the program copies the content of the file into the first data structure. The information is to be copied so that the file can be closed as soon as possible. The slowest part of this program is likely to be this part because it is being designed to come off an external storage device. Getting the information off all at once helps to avoid accidental removal of the source file half way through the program. After the file is read and all the content copied the file is closed.
Next the program checks that the information is in the correct format. Because of the method of storage the file has to be predictable with packet stamps and a set number of data points for each one. If the file is not in the correct format it informs the user. This could happen if there was corruption of the file for some reason. It is an important step because the program gives the wrong answer is not checked.
After the file is checked the program takes the information from the file and parse out the different variables. Each variable has a value in the second data structure. This data structure has to be a vector or linked list to hold all the information in a meaningful way. Once the information is parsed and in the second data structure the first structure is freed from memory.
The second data structure is used to find the average values of each value. This average value is needed to do the calculations. The structure is put through loops to average the values. These new values is stored the third structure. After these main averages are found the program needs to find the derivatives of some of the values. These values are also calculated and stored in the third structure. After all these values are found the second structure is freed form memory.
From here there is a series of function calls made to calculate the rest of the values. Each function call saves its calculated number in a regular variable. these variables are not being put in any structure so that is more calculations are added in the future the new programmer just needs to make the function and set a variable to it. The future programmer can avoid trying to find and change the structure.
Finally the destination file is opened and the desired information is save on the file. There is a conformation telling the user that the file was created. Once done the program frees the third data structure and wait for the user to start the process over again.
It turns out we needed two pieces of software. The second one was created in order to find the moment of inertia (I) of the plane. To do this we measured out where the force sensors were relative to the center of gravity and the angle at which they were facing. Form there we used simple torque equations solved for I and then used that content in the final software.
Share with your friends: |