A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uan-channel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Leonard Tracy <lentracy@gmail.com>
18 */
19
20#ifndef UAN_CHANNEL_H
21#define UAN_CHANNEL_H
22
23#include "uan-noise-model.h"
24#include "uan-prop-model.h"
25
26#include "ns3/channel.h"
27#include "ns3/net-device.h"
28#include "ns3/packet.h"
29
30#include <list>
31#include <vector>
32
33namespace ns3
34{
35
36class UanNetDevice;
37class UanPhy;
38class UanTransducer;
39class UanTxMode;
40
41/**
42 * \ingroup uan
43 *
44 * Channel class used by UAN devices.
45 */
46class UanChannel : public Channel
47{
48 public:
49 /**
50 * UanDeviceList is a standard template vector of pairs
51 * (UanNetDevice, UanTransducer)
52 */
53 typedef std::vector<std::pair<Ptr<UanNetDevice>, Ptr<UanTransducer>>> UanDeviceList;
54
55 UanChannel(); //!< Constructor
56 ~UanChannel() override; //!< Dummy destructor, see DoDispose.
57
58 /**
59 * Register this type.
60 * \return The object TypeId.
61 */
62 static TypeId GetTypeId();
63
64 // Inherited methods
65 std::size_t GetNDevices() const override;
66 Ptr<NetDevice> GetDevice(std::size_t i) const override;
67
68 /**
69 * Send a packet out on the channel.
70 *
71 * \param src Transducer transmitting packet.
72 * \param packet Packet to be transmitted.
73 * \param txPowerDb Transmission power in dB.
74 * \param txmode UanTxMode defining modulation of transmitted packet.
75 */
76 virtual void TxPacket(Ptr<UanTransducer> src,
77 Ptr<Packet> packet,
78 double txPowerDb,
79 UanTxMode txmode);
80
81 /**
82 * Adds device to receiver list for this channel.
83 *
84 * \param dev Net Device of node.
85 * \param trans Transducer of net device attached to this channel.
86 */
88
89 /**
90 * Set the propagation model this channel will use
91 * for path loss/propagation delay.
92 *
93 * \param prop The propagation model.
94 */
96
97 /**
98 * Set the noise model this channel will use
99 * to determine ambient channel noise.
100 *
101 * \param noise The noise model.
102 */
104
105 /**
106 * Get the noise level on the channel.
107 *
108 * \param fKhz Frequency in kHz.
109 * \return Ambient noise in dB/Hz on channel at a frequency.
110 */
111 double GetNoiseDbHz(double fKhz);
112
113 /**
114 * Clear all pointer references. */
115 void Clear();
116
117 protected:
118 UanDeviceList m_devList; //!< The list of devices on this channel.
119 Ptr<UanPropModel> m_prop; //!< The propagation model.
120 Ptr<UanNoiseModel> m_noise; //!< The noise model.
121 /** Has Clear ever been called on the channel. */
123
124 /**
125 * Send a packet up to the receiving UanTransducer.
126 *
127 * \param i Device number.
128 * \param packet The received packet.
129 * \param rxPowerDb Signal power in dB of arriving packet.
130 * \param txMode Mode arriving packet is using.
131 * \param pdp PDP of arriving signal.
132 */
133 void SendUp(uint32_t i, Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
134
135 void DoDispose() override;
136
137}; // class UanChannel
138
139} // namespace ns3
140
141#endif /* UAN_CHANNEL_H */
Abstract Channel Base Class.
Definition: channel.h:45
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Channel class used by UAN devices.
Definition: uan-channel.h:47
void SetNoiseModel(Ptr< UanNoiseModel > noise)
Set the noise model this channel will use to determine ambient channel noise.
Definition: uan-channel.cc:196
double GetNoiseDbHz(double fKhz)
Get the noise level on the channel.
Definition: uan-channel.cc:210
void AddDevice(Ptr< UanNetDevice > dev, Ptr< UanTransducer > trans)
Adds device to receiver list for this channel.
Definition: uan-channel.cc:141
UanChannel()
Constructor.
Definition: uan-channel.cc:68
Ptr< UanPropModel > m_prop
The propagation model.
Definition: uan-channel.h:119
static TypeId GetTypeId()
Register this type.
Definition: uan-channel.cc:48
Ptr< UanNoiseModel > m_noise
The noise model.
Definition: uan-channel.h:120
~UanChannel() override
Dummy destructor, see DoDispose.
Definition: uan-channel.cc:75
void DoDispose() override
Destructor implementation.
Definition: uan-channel.cc:115
virtual void TxPacket(Ptr< UanTransducer > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txmode)
Send a packet out on the channel.
Definition: uan-channel.cc:148
std::size_t GetNDevices() const override
Definition: uan-channel.cc:129
bool m_cleared
Has Clear ever been called on the channel.
Definition: uan-channel.h:122
Ptr< NetDevice > GetDevice(std::size_t i) const override
Definition: uan-channel.cc:135
std::vector< std::pair< Ptr< UanNetDevice >, Ptr< UanTransducer > > > UanDeviceList
UanDeviceList is a standard template vector of pairs (UanNetDevice, UanTransducer)
Definition: uan-channel.h:53
UanDeviceList m_devList
The list of devices on this channel.
Definition: uan-channel.h:118
void SendUp(uint32_t i, Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Send a packet up to the receiving UanTransducer.
Definition: uan-channel.cc:203
void Clear()
Clear all pointer references.
Definition: uan-channel.cc:80
void SetPropagationModel(Ptr< UanPropModel > prop)
Set the propagation model this channel will use for path loss/propagation delay.
Definition: uan-channel.cc:122
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.