In this guide I will show you how to import and visualize a CSV Excel table using "Microsoft Windows Studio Express 2013 for Windows Desktop". The application is very simple and it has been created using Windows Forms Application. Source code can be downloaded here: datalogger_20160623.
I created this application since I had CSV file, which contains the data logged on my motorcycle, and I wanted to import the data and visualize it. If I used Excel, I would have to create a new graph for each signal, and then select the time range. This requires a lot of time, and in case I change the file, I need to start from the beginning. On opposite, this program is very easy to use. You just need to select the file path, click on "Import", select the time range that you want to visualize. All 3 graphs will have the same time range. Then, you can select which data you want to visualize into each graph.
The CSV file contains the following columns (starting from "zero" index):
- Engine speed (rpm)
- Injection time (us)
- Throttle position (%)
- Vehicle speed (km/h)
- Yaw angle (degrees)
- Pitch angle (degrees)
- Roll angle (degrees)
- iTOW (s), GPS time of week
- Latitude (degrees)
- Longitude (degrees)
- Height (degrees)
- Type of data, reserved
When the program runs, the window above is shown. At first, you need to select the file path (example: c:\test.csv) and click on "Import". After that, the screen will look as following.
As visible in the above screen, the CSV file raw data is shown on the left side. When the data is read from the CSV file, it is stored in a "DataTable" variable. After that, it is shown on the left side using a "DataGridView" block. As default settings, the 3 graphs show: Speed, Yaw, Pitch angle. It is possible to change the graph time in real time by clicking on the numeric up/down icons. Also, the graph time range can be modified, in real time, by changing the "iTOW Start" and "iTOW End" time values. The application automatically searches which is the CSV file row corresponding to "iTOW Start" and "iTOW End", and plot the graph using the data in this row range.
For example, suppose that I want to visualize the following Google Fusion Tables info. The iTOW time range is between "iTOW[s]: 434060" and "iTOW[s]: 434306".
By setting the iTOW range in the application, and changing graph type, the following screen is shown. The graphs visualized are: Motorcycle Speed [km/h], Pitch [deg], Engine Speed [rpm]. By having a look at the following graphs, we can conclude that:
- The speed reduces and I dat to stop, since the traffic light was red. However, I was behind some cars, so I moved through them until being in the front. Then, I moved again for some time and stop at the next traffic light.
- The pitch signal behaviour follows acceleration and deceleration of the vehicle. When the motorcycle accelerates, pitch angle becomes negative (motorcycle is leaning back). On opposite, when the motorcycle decelerates, the pitch angle becomes positive (motorcycle leaning front).
- Engine speed and vehicle speed are related by gear ratio. Since engine speed is calculated based on the time difference between two consecutive injections, the signal drops to zero when I close the throttle or I press the brake, due to the fact that the fuel injection stops, therefore rpm cannot be calculated during this period. As you can see below, this behaviour happens at each gear change, or when I press the brake.