Method Access Errors for WiFi Distance Experiment in ns-3 Simulation | error: ‘class ns3::TimeMinMaxAvgTotalCalculator’ has no member named ‘getMean’

12 views
Skip to first unread message

Linux Chima

unread,
Jul 26, 2024, 8:42:59 AM (yesterday) Jul 26
to ns-3-users
Hello Everyone. 

Thank you again for all the supports you have continued to provide here.

I am facing an issue with method access errors for WiFi distance experiment in ns-3 Simulation. Please find the details below and also my attached code.

   (A.)  Objectives

  1. Implement a WiFi Distance Experiment: My aim is to simulate WiFi communication between two nodes at varying distances and bitrates to measure key performance metrics such as throughput, delay, and packet loss ratio (PLR).
  2. Data Collection and Analysis: Collect and analyze data on the average delay, throughput, and PLR to understand the impact of distance and bitrate on WiFi performance.

   (B.)  Key Performance Metrics

  • Throughput: Measure the average data transfer rate in Kbps.
  • Delay: Measure the average delay experienced by packets.
  • Packet Loss Ratio (PLR): Measure the ratio of lost packets to sent packets.

   (C.)  Background

The experiment is part of an assignment based on the existing “wifi-example-sim.cc” in ns-3.38.

Release used: ns-3.38. Files co hosted in the same scratch folder:

- wifi-example-apps.h

- wifi-example-apps.cc

- CMakeLists.txt

- scratch-simulator.cc

   (D.)  Steps Taken

  1. I attempted to use GetMean, GetSum, and GetCount methods based on the assumption they existed in the TimeMinMaxAvgTotalCalculator class.
  2. I explored various alternative methods like GetMeanDelay, GetMeanTime, and ToDouble conversions.
  3. Adjusted how callbacks were used to collect delay statistics and how the TimeMinMaxAvgTotalCalculator object was used within the simulation and main functions.
  4. Reviewed official ns-3 documentation to find suitable methods for computing average delay (please forgive me if I missed out the relevant section of the documentation).

   (E.)  Issues Encountered

Class Method Errors: I encountered multiple errors related to the use of TimeMinMaxAvgTotalCalculator class methods.

    • Errors such as ‘class ns3::TimeMinMaxAvgTotalCalculator’ has no member named ‘GetMean’.
    • Errors related to using GetCount and GetSum methods which don't exist in this class.

    (F.)  My Current Understanding

It appears that the TimeMinMaxAvgTotalCalculator class does not have methods like GetMean, GetSum, or GetCount. It only provides specific statistical methods, which are:

  • GetMin
  • GetMax
  • GetMean

Given this, it appears that the correct approach to calculate the average delay is to use the GetMean method correctly, by ensuring that the TimeMinMaxAvgTotalCalculator is being used properly within the simulation.

However, I have attempted to use the GetMean approach, but yet getting the errors (see the example below) . 

    (G.) Support Required

Please is there anyone who can help:

1.     To guide me on how to calculate the average delay for for WiFi Distance Experiment in ns-3 Simulation

2.     To guide me on how to ensure that the TimeMinMaxAvgTotalCalculator is being used properly within the simulation.

3.     To provide me any alternative approach to meet the same requirement.

    (H.) Outcome of the Steps I have Taken:

error: ‘class ns3::TimeMinMaxAvgTotalCalculator’ has no member named ‘xxxx’

Example:

------------------------------------------------------------------------------------------------

~/ns-allinone-3.38/ns-3.38$ ./ns3 build

Scanning dependencies of target scratch_wifi-example-sim

[  0%] Building CXX object scratch/CMakeFiles/scratch_wifi-example-sim.dir/wifi-example-sim.cc.o

ns-allinone-3.38/ns-3.38/scratch/wifi-example-sim.cc: In function ‘void RunSimulation(double, std::string, ns3::Ptr<ns3::CounterCalculator<unsigned int> >, ns3::Ptr<ns3::TimeMinMaxAvgTotalCalculator>, ns3::Ptr<ns3::CounterCalculator<unsigned int> >)’:

ns-allinone-3.38/ns-3.38/scratch/wifi-example-sim.cc:186:38: error: ‘class ns3::TimeMinMaxAvgTotalCalculator’ has no member named ‘getMean’

  186 |     double averageDelay = delayStat->getMean().ToDouble(Time::S);  // Corrected method

      |                                      ^~~~~~~

/ns-allinone-3.38/ns-3.38/scratch/wifi-example-sim.cc: In function ‘int main(int, char**)’:

/ns-allinone-3.38/ns-3.38/scratch/wifi-example-sim.cc:252:46: error: ‘class ns3::TimeMinMaxAvgTotalCalculator’ has no member named ‘getMean’

  252 |             double averageDelay = delayStat->getMean().ToDouble(Time::S);  // Corrected method

      |                                              ^~~~~~~

make[2]: *** [scratch/CMakeFiles/scratch_wifi-example-sim.dir/build.make:65: scratch/CMakeFiles/scratch_wifi-example-sim.dir/wifi-example-sim.cc.o] Error 1

make[1]: *** [CMakeFiles/Makefile2:18079: scratch/CMakeFiles/scratch_wifi-example-sim.dir/all] Error 2

make: *** [Makefile:141: all] Error 2

Finished executing the following commands:

cd cmake-cache; /usr/bin/cmake --build . -j 3 ; cd ..

~/ns-allinone-3.38/ns-3.38$

-------------------------------------------------------------------------------------------------------

Thank you for your help,
Linux
WiFi Distance Experiment based on - wifi-example-sim.cc.docx

Tommaso Pecorella

unread,
Jul 26, 2024, 9:46:46 AM (yesterday) Jul 26
to ns-3-users
Hi,


My best suggestion is to study the manual and understand the example before modifying it.
As a matter of fact, the TimeMinMaxAvgTotalCalculator doesn't have any function to probe its data (i.e., no GetMean or alike), because its goal is to output the collected data to an Aggregator class, which will dump them to something else (like a file or a database).

As a matter of fact, the example shows you exactly that - and you can use its outputs to get the values you need.
Reply all
Reply to author
Forward
0 new messages