There are too many steps to introduce the simulation of leaching on the Internet, and there are also a lot of contrast between the node death trend chart of leaching and LEACH-C! Apply the protocol of the leaching protocol to the NS2. 27 simulation came out, do not know how to do LEACH-C simulation, but after a day's efforts, it seems that only use the simulation of the two script files to make the corresponding modifications. Because the files implemented by the LEACH-C function already exist under MIT! Next we will briefly introduce the modification process of the two script files! First. test file open, (Path: C:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27 test file leach_test and leach-c_test are put under this path) add in the last line. /leach-c_test. ....... Cd ../../ ./Leach_test /Leach-c_test Here I used the LEACH-C_TEST, next I want to write the leach-c_test file, I COPY its own leach_test file, and then modify it based on. Open the file and modify it as follows: The first line of this file is changed to alg = leaching-c, which seems to be changed! Then enter the path ns-allinone-2.27/ns-2.27 in startxwin. bat because the environment variables and MAKEFILE files have been configured in the leaching simulation path! So no configuration is required here! OK, directly perform./test. Then wait until the simulation is complete (wait 500 seconds), observe the leach-c.alive file size does not change. We can compare the simulation of leaching. alive and leach-c.alive! Extract data Graph Cd mit/leach_sims go to the mit/leach_sims directory Gawk-f test. awk leaching. alive> the data of leaching. gnuplot is stored in leaching. gnuplot. Gawk-f test. awk leach-c.alive> data of leachc. gnuplot leaching-c is put in leachc. gnuplot Gnuplot carriage return After gnuplot>, enter the command maid, and press ENTER Draw multiple curves on a graph separated by commas (,). The following figure shows the simulated comparison: Figure is out, but as if with the online simulation of the figure is not very similar, LEACH-C in 70 seconds began to have nodes died! It seems abnormal! However, no reason is found! If a friend who has learned NS2! Thank you! |