/usr/include/ns3/half-duplex-ideal-phy.h is in libns3-dev 3.13+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 CTTC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
*/
#ifndef HALF_DUPLEX_IDEAL_PHY_H
#define HALF_DUPLEX_IDEAL_PHY_H
#include <ns3/spectrum-value.h>
#include <ns3/mobility-model.h>
#include <ns3/packet.h>
#include <ns3/nstime.h>
#include <ns3/net-device.h>
#include <ns3/spectrum-phy.h>
#include <ns3/spectrum-channel.h>
#include <ns3/spectrum-interference.h>
#include <ns3/data-rate.h>
#include <ns3/generic-phy.h>
#include <ns3/event-id.h>
#include <ns3/spectrum-signal-parameters.h>
namespace ns3 {
/**
* \ingroup spectrum
*
* This PHY layer implementation realizes an ideal OFDM PHY which
* transmits half-duplex (i.e., it can either receive or transmit at a
* given time). The device is ideal in the sense that:
* 1) it uses an error model based on the Shannon capacity, which
* assumes ideal channel coding;
* 2) it uses ideal signal acquisition, i.e., preamble detection and
* synchronization are always successful
* 3) it has no PHY layer overhead
*
* Being half duplex, if a RX is ongoing but a TX is requested, the RX
* is aborted and the TX is started. Of course, no RX can be performed
* while there is an ongoing TX.
*
* The use of OFDM is modeled by means of the Spectrum framework. By
* calling the method SetTxPowerSpectralDensity(), the
* user can specify how much of the spectrum is used, how many
* subcarriers are used, and what power is allocated to each
* subcarrier.
*
* The user can also specify the PHY rate
* at which communications take place by using SetRate(). This is
* equivalent to choosing a particular modulation and coding scheme.
*
* The use of the ShannonSpectrumErrorModel allows us to account for
* the following aspects in determining whether a
* transmission is successful or not:
* - the PHY rate (trades off communication speed with reliability)
* - the power spectral density (trade-off among total power consumed,
* total bandwidth used (i.e., how much of the spectrum is occupied),
* and communication reliability)
* - the signal propagation
*/
class HalfDuplexIdealPhy : public SpectrumPhy
{
public:
HalfDuplexIdealPhy ();
virtual ~HalfDuplexIdealPhy ();
/**
* PHY states
*
*/
enum State
{
IDLE, TX, RX
};
static TypeId GetTypeId (void);
// inherited from SpectrumPhy
void SetChannel (Ptr<SpectrumChannel> c);
void SetMobility (Ptr<MobilityModel> m);
void SetDevice (Ptr<NetDevice> d);
Ptr<MobilityModel> GetMobility ();
Ptr<NetDevice> GetDevice ();
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
void StartRx (Ptr<SpectrumSignalParameters> params);
/**
* set the Power Spectral Density of outgoing signals in power units
* (Watt, Pascal...) per Hz.
*
* @param txPsd
*/
void SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd);
/**
*
* @param noisePsd the Noise Power Spectral Density in power units
* (Watt, Pascal...) per Hz.
*/
void SetNoisePowerSpectralDensity (Ptr<const SpectrumValue> noisePsd);
/**
* Start a transmission
*
*
* @param p the packet to be transmitted
*
* @return true if an error occurred and the transmission was not
* started, false otherwise.
*/
bool StartTx (Ptr<Packet> p);
/**
* set the PHY rate to be used by this PHY.
*
* @param rate
*/
void SetRate (DataRate rate);
/**
*
* @return the PHY rate used by this PHY.
*/
DataRate GetRate () const;
/**
* set the callback for the end of a TX, as part of the
* interconnections betweenthe PHY and the MAC
*
* @param c the callback
*/
void SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c);
/**
* set the callback for the start of RX, as part of the
* interconnections betweenthe PHY and the MAC
*
* @param c the callback
*/
void SetGenericPhyRxStartCallback (GenericPhyRxStartCallback c);
/**
* set the callback for the end of a RX in error, as part of the
* interconnections betweenthe PHY and the MAC
*
* @param c the callback
*/
void SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c);
/**
* set the callback for the successful end of a RX, as part of the
* interconnections betweenthe PHY and the MAC
*
* @param c the callback
*/
void SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c);
private:
virtual void DoDispose (void);
void ChangeState (State newState);
void EndTx ();
void AbortRx ();
void EndRx ();
EventId m_endRxEventId;
Ptr<MobilityModel> m_mobility;
Ptr<NetDevice> m_netDevice;
Ptr<SpectrumChannel> m_channel;
Ptr<SpectrumValue> m_txPsd;
Ptr<const SpectrumValue> m_rxPsd;
Ptr<Packet> m_txPacket;
Ptr<Packet> m_rxPacket;
DataRate m_rate;
State m_state;
TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
TracedCallback<Ptr<const Packet> > m_phyRxAbortTrace;
TracedCallback<Ptr<const Packet> > m_phyRxEndOkTrace;
TracedCallback<Ptr<const Packet> > m_phyRxEndErrorTrace;
GenericPhyTxEndCallback m_phyMacTxEndCallback;
GenericPhyRxStartCallback m_phyMacRxStartCallback;
GenericPhyRxEndErrorCallback m_phyMacRxEndErrorCallback;
GenericPhyRxEndOkCallback m_phyMacRxEndOkCallback;
SpectrumInterference m_interference;
};
}
#endif /* HALF_DUPLEX_IDEAL_PHY_H */
|