public void PrintResults()
 {
     controller.PrintToOutputPane(OutputTag.TAG_RESULTS, "PDR: " + CalculatePacketDeliveryRatio());
     controller.PrintToOutputPane(OutputTag.TAG_RESULTS, "AEED: " + CalculateAverageEndToEndDelay());
     controller.PrintToOutputPane(OutputTag.TAG_RESULTS, "NRO: " + CalculateNormalizedRoutingOverhead());
     controller.PrintToOutputPane(OutputTag.TAG_RESULTS, "BDD: " + CalculateBatteryDepletionDeviation());
 }
Esempio n. 2
0
        public void Print()
        {
            ComponentController outputPaneController = new ComponentController();

            outputPaneController.PrintToOutputPane("Message", "Message from Node " + sourceNode.GetNodeID() + " to Node " + destinationNode.GetNodeID() + ".");
        }
        public SessionData RunSimulation(int delay, int tabIndex)
        {
            SessionData sessionData = new SessionData(tabIndex);

            sessionData.SetStartingBatteryLevels(mobileNodes);              // Save starting battery levels
            sessionData.SetNumberOfAttemptedTransmissions(messages.Count);  // Save number of attempted transmissions

            string tag = "";

            if (tabIndex == PROTOCOL_INDEX_DSR)
            {
                tag = OutputTag.TAG_DSR;
            }
            else if (tabIndex == PROTOCOL_INDEX_SADSR)
            {
                tag = OutputTag.TAG_SADSR;
            }
            else if (tabIndex == PROTOCOL_INDEX_MSADSR)
            {
                tag = OutputTag.TAG_MSADSR;
            }

            /* Send all messages */
            foreach (Message message in messages)
            {
                controller.PrintToOutputPane(OutputTag.TAG_NOTE, "Message: " + message.GetMessageID());
                if (tabIndex == PROTOCOL_INDEX_DSR)
                {
                    controller.PrintToOutputPane(OutputTag.TAG_DSR, "Running DSR Simulation.");
                    SendMessageDSR(message, sessionData, delay);
                }
                else if (tabIndex == PROTOCOL_INDEX_SADSR)
                {
                    controller.PrintToOutputPane(OutputTag.TAG_SADSR, "Running SA-DSR Simulation.");
                    SendMessageSADSR(message, sessionData, delay);
                }
                else if (tabIndex == PROTOCOL_INDEX_MSADSR)
                {
                    controller.PrintToOutputPane(OutputTag.TAG_MSADSR, "Running MSA-DSR Simulation.");
                    SendMessageMSADSR(message, sessionData, delay);
                }
            }

            sessionData.SetEndingBatteryLevels(mobileNodes); // Save ending battery levels
            sessionData.PrintResults();                      // Print collected metrics
            sessions.Add(sessionData);                       // Add collected data to recorded sessions
            controller.PrintToOutputPane(tag, sessionData.GetNumberOfAttemptedTransmissions() + " attempted transmissions.");
            controller.PrintToOutputPane(tag, sessionData.GetNumberOfSuccessfulTranmissions() + " successful transmissions.");
            controller.PrintToOutputPane(tag, "Finished Transmitting Messages.");
            controller.MarkTransferAsComplete(tabIndex);

            return(sessionData);
        }
 public void Print()
 {
     controller.PrintToOutputPane("Note", "Node #" + nodeID + " - Battery Level: " + BatteryLevel +
                                  " - Location: " + CenterX + "," + CenterY);
 }