diff --git a/README.md b/README.md index 6020969..59559ab 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,36 @@ ### From the command line -TODO +Before using the simulator from the commandline, first `build` the project from the Unity editor. Select appropriate settings for your platform and ensure the Sample scene is the default scene. + +Then, to run the simulation: + +```bash +.\Traffic.exe.lnk -i {inputFilePath} -o {outputFilePath} -green {greenTime(x)} -red {redTime(x)} -f {frequency} -t {time} -batchmode -nographics +``` + +### Explaination of command line arguments + +The `-batchmode` and `-nographics` options are used to run the simulation without rendering all the graphics to improve performance. +This allows you to run one simulation for every thread your machine has to offer. + +The input file path passed by `-i` should point to a file that was exported using the graphical editor and contains a road network. + +The output file path passed by `-o` is where the resulting data will be stored. This will be a JSON-file of the format: + +```json +{ "travelTimes": [0.0, 1.0, <...>] } +``` + +The travel times are given in seconds. Should a car fail to spawn begcause its spot is already taken, a value of `0` will be added to the travel times. + +The green and red times passed using `-green` and `-red` respectively will specify the behaviour of traffic lights. + +A traffic light will be on for `-green` seconds when its phase starts. After the phase has elapsed, all traffic lights will be red for `-red` seconds and after this, the nex phase will commencec + +Cars are spawned at roughly `-f` Hz at every spawn node. This frequency is subject to random variance by +- 10% to ensure some noise in the data. + +The simulation is run for `-t` seconds. After this, the output file will be written and the programm is ended automatically. ## Screenshot