Note: This tutorial assumes you already cloned the
git repositories for running Example 1.
Step 0. Building Plexe with sample changes
To switch to the code for this example and build the source, simply do the following:
cd ~/src/plexe-veins git checkout plexe-2.0 ./configure make -j <number of cores of your PC> MODE=release cd ~/src/plexe-sumo git checkout plexe-2.0 make -j <number of cores of your PC>
The fourth example shows the new detailed engine model in action. In this example we perform a "race" between three different vehicles, which are an Alfa Romeo 147 1.6 TS, an Audi R8, and a Bugatti Veyron. The three vehicles start from standstill, and we let them accelerate as much as they can for roughly one minute. After that, we let them brake as strong as they can down to a full stop. The example can be found in the
examples/engine folder. In particular, you will find the parameters of the vehicles in the
examples/engine/sumocfg/vehicles.xml file. For the details about the parameters and the configuration, please refer to the complete documentation.
To run the example do the following:
cd ~/src/plexe-veins/examples/engine ./run -u Cmdenv -c EngineTestNoGui -r 0 ./run -u Cmdenv -c EngineTestNoGui -r 1 ./run -u Cmdenv -c EngineTestNoGui -r 2
Given that there is no ongoing communication, these simulations will terminate very quickly. Even if you already know the results of the race, we can plot the results to see the outcome.
As for the first example, move into the
analysis folder, generate the
Makefile, and run the R script
cd analysis ./genmakefile.py parse-config > Makefile make Rscript plot-engine.R
The script generates the following plots, i.e., the acceleration and the speed of the two vehicles as a function of time. The acceleration plot shows first of all the different acceleration capabilities of the three vehicles. Most importantly, however, it shows you that the maximum available acceleration decreases with speed and with the chosen gear ratio. Moreover, the acceleration plot shows you also the different braking capabilities of the vehicles, with a maximum deceleration which is speed-dependent due to air-drag, i.e., at a high speed a vehicle can brake harder thanks to air resistance.
Concerning speeds, instead, we can see that the maximum speed is properly modeled by considering engine and aerodynamic characteristics: The Alfa Romeo reaches about 190 km/h, the Audi roughly 300 km/h, while the Bugatti reaches the stunning speed of 400 km/h.
To graphically see the behavior of the car while developing the engine model, I developed a small dashboard, which gives you a "driver viewpoint". Basically the simulation connects to the dashboard and passes data to it, showing you engine RPM, speed, engaged gear, and current acceleration. Given that it is somehow fun, I decided to release it together with the source code. To run the simulation with the dashboard you need to perform some preliminary steps:
cd ~/src/plexe-sumo/sumo export CXXFLAGS="$CXXFLAGS -DEE=1" ./configure make clean make -j <number of cores of your PC>
This enables the Easter Egg in the source code. Then start the dashboard by typing
cd ~/src/plexe-sumo/sumo/src/plexe-tools/.ee python dashboard.py
This will start up the dashboard (requires QT for Python) which should look like this
Now to see the dashboard in action, we run the Bugatti Veyron simulation (of course)
cd ~/src/plexe-veins/examples/engine ./run -u Cmdenv -c EngineTest -r 2
Before running the simulation, set the SUMO delay to 10 milliseconds, then click on play. At 1 second, the car will appear at the beginning of the highway. If you want to follow it, click on
Locate -> Locate vehicles. Now click on
vtypeauto.0 and then on
Center. This will center the view on the car and automatically start tracking. At 5 seconds the car starts to accelerate. If you look at the dashboard you should now see current engine RPM, speed, acceleration, and engaged gear. By comparing it with the following video, it doesn't look much different :)