Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue with NetAnim for wave netDevices

57 views
Skip to first unread message

Negar Javadzadeh

unread,
Nov 16, 2024, 7:17:55 PM11/16/24
to ns-3-users
Hi every one, 
this is my network config, but I cant get xml file for NetAnim. 

std::string mobility_file = "scratch/metalearn_vanet_clustering_2023/ns3mobility.tcl";
 Ns2NodeUtility ns2_utility(mobility_file);

 double simulation_time = ns2_utility.GetSimulationTime();     // 150-1500 in seconds
 uint32_t vehicles_count = ns2_utility.GetNNodes();            // 25-200
 double transmission_range_OBU = 100.0;                        //100-300 m
  uint32_t interval = 1

NodeContainer vehicle_nodes;
vehicle_nodes.Create(vehicles_count);

Ns2MobilityHelper sumo_trace(mobility_file);
sumo_trace.Install(); 

YansWifiChannelHelper channel = YansWifiChannelHelper::Default();
Ptr<RangePropagationLossModel> rangeModel = CreateObject<RangePropagationLossModel> ();
rangeModel->SetAttribute ("MaxRange", DoubleValue (transmission_range));
Ptr<YansWifiChannel> waveChannel = channel.Create ()->GetObject<YansWifiChannel> ();
 waveChannel->SetPropagationLossModel (rangeModel);

YansWavePhyHelper wavePhy = YansWavePhyHelper::Default();
wavePhy.SetChannel(waveChannel);
wavePhy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
  
QosWaveMacHelper waveMac = QosWaveMacHelper::Default();
 WaveHelper waveHelper = WaveHelper::Default();

waveHelper.SetRemoteStationManager("ns3::ConstantRateWifiManager",
                                       "DataMode", StringValue("OfdmRate12MbpsBW10MHz"), 
                                       "ControlMode", StringValue("OfdmRate12MbpsBW10MHz"),
                                       "NonUnicastMode", StringValue("OfdmRate12MbpsBW10MHz"));

NetDeviceContainer devices = waveHelper.Install(wavePhy, waveMac, nodes);

/* installing application... */

Simulator::Stop(Seconds(simulation_time));

AnimationInterface anim ("metalearn.xml");

 Simulator::Run();

but When I run it with AnimationInterface  it returns : 

msg="Incompatible types. (feed to "c++filt -t" if needed)
got=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::Packet const>>
expected=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::Packet const>,double>", +0.000000000s -1
file=/home/negar/workspace/ns-allinone-3.38/ns-3.38/src/core/model/callback.h, line=629
msg="when connecting to /NodeList/0/DeviceList/0/$ns3::WaveNetDevice/PhyEntities/0/$ns3::WifiPhy/PhyTxBegin", +0.000000000s -1
file=/home/negar/workspace/ns-allinone-3.38/ns-3.38/src/core/model/traced-callback.h, line=155

My ns3 version is ns3.38 and netAnim is 3.109

Tommaso Pecorella

unread,
Nov 17, 2024, 5:35:01 AM11/17/24
to ns-3-users
It looks like you found a bug that was never fixed (also due to the Wave model removal).

You can try to fix it simply by adding a last parameter (double) to "AnimationInterface::WavePhyTxBeginTrace".
A similar issue might be in "AnimationInterface::WavePhyRxBeginTrace", you'll find out at the first run.

Note that the error message was pretty explicative:
- Incompatible types. (feed to "c++filt -t" if needed)
- got=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::Packet const>>
- expected=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::Packet const>,double>",


compare the parameters and you can easily see that the last double parameter is missing.


Negar Javadzadeh

unread,
Nov 17, 2024, 7:00:39 AM11/17/24
to ns-3-users
Thanks for your help. first I tried to add other callback for PhyTxBegin in my main class. like this:
void PhyTxBeginTracedCallback(const std::string& context, Ptr<const Packet> packet, double txPowerW)
{
    std::cout << "PhyTxBegin: Context=" << context << ", Packet=" << packet << ", Power=" << txPowerW << std::endl;
}
Config::Connect("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/PhyTxBegin",
                MakeCallback(&PhyTxBeginTracedCallback));

but it didnt work and the error was same:
msg="Incompatible types. (feed to "c++filt -t" if needed)
got=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::Packet const>, double>

