This folder contains the ALTERNATE BIT PROTOCOL DEVS model implemented in CDBoost

/**************************/
/****FILES ORGANIZATION****/
/**************************/

README.txt	

alternatebitprotocol.doc

alternatebitprotocol_CDBoost_implementation.pdf

atomics [This folder contains atomic models implemented in CDBoost]
	filterPort.hpp
	portConversor.hpp
	receiverCDBoost.hpp
	senderCDBoost.hpp
	subnetCDBoost.hpp

data_structures [This folder contains message data structure used in the model]
	message.hpp
	message.cpp

test [This folder the unit test of the atomic models]
	filterPort [This folder contains the unit test of the filterPort atomic model]
		main.cpp
		makefile
		filterPort_input_test.txt
		filterPort_test_output.txt
	portConversor [This folder contains the unit test of the portConversor atomic model]
		main.cpp
		makefile
		portConversor_input_test.txt
		portConversor_test_output.txt
	receiverCDBoost [This folder contains the unit test of the receiverCDBoost atomic model]
		main.cpp
		makefile
		receiver_input_test.txt
		receiver_test_output.txt
	senderCDBoost [This folder contains the unit test of the senderCDBoost atomic model]
		main.cpp
		makefile
		sender_input_test.txt
		sender_test_output.txt
	subnetCDBoost [This folder contains the unit test of the subnetCDBoost atomic model]
		main.cpp
		makefile
		subnet_input_test.txt
		subnet_test_output.txt

vendor [This folder contains the time class and the model to generate the inputs to the DEVS model]
	input_event_stream.hpp
	britime.hpp

top_model [This folder contains the Alternate Bit Protocol top model]	
	main.cpp
	makefile
	input_abp_0.txt
	input_abp_1.txt
	abp_output_0.txt
	abp_output.txt
	
/*************/
/****STEPS****/
/*************/

0 - alternatebitprotocol.doc contains the explanation of this model

1 - Update include paths in all the makefiles in this folder and subfolders. You need to update the following lines:
	#INCLUDEBOOST=-I ../../../../boost_1_61_0
	INCLUDEBCDPP=-I ../../../../cdboost/include
    Update the relative path to cdboost/include from the folder where the makefile is. You need to take into account where you copied the folder during the installation process
	Example: INCLUDEBCDPP=-I ../../../../cdboost/include
    If you installed Boost using option 2, uncomment INCLUDEBOOST and update the relative path to Boost from the folder where the makefile is
	Example: INCLUDEBOOST=-I ../../../../boost_1_58_0
* ../ means going up a level in the directory tree.

2 - Run the unit tests
	2.1. Run filterPort test
		1 - Open the terminal. Press in your keyboard Ctrl+Alt+t
		2 - Set the command prompt in the filterPort folder. To do so, type in the terminal the path to this folder.
			Example: cd Documents/CDBoost_example_installation_templates/AlternateBitProtocol/test/filterPort
		3 - To compile the test, type in the terminal:
			make clean; make all
		4 - To run the test, type in the terminal "./NAME_OF_THE_COMPILED_FILE NAME_OF_THE_INPUT_FILE". For this specific test you need to type:
			./FILTERPORT filterPort_input_test.txt
		5 - To check the output of the test, open  "filterPort_test_output.txt"
	2.2. Run portConversor test
		1 - Open the terminal. Press in your keyboard Ctrl+Alt+t
		2 - Set the command prompt in the portConversor folder. To do so, type in the terminal the path to this folder.
			Example: cd ../portConversor
		3 - To compile the test, type in the terminal:
			make clean; make all
		4 - To run the test, type in the terminal "./NAME_OF_THE_COMPILED_FILE NAME_OF_THE_INPUT_FILE". For this specific test you need to type:
			./PORTCONVERSOR portConversor_input_test.txt
		5 - To check the output of the test, open  "portConversor_test_output.txt"
	2.3. To run receiverCDBoost, senderCDBoost and subnetCDBoost tests, the steps are analogous to 2.1 and 2.2
			
3 - Run the top model
	1 - Open the terminal. Press in your keyboard Ctrl+Alt+t
	2 - Set the command prompt in the top_model folder. To do so, type in the terminal the path to this folder.
		Example: cd ../../top_model
	3 - To compile the model, type in the terminal:
		make clean; make all
	4 - To run the model, type in the terminal "./NAME_OF_THE_COMPILED_FILE NAME_OF_THE_INPUT_FILE". For this test you need to type:
		./ABP input_abp_1.txt
	5 - To check the output of the model, open  "abp_output.txt"
	6 - To run the model with different inputs
		6.1. Create new .txt files with the same structure as input_abp_0.txt or input_abp_1.txt
		6.2. Run the model using the instructions in step 4
		6.3. If you want to keep the output, rename abp_output.txt. To do so, type in the terminal: "mv abp_output.txt NEW_NAME"
			Example: mv abp_output.txt abp_output_0.txt
