
The program and scripts assume that the programme will be run in linux and that cdboost, boost_1_57_0 and g++4.9 are installed in the computer.

If g++4.9 is not installed, it can be installed using the following commands:

	sudo add-apt-repository ppa:ubuntu-toolchain-r/test
	sudo apt-get update
	sudo apt-get install g++-4.9

The scripts Assume that they will be run from the file they are placed.

1. Unzip CrossroadLights.zip 

2. Place the prompt in the directory where CrossroadLigths.zip has been extracted. Use the folling comand:

	cd path_to_the_directory_where_the_poject_was_unziped

3. Enter the following comand to allow the sripts running:
 
	 chmod 777 *crossroad*

4. Enter:

	./compile_crossroad

The model will be compiled. You will be asked to enter the path to cdboost/include and boost as in the example:

Path to boost: /home/username/boost_1_57_0
Path to cdboost/include: /home/username/cdboost/include

5. Run the predefined simulations. The output is store in the file output.txt.

To run Crossroad top model test 1, enter

	./crossroad_test1


To run Crossroad top model test 2, enter

	./crossroad_test2


To run Crossroad top model simulation 1, enter

	./crossroad_simulation1


6. To run any other simulation in Crossroad top model.

In this case, you have to define the input in a .txt file with the following structure and save it in the same file you unziped CrossroadLights.zip.

Each line represents an input message:

x 1  [y1,y2,...,yn] model_input t

where
x: integer number representing the time the messages arrives
y1,...,yn: are the ids of the models that recieves the input. The models can be: PB1, PB2, LL1, LL2, RL1, RL2. Do not let a space between the semicolon and the model id. Neither between the id and [].
t: is an integer number greater or equal to 1 representing the people or cars arriving. 

When finishing the file, you have to be sure that the cursor is in the last message line and not in a new one.

Enter:

	./crossroad_new_simulation

You will be ask to enter the following parametres.

entre cycle time of the controller
entre time in yellow for cars
entre time in yellow for pedestrians
entre the delay to green of the semaphore
entre the time a car takes to cross the crossroad
entre time untill you want to run the simulation
enter the name of the test file where the input is stored (ex:test_1.txt)

The output is store in the file output.txt.