expected=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::Packet const>,double>", +0.000000000s -1
file=/home/negar/workspace/ns-allinone-3.38/ns-3.38/src/core/model/callback.h, line=629
msg="when connecting to /NodeList/0/DeviceList/0/$ns3::WaveNetDevice/PhyEntities/0/$ns3::WifiPhy/PhyTxBegin", +0.000000000s -1
file=/home/negar/workspace/ns-allinone-3.38/ns-3.38/src/core/model/traced-callback.h, line=155

after reading your answer, I changed these callbacks in my src/netanim/model folder also WavePhyRxBeginTrace too.
but now I am faced with this error:
NS_ASSERT failed, cond="false", msg="WavePhyRxBeginTrace: unknown Uid", +177.000119082s 10 file=/home/negar/workspace/ns-allinone-3.38/ns-3.38/src/netanim/model/animation-interface.cc, line=1114
NS_FATAL, terminating

I generate my packets in this way:
TxInfo tx;
tx.channelNumber = CCH;
 tx.dataRate = m_mode;

 Ptr<Packet> packet = Create<Packet>(m_packetSize);

CustomDataTag tag;
tag.SetNodeId(GetNode()->GetId());
tag.SetPosition(GetNode()->GetObject<MobilityModel>()->GetPosition());
tag.SetClusterId(m_clusterId);
packet->AddPacketTag(tag);

 /* Broadcast the packet as WSMP (0x88dc) */
m_waveDevice->SendX(packet, Mac48Address::GetBroadcast(), 0x88dc, tx);

Tommaso Pecorella

unread,
Nov 17, 2024, 8:52:12 AM11/17/24
to ns-3-users
The error indicates that the packet was received before being transmitted, i.e., that the "AnimationInterface::WavePhyTxBeginTrace" function wasn't correctly called.

Alternatively, the packet was heavily modified (loosing its tags) between the transition and reception.

Honestly, I fear that the NetAnim and WAVE compatibility was seriously broken. The best suggestion I can give is... do you really need NetAnim?

Negar Javadzadeh

unread,
Nov 17, 2024, 4:50:57 PM11/17/24
to ns-3-users
Actually, I am a beginner and I wanted to write a routing algorithm using clustering. I did not get the right numbers to test the network parameters, I wanted to observe the network conditions through visual execution. That is why I went to Netanim.
Before NetAnim, I had tried to use Visualizer, which also had this problem:

(python:10303): Gtk-WARNING **: 01:06:31.647: This process is currently running setuid or setgid.
This is not a supported use of GTK+. You must create a helper
program instead. For further details, see:

    http://www.gtk.org/setuid.html

Refusing to initialize GTK+

On the other hand, for some reason I had to use wave, so I used version 38. If you have a better alternative for this, I would be grateful if you introduce it.

Tommaso Pecorella

unread,
Nov 17, 2024, 4:59:14 PM11/17/24
to ns-3-users
Perhaps it's easier to fix the GTK issue (but I don't know how).

Just a question... you're not trying to run ns-3 as root, RIGHT?
If you are, that's the issue: ns-3 should be run as a "normal" user. There are some parts that **might** require the admin password, but that's covered by the "--enable-sudo" configuration parameter. 

Tom Henderson

unread,
Nov 17, 2024, 8:25:12 PM11/17/24
to ns-3-...@googlegroups.com
I believe that, by the time of ns-3.38, wave had fallen out of compatibility with the wifi module, and there was no one interested to maintain wave module, so we removed it rather than keep it in the releases so that people didn't get frustrated with issues such as these.

For using wave, I would probably recommend an even earlier release such as 3.35 or even earlier, but the older releases start to get into compilation issues with the current compilers.

- Tom
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ns-3-users/63b68f1e-6342-46e6-bd10-bc03f0d8d8aen%40googlegroups.com.


Negar Javadzadeh

unread,
Nov 18, 2024, 2:27:12 AM11/18/24
to ns-3-users
I think need other way to test my simulation.
yes I was running ns3 as a normal user and I enabled sudo configuration before. 

Negar Javadzadeh

unread,
Nov 18, 2024, 2:36:55 AM11/18/24
to ns-3-users
Thanks for your recommendation. I will change my version.
Actually I am replicating a paper and they use wave. so I chose it too for matching the results. I can't find their git repository, so I tried to implement it my own but I got in trouble.
Reply all
Reply to author
Forward
0 new messages