To allow for quick and easy CSV graphing, this script csvPlot.py dynamically plots CSV data with both distance and throughput. The script takes one csv file with both vehicle and traffic data, then plots two lines showing vehicle position and the corresponding traffic value. Once the script has been run to generate the figure, the resulting figure can be copied out of the E-VM to the user's local PC using the linux SCP command.
The csvMerge and csvPlot scripts are designed to support plotting from any experiment. The specific log files you’ll need to merge will depend on your particular experiment configuration and the data you’re collecting.
This script is found in: /root/Profiles/PostProcessing/csvPlot.py
Minimal usage:
python3 csvPlot.py ./data.csv --y_axis "Bandwidth (MBits/sec)"
Other parameters:
--logfile: <logfile.csv> the log file in CSV format; this is required
--x_axis: [time] the label for the x axis of the graph; defaults to "time"
--y_axis: the label for the y axis of the graph; this is required
--graph_type: [scatter] the type of graph to be made; options are "scatter" or "line"; defaults to "scatter"
--y1_color: [b] the color for the first y axis; defaults to 'b'
--y2_color: [r] the color for the second y axis; defaults to 'r'
The csvPlot.py script dynamically generates two-line plots from your merged data. The first line uses a haversine function to calculate and display the distance between the base station and UE (shown in red by default). The second line plots your specified traffic metric, such as bandwidth or throughput (shown in blue by default). Both line colors can be customized using optional parameters.
For users who prefer MATLAB, we provide an equivalent script called plot_csv_data.m in the same PostProcessing directory (/root/Profiles/PostProcessing/), which can be invoked with similar parameters to generate the same visualizations.
e.g.
plot_csv_data('merged_data.csv', 'time', 'Bandwidth(MBits/sec)', 'scatter', 'b', 'r');
An example graph showing MGEN data and vs. distance from the eNB
Example:
Using the E2E1 experiment as an example, the following commands would create the plot shown:
#First convert the traffic log to csv
python3 log2csv.py <timestamp>_mgen_receiver.txt -m mgen -o mgen_receiver.csv
#next merge both traffic log and vehicle log
python3 csvMerge.py mgen_receiver.txt <timestamp>_vehicleOut.csv --output e2e1_merged.csv
#finally plot the data on the graph with the necessary labels
python3 csvPlot.py ./e2e1_merged.csv --y_axis "Bandwidth (Mbits/sec)" --x_axis "distance from LW1" --graph_type scatter
#SCP the resulting graph to your local PC
scp root@<ip-remote-host>:<path-to-graph>/e2e1_merged.png ~/Downloads/