public void RunDemo(int tabIndex) { SimulationEnvironment sim = new SimulationEnvironment(); // Add Test Nodes sim.AddNode(new MobileNode(100, 100, 20)); sim.AddNode(new MobileNode(200, 210, 20)); sim.AddNode(new MobileNode(210, 200, 100)); sim.AddNode(new MobileNode(298, 298, 100)); // Add Test Message sim.AddMessage(new Message(sim.GetNodes()[0], sim.GetNodes()[3])); // Print Simulation Nodes new OutputPaneController().PrintToOutputPane("Note", "Simulation Nodes:"); foreach (MobileNode node in sim.GetNodes()) { node.Print(); node.PrintNodesWithinRange(sim); } // Testing DSR /*new OutputPaneController().PopulateNodesDSR(sim.GetNodes(), tabIndex); * sim.SendMessageDSR(sim.GetMessages()[0]);*/ // Testing SADSR /*new OutputPaneController().PopulateNodesSADSR(sim.GetNodes(), tabIndex); * sim.SendMessageSADSR(sim.GetMessages()[0]);*/ // Testing modified SADSR new OutputPaneController().PopulateNodesMSADSR(sim.GetNodes(), tabIndex); sim.SendMessageMSADSR(sim.GetMessages()[0]); }
public void RunTest( int nodeNumber, int messageNumber, int simSpeedNumber, int tabIndex) { SimulationEnvironment sim = new SimulationEnvironment(); sim.GenerateRandomNodes(nodeNumber); sim.GenerateRandomMessages(messageNumber); new OutputPaneController().PopulateNodesDSR(sim.GetNodes(), tabIndex); sim.RunSimulation(); }
public List <GraphData> RunTest( int nodeNumber, int messageNumber, int simSpeedNumber, int tabIndex, int nodeRange, int pureSelfishNodeNumber, int partialSelfishNodeNumber, int executionNumber) { if (executionNumber > 1) { List <GraphData> graphDataList; List <List <SessionData> > sessionDataList = new List <List <SessionData> >(); int currentTabIndex = tabIndex; for (int currentExecutionNumber = 0; currentExecutionNumber < executionNumber; currentExecutionNumber++) { List <SessionData> currentExecutionSessionDataList = new List <SessionData>(); List <bool> tabIndexesDone = new List <bool> { false, false, false }; bool isAllTabsDone = false; simulationEnvironment.GenerateRandomNodes(nodeNumber, nodeRange, pureSelfishNodeNumber, partialSelfishNodeNumber); simulationEnvironment.GenerateRandomMessages(messageNumber); while (!isAllTabsDone) { if (tabIndexesDone.Any(x => x == false)) { Hub.Clients.All.resetCanvas(currentTabIndex); controller.PopulateNodesOnCanvas(simulationEnvironment.GetNodes(), currentTabIndex); var sessionData = simulationEnvironment.RunSimulation(simSpeedNumber, currentTabIndex); currentExecutionSessionDataList.Add(sessionData); tabIndexesDone[currentTabIndex] = true; if (tabIndexesDone.Any(x => x == false)) { currentTabIndex = tabIndexesDone.FindIndex(x => x == false); } } else { isAllTabsDone = true; } } sessionDataList.Add(currentExecutionSessionDataList); } graphDataList = SessionDataListToGraphDataList(sessionDataList, executionNumber); return(graphDataList); } else { simulationEnvironment.GenerateRandomNodes(nodeNumber, nodeRange, pureSelfishNodeNumber, partialSelfishNodeNumber); // Generate Random Nodes //<remove once lock fixed simulationEnvironment.GenerateRandomMessages(messageNumber); // Generate Random Messages //<remove once lock fixed controller.PopulateNodesOnCanvas(simulationEnvironment.GetNodes(), tabIndex); // Populate Nodes on Canvas //<remove once lock fixed simulationEnvironment.RunSimulation(simSpeedNumber, tabIndex); // Run Simulation on Environment return(new List <GraphData>()); } }