Visualization - SUMO Documentation

.pdf

School

Kennesaw State University *

*We aren’t endorsed by this school

Course

6201

Subject

Computer Science

Date

Apr 3, 2024

Type

pdf

Pages

20

Uploaded by Ayomyafo

Report
2/14/24, 12:38 AM Visualization - SUMO Documentation https://sumo.dlr.de/docs/Tools/Visualization.html##multiple_timelines_from_summary-output 1/20 visit eclipse.dev/sumo / Tools / Visualization Visualization sumo offers a wide range of outputs , but one may find it hard to parse and visualize them. Below, you may find some tools that allow to visualize a simulation run's results for being included in a scientific paper. Additional tools read plain .csv-files and were added to the suite as they offer a similar interface. All these tools are just wrappers around the wonderful matplotlib library. If you are familiar with Python, you must have a look. The tools share a set of common options to fine-tune the appearance of the generated figures. These options' names where chosen similar to the matplotlib calls. The tools are implemented in Python and need matplotlib to be installed. The tools can be found in <SUMO_HOME> /tools/visualization. Current Tools Below, you will find the descriptions of tools that should work with the current outputs sumo / sumo-gui generate. To run them, you'll need: to install Python to install matplotlib to set <SUMO_HOME> All scripts are executed from the command line and you have to give the command line options as listed in the descriptions below. Please note that #common options may be applied to all the scripts listed in the following sub-sections albeit few options may not work for certain scripts. plotXMLAttributes.py Create multiple 2D-plots of 2 arbitrary attributes from on or more xml files aggregated by an third attribute (i.e. detector-id). Example uses: The above example draws the paths of all vehicles through the network based on fcd-output. (It is a special case that can also be accomplished with plot_trajectories.py ) When option --show is set, a interactive plot is opened that allows identifying data points vehicles by clicking on the plot (dataID is printed on the console). Option --filter-ids ID1,ID2,... allows restricting the plot to the given data element ids. You can use a wildcard to filter out ids that follow some pattern; for instance --filter-ids bus_ * will filter out all ids that begin with the four characters "bus_". Further examples are shown below. Some of them are generated with the scenario acosta, one of the published sumo scenarios ( https://github.com/DLR-TS/sumo-scenarios/tree/main/bologna/acosta ). Plot Styles The script supports the following distinct styles of plots: lineplot : default scatterplot: with option --scatterplot box plot: by setting one of --xattr @BOX or --yattr @BOX bar plot: by setting either --barplot or --hbarplot Special Attributes The following attribute values have a special meaning. Instead of using an attribute from the input file they derive a value based on the other attribute. (i.e. the special attribute is set for --xattr then the other value is given by the --yattr ). python tools/visualization/plotXMLAttributes.py -x x -y y -s fcd.xml python tools/visualization/plotXMLAttributes.py -x x -y y -s fcd.xml fcd2.xml Copy
2/14/24, 12:38 AM Visualization - SUMO Documentation https://sumo.dlr.de/docs/Tools/Visualization.html##multiple_timelines_from_summary-output 2/20 @INDEX : the index of the other value within the input file is used. @RANK : the index of the other value within the sorted (descending) list of values is used @COUNT : the number of occurences of the other value is used. Together with option --barplot or -hbarplot this gives a histogram. Binning size can be set via options --xbin and --ybin . @BOX : one or more box plots of the other value are drawn. The --idattr is used for grouping and there will be one box plot per id @NONE : can be used with option --idattr to explicitly avoid grouping Multi-line plots By default, every distinct ID (as defined by --idattr ) will generated a new line for all the data points associated with that ID. If multiple files are given, the abbreviated filename will become part of the data point ID and thereby create distinct lines or scatterpoints for data from each file If a comma-separated list of values is passed to option --idattr , then values for each of the attributes will be combined with | to form the data point ID If a comma-separated list of values given to --xattr or --yattr (or both), and the data does not supply an ID (or option --idattr @NONE is set) then each combination of individual xattr and yattr will create a new line If a combined plot is needed that cannot be created with any of the above methods (i.e. because the data comes from different kinds of data files such as summary-output and edgeData) then an alternative is to use option --csv-output and plotting the resulting data with another tool (i.e. gnu - plot ). In csv-output each group of data points belonging to the same ID will form it's own block separated by two blank lines from the next block. To repli- cate a plot where each ID/block has its distinct color, the following approach can be used in gnuplot: Inductionloop Speed over Time Input is inductionloop-output with 30s aggregation from 2 detectors ( <e1Detector id="e1Detector_-109_0_0" lane="-109_0" pos="54.06" period="30.00" file="data.xml"/> Call: python tools/visualization/plotXMLAttributes.py data.xml -x begin -y speed -s Lane Area Detectors over nVehEntered Input is laneareadetectors-output with 30s aggregation from 6 detectors Call: python tools/visualization/plotXMLAttributes.py -x begin -y maxOccupancy -o plot-maxOccupancy.png --legend e2_output.xml --filter- ids e2_0,e2_5,e2_10,e2_15,e2_20,e2_25 stats 'data.csv' plot for [idx= 0 :STATS_blocks] 'data.csv' i idx with lines Copy
2/14/24, 12:38 AM Visualization - SUMO Documentation https://sumo.dlr.de/docs/Tools/Visualization.html##multiple_timelines_from_summary-output 3/20 Multi-Entry-Exit Detectors Mean Speed over Time Input is multi-entry-exit-detector-output with 30s aggregation and a cutoff at begin and end Call: python tools/visualization/plotXMLAttributes.py -x begin -y meanSpeed detector.xml --legend --xlim 100,5000 boarding passengers vs delay for each station Input is stop-output Call: python tools/visualization/plotXMLAttributes.py stopinfos.xml -i busStop -x loadedPersons -y delay -s --scatterplot --legend Fundamental Diagram from edgeData Input is edgeData-output with 1-minute aggregation ( <edgeData id="example" file="data.xml" period="60"/> ) Call: python tools/visualization/plotXMLAttributes.py data.xml -i id -x density -y left -s --scatterplot --yfactor 60 --ylabel vehs/hour Each color gives encodes a different edge-id. Option --factor 60 is used to convert from vehicles per 60s (edgeData-period 60) to vehicles per hour. Multiple timelines from summary-output Input is summary . This plot demonstrates using a list of attributes to generate multiple data points from the same xml input element. In the absence of an id-attribute, the respective attribute name is used to "identify" and group the data points. Call: python tools/visualization/plotXMLAttributes.py summary.xml -x time -y running,halting -o plot-running.png --legend
2/14/24, 12:38 AM Visualization - SUMO Documentation https://sumo.dlr.de/docs/Tools/Visualization.html##multiple_timelines_from_summary-output 4/20 Caution In version 1.15.0 and lower, the id-attribute must be provided so you need to provide a dummy value (i.e. with -i collisions ) and only a single value is permitted for the x and y attribute. Depart delay over time from TripInfo data The plot is created out of TripInfo output data: Call python tools/visualization/plotXMLAttributes.py -i id -x depart -y departDelay --scatterplot --xlabel "depart time [s]" --ylabel "de- part delay [s]" --ylim 0,40 --xticks 0,1200,200,10 --yticks 0,40,5,10 --xgrid --ygrid --title "depart delay over depart time" --titlesize 16 tripInfo.xml Time to collision over simulation time The plot is created from the output file of a SUMO simulation for which a global SSM device has been added. For this example, starting from the Bologna "acosta" scenario , the SUMO configuration file had been modified in order to compute time to collision: After the simulation has finished to run, a XML file ssm.xml has been produced. Using this file we can extract and plot the TTC values by using the command line: <configuration xmlns:xsi = "https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "https://sumo.dlr.de/xsd/sumoConfiguration.xsd" > <device.ssm.deterministic value = "true" /> <device.ssm.file value = "ssm.xml" /> <device.ssm.measures value = "TTC" /> </configuration> Copy python .exe .\ plotXMLAttributes .py ssm .xml -x time --xlabel " Time [s]" -y value --ylabel " TTC [s]" -i ego --filter-ids bus_ * --title " time to collision Copy
2/14/24, 12:38 AM Visualization - SUMO Documentation https://sumo.dlr.de/docs/Tools/Visualization.html##multiple_timelines_from_summary-output 5/20 Queuing times over time Input is queue-output . Call to generate the plot: where -x is the attribute for the x axis; -y is the attribute for the y axis; -s is to show the plot; -o is the output file name; -i is the filtered attribute name (lane id in this case); --filter-ids are the value(s) of the filtered attribute name (id = 121_0 in this case). Departure times versus arrival times Input is vehroutes-output . Call to generate the plot: where -x is the attribute for the x axis; -y is the attribute for the y axis; -s is to show the plot; -o is the output file name; --scatterplot is to make a scat- ter plot instead of a line plot. python tools/visualization/plotXMLAttributes.py -x timestep -y queueing_time -s -o queue .png queue .xml -i id --filter-ids 121 _0 Copy python tools/visualization/plotXMLAttributes.py -x depart -y arrival -s -o vehroute.png vehroute.xml --scatterplot Copy
2/14/24, 12:38 AM Visualization - SUMO Documentation https://sumo.dlr.de/docs/Tools/Visualization.html##multiple_timelines_from_summary-output 6/20 Leader gaps versus speeds Input is langechange-output . Call to generate the plot: where -x is the attribute for the x axis; -y is the attribute for the y axis; -s is to show the plot; -o is the output file name; -i is the filtered attribute name (reason for lane changing in this case); --filter-ids are the values of the filtered attribute name (reason = speedGain in this case). All trajectories over time 1 Input is fcd_output . Call to generate the plot: where -x is the attribute for the x axis; -y is the attribute for the y axis; -s is to show the plot; -o is the output file name; --scatterplot is to make a scat- ter plot instead of a line plot.. Selected trajectories over time 1 Input is fcd_output . Call to generate the plot: where -x is the attribute for the x axis; -y is the attribute for the y axis; -s is to show the plot; -o is the output file name; -i is the filtered attribute name (vehicle id in this case); --filter-ids are the values of the filtered attribute name (vehicle id = Audinot_7_0 in this case); --scatterplot is to make a scatter plot instead of a line plot; --legend is to show the legend. python tools/visualization/plotXMLAttributes.py -x speed -y leaderGap -s -o lc.png langchange.xml -i reason --filter-ids speedGain Copy python tools/visualization/plotXMLAttributes.py -x x -y y -s -o allXY_output.png fcd.xml --scatterplot Copy python tools/visualization/plotXMLAttributes.py -x x -y y -s -o vehLocations_output.png fcd.xml -i id --filter-ids Audinot_7_0 --scatterplot --legend Copy
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help