Hi everyone,
I have a quick question probably. I know where can i find and how should i use new attributes, this time there is smth wrong in the code.
I would like to add the attribute that limits the range of the node. I'm not sure if it is the right one.
List of attributed is here:
ns3::YansWifiPhy
-
EnergyDetectionThreshold: The energy of a received signal should be higher than this threshold (dbm) to allow the PHY layer to detect the signal.
-
CcaMode1Threshold: The energy of a received signal should be higher than this threshold (dbm) to allow the PHY layer to declare CCA BUSY state
-
TxGain: Transmission gain (dB).
-
RxGain: Reception gain (dB).
-
TxPowerLevels: Number of transmission power levels available between TxPowerStart and TxPowerEnd included.
-
TxPowerEnd: Maximum available transmission level (dbm).
-
TxPowerStart: Minimum available transmission level (dbm).
-
RxNoiseFigure: Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver. According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure),
this is "the difference in decibels (dB) between the noise output of
the actual receiver to the noise output of an ideal receiver with the
same overall gain and bandwidth when the receivers are connected to
sources at the standard noise temperature T0 (usually 290 K)". For
-
State: The state of the PHY layer
-
ChannelSwitchDelay: Delay between two short frames transmitted on different frequencies.
-
ChannelNumber: Channel center frequency = Channel starting frequency + 5 MHz * nch
-
Frequency: The operating frequency.
-
Transmitters: The number of transmitters.
-
Recievers: The number of recievers.
-
ShortGuardEnabled: Whether or not short guard interval is enabled.
-
LdpcEnabled: Whether or not LDPC is enabled.
-
STBCEnabled: Whether or not STBC is enabled.
-
GreenfieldEnabled: Whether or not STBC is enabled.
-
ChannelBonding: Whether 20MHz or 40MHz.
How to use them:
https://www.nsnam.org/doxygen/classns3_1_1_yans_wifi_phy_helper.html#detailsThe question is, where is the error in the part: (ERROR: ../scratch/gpsr-test_my.cc:362:11: error: ‘class ns3::YansWifiPhyHelper’ has no member named ‘SetAttribute’)
YansWifiPhyHelper wifiPhy;
wifiPhy.SetAttribute("TxGain", DoubleValue(15));
void
GpsrExample::CreateDevices ()
{
////////TRIAL VERSION//////////////
/*
NqosWifiMacHelper wifiMac; //
wifiMac.SetType ("ns3::AdhocWifiMac");
*/
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); //
wifiMac.SetType ("ns3::AdhocWifiMac");
//YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();//in this case we have a default physic layer configuration
YansWifiPhyHelper wifiPhy;
wifiPhy.SetAttribute("TxGain", DoubleValue(15));
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ()); //creating a channel object and asociating it to our phy layer object manager to make sure all the phy layer object are using the same medium
WifiHelper wifi = WifiHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", UintegerValue (0));
devices = wifi.Install (wifiPhy, wifiMac, nodes);
if (pcap)
{
wifiPhy.EnablePcapAll (std::string ("gpsr"));
}
}
If i code smth like this:
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Set("ns3::TxGain", DoubleValue(15));
the error looks like:
../scratch/gpsr-test_my.cc:355:84: error: cannot call member function ‘void ns3::YansWifiPhyHelper::Set(std::string, const ns3::AttributeValue&)’ without object
I spent too much time on this, maybe you can help me easily.
Thanks in advance,
Marcin